General security rules See our post here
All posts by
Error Pages
#———- ERROR PAGE REDIRECTS ———- ErrorDocument 403 http://www.mydomain.com/index.php ErrorDocument 404 http://www.mydomain.com/index.php
Comments
Use the hash character: # Main Menu Links or use at each end if preferred # Main Menu Links #
.Include General
include ('classes/config.php'); include_once ('classes/config.php'); require ('classes/config.php'); require_once ('classes/config.php'); Included Files Corrupting Things Whitespace before or after the php start and end markers White space or any characters before or after the <?php and ?> will be output in the same way as echo(as html) in an included file. This can be a problem, for instance having a line […]
Rewrite rules
Good Resources For Example Rules https://gist.github.com/ScottPhillips/1721489 Before the rules Options +FollowSymLinks RewriteEngine On RewriteBase / No Parameters Example RewriteRule ^groups$ groups.php [L] 1 Parameter Example RewriteRule ^flips/([^/]*)$ flips.php?fid=$1 [L] Converts this URL format: http://www.mydomain.com/flips/996803385327 To this actual php page http://www.mydomain.com/flips.php?fid=996803385327 2 Parameter Example RewriteRule ^flips/([^/]*)/([^/]*)$ flips.php?fid=$1&valueb=$2 [L] Converts this URL format: http://www.mydomain.com/flips/996803385327/hello To this […]
Rollover / Hover Pop Up Text
<a href="some_page.php" title="Some hover rollover text" >Click Here</a>
Merging Arrays
Join Arrays – Only adding unique indexes / keys Merge Arrays
Array Of SQL Results
Creating An Array Of All Results $all_results = array(); //Empty array to hold returned rows while ($row = @mysql_fetch_array($search_query)) { $all_results[] = $row; }
Time Difference
Seconds Since DateTime
DateTime general
ORDER BY Date Order ASC = oldest first DESC = most recent first Note it’s “MINUTE”, “HOUR”, etc not “MINUTES” or “HOURS” etc Convert DateTime to Date Specifying Date and DateTime from a string It is recommended to use CAST() Last Day Of Month (This produces a DATE result, not DATETIME) Get SQL Server’s Current […]
