Thank you for your help, the info you gave was just what I needed. I control-ced and edited the following. Is there any way that I can improve it or is it as good as it can get? The other parts of the code should be easy for me to do so I am just going to post the parts I need help with.
This is the script to make a random code:
<?
function makeRandomPassword() {
$salt = "abchefghjkmnpqrstuvwxyz0123456789";
srand((double)microtime()*1000000);
$i = 0;
while ($i <= 7) {
$num = rand() % 33;
$tmp = substr($salt, $num, 1);
$pass = $pass . $tmp;
$i++;
}
return $pass;
}
$random_password = makeRandomPassword();
?>
And this is the script to set the boolean value to 1 (the default is 0):
case "confirm":
if(isset($_GET['code'])) {
if(mysql_query("SELECT * FROM ".MY_TABLE." WHERE code='".$_GET['code']."'")) {
mysql_query("UPDATE ".MY_TABLE." SET active = '1' WHERE code = '".$code."'");
echo "Thank you for confirming, you are now added to the list";
} else {
echo "You have the wrong code or id, please double check";
}
} else {
echo "Please use the link in email to confirm your subscription";
}
break;
I'm doing it basically the way you mentioned in the previous post.
Step 1. The user fills in a form and presses "subscribe"
Step 2. The form sends the information to a script which enters the subscriber's name, email address, code, boolean value 0, and date in a MySQL Database and sends an email to the subscriber with a short message and a link to confirm the subscription.
Step 3. The user (hopefully) clicks the link, which changes the boolean value to 1.
Step 4. When I send out mailings, I will send it to the members wheree "boolean value= 1"
Any suggestions? Critiques? Anything else? I am relatively new to php so any help is appreciated.
Farmernate