"; $error = true; } // test for empty name if ($name == "") { $error_name = "Please enter your name:
"; $error = true; } // test for empty email if ($email == "") { $error_email = "Please enter your e-mail address:
"; $error = true; } // insert into db and send email if (!$error) { SendRegistrationMail ($email, $name); SendNotificationMail ($email, $name); header ("Location: thanks.html"); die; } } echo << PHP Function Index for Mac OS X

Free Registration

Please note that only hobbyist and academic users are eligible to apply for the free license. All other users should buy a license here.

Hobbyist users are programming PHP for fun, not taking any money for it.

Academic users are students or teachers. This applies to all learning institutions, not only universities.

Name:
$error_name
E-Mail:
$error_email
$error_checkbox
I am a hobbyist / academic user
END; function SendRegistrationMail ($email, $name) { // ward off attacks $email = str_replace ("\r", "", $email); $email = str_replace ("\n", "", $email); $name = str_replace ("\r", "", $name); $name = str_replace ("\n", "", $name); if (strlen ($email) > 60) return; if (strlen ($name) > 60) return; $body = "Thank you for registering the PHP Function Index!\n\n"; $body .= "Your registration data is:\n\n"; $body .= "Serial Number Name: $name\n"; $body .= " Serial Number: 42\n"; $head = "From: wolfgang@artissoftware.com\r\n"; $head .= "Reply-To: wolfgang@artissoftware.com\r\n"; $head .= "X-Mailer: PHP/" . phpversion (); mail ($email, "PHPfi Registration Code", $body, $head); } function SendNotificationMail ($email, $name) { // ward off attacks $email = str_replace ("\r", "", $email); $email = str_replace ("\n", "", $email); $name = str_replace ("\r", "", $name); $name = str_replace ("\n", "", $name); if (strlen ($email) > 60) return; if (strlen ($name) > 60) return; $body = "Someone registered the PHP Function Index!\n\n"; $body .= "The data is:\n\n"; $body .= " Name: $name\n"; $body .= "E-Mail: $email\n"; $head = "From: wolfgang@artissoftware.com\r\n"; $head .= "Reply-To: wolfgang@artissoftware.com\r\n"; $head .= "X-Mailer: PHP/" . phpversion (); mail ("wolfgang@artissoftware.com", "PHPfi Free Registration", $body, $head); } ?>