I have altered this script that I found on some site to get it to work. After
studying the script, fixing the syntax, and changing a few things, I got all of it to
work... However, I still have a problem. I made a script called ok.php to create an
activation key (just a ENCRYPT("makeactivationkey") thing). Well, for some
reason, it won't work. take a look, this is my create_entry.php, this creates the
user then goes to ok.php:
PHP Code:
$dbh=mysql_connect ("localhost", "myuser", "MYPASSWORD") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("hexadmin_user");
if ($submit = "Register") { if($password == $vpassword) { $query = "insert into users (username, password, email, name, address, city, state, date, verify) values ('$username', '$password', '$email', '$name', '$address', '$city', '$state', CURDATE(), ENCRYPT('createnewpass'))"; mysql_query($query) or die (mysql_error());
print("<h3>You are now registered, going to next script</h3>"); } else { print("Your passwords didn't match. Go <a href=\"java_script_:history.back(1)\">back</a>"); } } else { print("Error in system. You weren't added"); } ?> <script> window.location="http://signup.webhex.net/ok.php?email=<?PHP echo $email;?>&username=<?PHP echo $username;?>"; </script>
then this is my ok.php:
PHP Code:
$user = $_GET['username']; $email = $_GET['email']; $dbh=mysql_connect ("localhost", "myuser", "mypassword") or die ('I cannot connect to the database because: ' . mysql_error()); mysql_select_db ("hexadmin_user");
$result=mysql_query("Select * From users Where username='$user'") or die ("No such user."); while ($row=mysql_fetch_array($result)) { if ($row["username"]==$user ) { $query = "UPDATE users SET activate = ENCRYPT('$user') WHERE username = '$user'"; mysql_query($query) or die (mysql_error()); } else { print("No such user"); } } } $myKey=mysql_query("Select activate From users Where username='$user'") or die ("error"); mail("$email", "Activation Key!", "WebHex.net webmasters thank you for signing up with our system. However, you need to activate your account by going to the following addess: http://signup.webhex.net/activate1.php?activationKey=$myKey &username=$user and using the username that you used to signup with: $user and the activation key: $myKey"); ?> Thank you <b><?PHP echo $user; ?></b>, for registering with WebHex.net! We have sent an confirmation e-mail to <b><?PHP echo $email; ?></b>. Please, go check your e-mail. <p> Without checking your e-mail to confirm your account, your account will not be active. If an account is inactive, the user can NOT sign in. Also, you MUST check it with-in 30 days. All accounts will be purged that have been inactive for 31 days!