3 function todays_date() {
4 $today = date("m/d/Y");
8 function check_date($date) {
9 if (eregi('^.[0-9]{1,2}/.[0-9]{1,2}/.[0-9]{1,2}.[0-9]{1,2}', $date)) {
16 function check_phone($phonenumber,$useareacode=true)
18 if ( preg_match("/^[ ]*[(]{0,1}[ ]*[0-9]{3,3}[ ]*[)]{0,1}[-]{0,1}[ ]*[0-9]{3,3}[ ]*[-]{0,1}[ ]*[0-9]{4,4}[ ]*$/",$phonenumber) ||
(preg_match("/^[ ]*[0-9]{3,3}[ ]*[-]{0,1}[ ]*[0-9]{4,4}[ ]*$/",$phonenumber) && !$useareacode)) return eregi_replace("[^0-9]", "", $phonenumber);
22 function check_email_address($email) {
23 // First, we check that there's one @ symbol, and that the lengths are right
24 if (!ereg("^[^@]{1,64}@[^@]{1,255}$", $email)) {
25 // Email invalid because wrong number of characters in one section, or wrong number of @ symbols.
28 // Split it into sections to make life easier
29 $email_array = explode("@", $email);
30 $local_array = explode(".", $email_array[0]);
31 for ($i = 0; $i < sizeof($local_array); $i++
) {
32 if (!ereg("^(([A-Za-z0-9!#$%&'*+/=?^_`{|}~-][A-Za-z0-9!#$%&'*+/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$", $local_array[$i])) { //"
36 if (!ereg("^\[?[0-9\.]+\]?$", $email_array[1])) { // Check if domain is IP. If not, it should be valid domain name
37 $domain_array = explode(".", $email_array[1]);
38 if (sizeof($domain_array) < 2) {
39 return false; // Not enough parts to domain
41 for ($i = 0; $i < sizeof($domain_array); $i++
) {
42 if (!ereg("^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$", $domain_array[$i])) {