Hi, I’m working on setting up a double opt-in email system for a flash site I’m developing for a client. I have the database and tables properly setup, and found some php code on how to do that. I’ve modified the file slightly, adding extra variables for the extra fields that need to be filled… and no luck…
here is the entire php problem script. the error is listed on line 85, the very last one.
I will also attach the old php script w/o double opt, and the login.swf interface. Any help on this matter would be greatly appreciated… I am highly pressed for time, and have scoured the net for weeks.
<?php
define ( ‘DB_USER’, ‘’ );
define ( ‘DB_PASS’, ‘’ );
define ( ‘DB_DB’, ‘’ );
define ( ‘DB_HOST’, ‘’ );
mysql_connect(DB_HOST,DB_USER,DB_PASS) or die(“Error connecting to Database! Please Try again.” . mysql_error());
mysql_select_db(DB_DB) or die(“Cannot select database! Please Try again.” . mysql_error());
$yoursite = ’ .com’;
$youremail = ‘no-reply@ .com’;
$webmaster = ’ ';
/*
- ! - ! - Variables set in PHP
$correct
$qResult
$nRows
$rString
$check_user
$reg_ok
$reg_msg - ! - ! - Variables set in Flash
$user
$pass
$reg_user
$reg_pass
$reg_mail
$reg_fName
$reg_lName
$reg_add1
$reg_add2
$reg_city
$reg_state
$reg_zip
$reg_age
$sql_type
*/
//Login Script
if ($sql_type == 0){
$qResult = mysql_query(“SELECT * FROM userInfo
WHERE userName
= ‘$user’ AND password
= ‘$pass’”);
$nRows = mysql_num_rows($qResult);
$rString = “&n=”.$nRows."&<br>";
if ($nRows > 0){
$correct = 1;
$rString .= “&correct=”.$correct."&<br>";
}
echo $rString;
//Register Script
} else if ($sql_type == 1){
$check_user = mysql_query(“SELECT * FROM userInfo
WHERE userName
= ‘$reg_user’”);
$check_user_row = mysql_num_rows($check_user);
if ($check_user_row > 0){
$reg_ok = 0;
$reg_msg = “Sorry, that username is already taken!”;
$rString = “®_ok=”.$reg_ok."&<br>®_msg=".$reg_msg."&<br>";
} else if ($sql_type == 1){
$check_mail = mysql_query(“SELECT * FROM userInfo
WHERE email
= ‘$reg_mail’”);
$check_user_mail = mysql_num_rows($check_mail);
if ($check_user_mail > 0){
$reg_ok = 0;
$reg_msg = “Sorry, that email is already taken!”;
$rString = “®_ok=”.$reg_ok."&<br>®_msg=".$reg_msg."&<br>";
} else if ($check_user_row <= 0){
$confirmKey =md5(uniqid(rand()));
//Make account
mysql_query(“INSERT INTO userTemp
(confirmKey
, userName
, password
, firstName
, lastName
, address1
, address2
, city
,state
, zip
, email
, age
, regDate
) VALUES ($confirmKey, ‘$reg_user’, ‘$reg_pass’, ‘$reg_fName’, ‘$reg_lName’, ‘$reg_add1’, ‘$reg_add2’, ‘$reg_city’, ‘$reg_state’, ‘$reg_zip’, ‘$reg_mail’, ‘$reg_age’, ‘’)”);
$reg_ok = 1;
$reg_msg = “$reg_fName, a verification e-mail has been sent to your address. Please log in to your e-mail and follow the directions in the message to activate your account.”;
$rString = “®_ok=”.$reg_ok."&<br>®_msg=".$reg_msg."&<br>";
}
echo $rString;
$subject = “$yoursite Email Verification”;
$message="Your Confirmation link
";
$message.="Click on this link to activate your account.
";
$message.="http://www. .com/test/confirm.php?passkey=$confirmKey
";
$message.="Alternatively, you may copy and paste this link into your browser.
";
$message.="Verification code: $confirmKey
";
$message.="We will be adding much more content to this site, so please visit often!
";
$message.=“Thanks,
“;
$message.=”$webmaster”;
mail($reg_mail, $subject, $message, “From: $yoursite <$youremail>
X-Mailer:PHP/” . phpversion());
}
?>