It is now $timenow.

"); */ $daytoday = strftime("%a",$time); $daytoday = tr($daytoday,"A-Z","a-z"); $sock = msqlConnect(); if ($sock < 0) { fatal("Error : $ERRMSG\n"); } if (msqlSelectDB($sock,"take-away") < 0) { fatal("Error : $ERRMSG\n"); } if ($captcha_value == "") { echo("

You have not entered the characters shown in the image - this is a security measure. Please use your browser's back button to go back and enter these characters."); } else { $query = "select image_name, letters from captcha where image_name = '$file_name'"; if (msqlQuery($sock, $query) < 0) { fatal("Error : $ERRMSG\n"); } $res = msqlStoreResult(); $num_rows = msqlNumRows($res); if ($num_rows < 1) { echo("

The characters you typed are incorrect. Please use your browser's back button to go back and correct."); msqlFreeResult($res); } else { $row = msqlFetchRow($res); msqlFreeResult($res); $captcha_value= tr($captcha_value,"a-z","A-Z"); if ($captcha_value != $row[1]) { echo("

The characters you typed $captcha_value are incorrect. Please use your browser's back button to go back and correct."); } else { $last_name= tr($last_name,"a-z","A-Z"); $query = "select cust_id, emailaddress, last_name, first_name, postcode from take_away_customers where emailaddress clike '$emailaddress' and last_name clike '$last_name' and postcode='$postcode'"; if (msqlQuery($sock, $query) < 0) { fatal("Error : $ERRMSG\n"); } $res = msqlStoreResult(); $num_rows = msqlNumRows($res); $row = msqlFetchRow($res); msqlFreeResult($res); if ($num_rows < 1) { echo("

No customer i.d. matches the supplied information.
$emailaddress $last_name $postcode
If you have made a mistake use your browser's back button to go back and correct."); } else { $cust_id = $row[0]; $first_name = $row[3]; echo(""); $tmpfile = "/usr/local/apache2.2/htdocs/take-away/tmp/$cust_id.txt"; $fd = open("$tmpfile", ">"); if($fd < 0) { system("echo 'Cannot create temp file $tmpfile' | mail -s'create_customer.html error' brad@austbiz.com.au"); } else { fprintf($fd,"To: $emailaddress\n"); fprintf($fd,"Bcc: bradhill@bigpond.net.au\n"); fprintf($fd,"Subject: take-away.com.au Customer I.D. retrieval.\n"); fprintf($fd,"Content-Type:text/html; iso-8859-1\n"); fprintf($fd,"Content-Transfer-Encoding: 8bit\n"); fprintf($fd,"\n"); fprintf($fd,"take-away.com.au\n"); fprintf($fd,"You may need to click Load Images in your browser to see the images.
"); fprintf($fd,"
"); fprintf($fd,"

Hi $first_name.

"); fprintf($fd,"Your customer i.d. is $cust_id

"); fprintf($fd,"Please write down your customer i.d. or print this page and keep in a secure place for future reference.

"); $text_file = "general_notification.txt"; if(test("f","/usr/local/apache2.2/htdocs/take-away/notifications/$text_file")==1) { $n_fd = open("/usr/local/apache2.2/htdocs/take-away/notifications/$text_file", "<"); } if ($n_fd < 0) { echo("Error: $ERRMSG\n"); } else { $notification_line = readln($n_fd); fprintf($fd,"$notification_line
"); while ($notification_line != "") { $notification_line = readln($n_fd); fprintf($fd,"$notification_line
"); } close($n_fd); } fprintf($fd,"

To see participating restaurants in your region $postcode Click here.

"); fprintf($fd,""); close($fd); system("cat $tmpfile | sendmail -t&"); if(exists($referring_url)) { if($referring_url != "") { $referring_url_array = split($referring_url,"?"); $loc = "http://" + $referring_url_array[0] + "?" + "$cust_id" + "&" + "shop_id=" + $referring_url_array[1]; echo("You are now being returned - Please wait"); sleep(2); echo("

$loc

"); echo(""); } else { echo("

Your Customer I.D. is $cust_id. It has been reset in your browser.
If you return to your ordering page it will be automatically filled out for you.

"); } } else { echo("

Your Customer I.D. is $cust_id. It has been reset in your browser.
If you return to your ordering page it will be automatically filled out for you.

"); } } } } } } msqlClose($sock); >