<?
//code provided by [url]www.special.com[/url]
include('dbinfo.inc.php');
include('css.php');
include('functions.inc.php');
stripslashes($username);
strip_tags($username);
$password = makeRandomPassword();
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$addy = $_POST['addy'];
$city = $_POST['city'];
$state = $_POST['state'];
$zip = $_POST['zip'];
$email1 = $_POST['email1'];
$email2 = $_POST['email2'];
$phone = $_POST['phone'];
$fax = $_POST['fax'];
$username = $_POST['username'];
$eula = $_POST['eula'];
if (getenv ("HTTP_X_FORWARDED_FOR")) {
$ip = getenv ("HTTP_X_FORWARDED_FOR");
} else {
$ip = getenv ("REMOTE_ADDR");
}
$taken = mysql_query("SELECT username FROM customers WHERE username='$username'") or die(mysql_error());
$isit = mysql_num_rows($taken);
if($isit == 1){
echo "Error. Username taken. <br>";
?> <form>
<input type="button" value="<-Back" onclick="history.back();">
</form>
<? } elseif($phone == '' || $email1 == '' || $email2 == '' || $username == '' || $fname == '' || $lname == ''){
echo "Error. Please fill out all required fields. <br>";
?> <form>
<input type="button" value="<-Back" onclick="history.back();">
</form>
<? } elseif($email1!=$email2){
echo "Error. Email addresses do not match. <br>";
?> <form>
<input type="button" value="<-Back" onclick="history.back();">
</form>
<? }
elseif($eula == 'no'){
echo "Error. You did not accept the EULA. <br>";
?> <form>
<input type="button" value="<-Back" onclick="history.back();">
</form>
<? } elseif($eula == ''){
echo "Error. You did not accept the EULA. <br>";
?> <form>
<input type="button" value="<-Back" onclick="history.back();">
</form>
<? } else {
$fname = $_POST['fname'];
$lname = $_POST['lname'];
$addy = $_POST['addy'];
$city = $_POST['city'];
$state = $_POST['state'];
$zip = $_POST['zip'];
$email1 = $_POST['email1'];
$email2 = $_POST['email2'];
$email = $_POST['email1'];
$phone = $_POST['phone'];
$fax = $_POST['fax'];
$username = $_POST['username'];
$password = crypt_md5($password, $key);
mysql_query("INSERT INTO customers (fname, lname, addy, city, state, zip, email, phone, fax, username, password, ip) VALUES ('$fname', '$lname', '$addy', '$city', '$state', '$zip', '$email', '$phone', '$fax', '$username', '$password', '$ip')") or die(mysql_error());
$password = decrypt_md5($password, $key);
//mail function
$to = $email1;
$from = "webmaster@spechal.com";
$subject = "Message From $from Via website";
$mailheaders = "From: $from <> \n";
$mailheaders .= "Reply-To: $from\n\n";
$body = "IP: $ip \n\nBody: \n\nThank you for registering with Spechal.com \n\nHere is your username: $username \nHere is your password: $password \n\n ";
stripslashes($body);
strip_tags($body);
mail($to, $subject, $body, $mailheaders);
echo "<font color='#000000' size='2' face='Tahoma'><b>";
print"<div align=\"center\">Thank you for registering $fname $lname <br>
You should be receiving your password shortly.<br>
Message Successfully Sent
to:<br><br><b>$to</b>\n";
?><br><br><a href="http://www.spechal.com" target="_parent">Return to home by clicking here.</a></div><?
echo "</font></b>";
$goingto = "webmaster@spechal.com";
$sub = "New Spechal.com Member!";
$body = "Check the database, cause you have a new user!";
$headers = "";
mail($goingto, $sub, $body, $headers);
}
?>
A little modification and you are good to go.