This file contains 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 | |
if ((($_FILES["file"]["type"] == "image/gif") | |
|| ($_FILES["file"]["type"] == "image/jpeg") | |
|| ($_FILES["file"]["type"] == "image/pjpeg")) | |
&& ($_FILES["file"]["size"] < 20000)) | |
{ | |
if ($_FILES["file"]["error"] > 0) | |
{ | |
echo "Error: " . $_FILES["file"]["error"] . "<br />"; | |
} |
This file contains 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
--Do not remove this if you are using-- | |
Original Author: Remiz Rahnas | |
Original Author URL: http://www.htmlremix.com | |
Published date: 2008/09/24 | |
Changes by Nick Fetchak: | |
- IE8 standards mode compatibility | |
- VML elements now positioned behind original box rather than inside of it - should be less prone to breakage | |
Published date : 2009/11/18 |
This file contains 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
$load = sys_getloadavg(); | |
if ($load[0] > 80) { | |
header('HTTP/1.1 503 Too busy, try again later'); | |
die('Server too busy. Please try again later.'); | |
} | |
/* | |
This is a function which returns three samples of the “load” on a system. Load is the number of processes in the system run queue. The 3 items in the array are the average load for the past 1, 5 and 15 minutes. The PHP Manual shows a great usage of this: | |
*/ |
This file contains 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
//for a number of classes to load automatically | |
//We can define the following function in our file | |
function __autoload($class_name) | |
{ | |
$path = str_replace("_", "/", $class_name); | |
require_once $path.".php"; | |
} |
This file contains 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
if(navigator.appName=="Microsoft Internet Explorer" ) { | |
return false; | |
} | |
else { | |
return this.init(canvasId,displayRadius,skinId,showSecondHand,gmtOffset); | |
} |
This file contains 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
//Use the fourth argument as false | |
echo htmlentities($foo, ENT_COMPAT, 'UTF-8',false); |
This file contains 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
<? | |
$dsn = 'mysql:dbname=test;host=hostname'; | |
$user = 'username'; | |
$password = 'Password'; | |
try { | |
$dbh = new PDO($dsn, $user, $password); | |
echo "Connected"; | |
} catch (PDOException $e) { | |
echo 'Connection failed: ' . $e->getMessage(); | |
} |
This file contains 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 | |
$sum = function($a,$b){ | |
return $a+$b; | |
}; | |
echo $sum(2,5); | |
?> |
This file contains 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.example { | |
width: 300px; /* applied in all browsers */ | |
*width: 350px; /* applied to IE6 and IE7 only */ | |
_width: 360px; /* applied to IE6 only */ | |
} |
This file contains 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 | |
// This function uses simple filter_var function | |
// instead of regular expression to validate email | |
// @param string email Email address to be validated | |
function validateEmail($email) { | |
return filter_var($email, FILTER_VALIDATE_EMAIL); | |
} | |
?> |
OlderNewer