This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//-------------------------------------------------------------------------- | |
// See if a url contains http:// or https:// | |
//-------------------------------------------------------------------------- | |
if( !preg_match('/http(s?)\:\/\//i', $url) ) { | |
// URL does NOT contain http:// or https:// | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//-------------------------------------------------------------------------- | |
// Remove non-numeric characters | |
//-------------------------------------------------------------------------- | |
$str = preg_replace('/[^0-9]/s', '', $str); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$max_upload_in_mb = min((int)(ini_get('upload_max_filesize')), (int)(ini_get('post_max_size')), (int)(ini_get('memory_limit'))); | |
echo $max_upload_in_mb . 'mb'; | |
?> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function current_page($params=NULL, $no_trailing_slash=TRUE) { | |
// http(s)://domain.com | |
$url = @$_SERVER['HTTPS'] == 'on' ? 'https://'. $_SERVER['SERVER_NAME'] : 'http://'.$_SERVER['SERVER_NAME']; | |
// add the port number, if there is one | |
if( @$_SERVER['SERVER_PORT'] != "80" && @$_SERVER['SERVER_PORT'] != "443" ) $url .= ':'. @$_SERVER['SERVER_PORT']; | |
// Append the query string | |
$url .= $_SERVER['REQUEST_URI']; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$mime_types = array( | |
'.3dm' => 'x-world/x-3dmf', | |
'.3dmf' => 'x-world/x-3dmf', | |
'.a' => 'application/octet-stream', | |
'.aab' => 'application/x-authorware-bin', | |
'.aam' => 'application/x-authorware-map', | |
'.aas' => 'application/x-authorware-seg', | |
'.abc' => 'text/vnd.abc', | |
'.acgi' => 'text/html', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Report ALL errors, and show them to the user | |
error_reporting(E_ALL); | |
ini_set('display_errors', 1); | |
// Log errors to log file, and do NOT show them to the user | |
ini_set('log_errors', 1); | |
ini_set('display_errors', 0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
div#page-menu { | |
float: left; | |
width: 250px; | |
margin: 0; | |
} | |
div#page-menu ul { | |
border: 2px solid #ccc; | |
border-top: none; | |
padding: 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Force www | |
RewriteCond %{HTTP_HOST} !^www\. | |
RewriteRule (.*) http://www.%{SERVER_NAME}%{REQUEST_URI} [R=301] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Force https:// | |
RewriteCond %{HTTPS} !=on | |
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT table_schema AS DatabaseName, | |
table_name AS TableName, | |
update_time AS LastAccessTime, | |
check_time AS LastCheckTime | |
FROM information_schema.tables | |
WHERE update_time < 'yyyy-mm-dd' | |
GROUP BY table_schema | |
ORDER BY update_time ASC; |