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 | |
// used to find the extenstion of a filename | |
function findExtension ($filename) { | |
$filename = strtolower($filename) ; | |
$exts = split("[/\\.]", $filename) ; | |
$n = count($exts)-1; | |
$exts = $exts[$n]; | |
return $exts; | |
} | |
?> |
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 | |
/* formats a 10 or 7 digit phone number (number only) by adding dashes at the appropriate locations */ | |
function phoneFormat($number) { | |
if(ctype_digit($number) && strlen($number) == 10) { | |
$number = substr($number, 0, 3) .'-'. substr($number, 3, 3) .'-'. substr($number, 6); | |
} else { | |
if(ctype_digit($number) && strlen($number) == 7) { | |
$number = substr($number, 0, 3) .'-'. substr($number, 3, 4); | |
} |
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 | |
/* Generates a random string from the charachters listed in $characters and returns the random string. | |
*/ | |
function genRandomString($length) { | |
$characters = '0123456789abcdefghijklmnopqrstuvwxyz!@#$%&*()'; | |
$randstring = ""; | |
for ($p = 0; $p < $length; $p++) { | |
$randstring .= $characters[mt_rand(0, strlen($characters))]; | |
} | |
return $randstring; |
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 | |
/* Validates if $zipCode is a 5 digit number in the 12345 format. Note that this simply checks to see if $zipCode is a 5 digit number, not necessarily a valid U.S. Zip Code. | |
*/ | |
function validateZipCode($zipCode) { | |
if (preg_match('#[0-9]{5}#', $zipCode)) | |
return true; | |
else | |
return false; | |
} | |
?> |
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 | |
/*Validates if $phone is a valid U.S. phone number in the 202-555-1234 format. | |
Note that the first didgit cannot be a 1 as no area code in the U.S. starts with a 1. | |
*/ | |
function validatePhoneNo($phone) { | |
if(preg_match("/^([1]-)?[0-9]{3}-[0-9]{3}-[0-9]{4}$/i", $phone)) | |
return true; | |
else | |
return false; | |
} |
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 echo $_SERVER['PHP_SELF']; ?> |
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
$lightgray : #819090; | |
$gray : #708284; | |
$mediumgray : #536870; | |
$darkgray : #475B62; | |
$darkblue : #0A2933; | |
$darkerblue : #042029; | |
$paleryellow : #FCF4DC; | |
$paleyellow : #EAE3CB; | |
$yellow : #A57706; | |
$orange : #BD3613; |
OlderNewer