maxpup979 wrote:assuming you have the email address, you can use the mail function. When you create the body of the message, you can easily include the token.
sorted it now send the email including the url to activate prob now is i want the url to include the code & the user id but the user id is assigned by the MYSQL server not the phpcode so is there anyway i can run 2 queries on the table in one script to get the id and add it to teh url heres my code:
activate.php
<?
$DBhost = "localhost"; /* DON'T CHANGE should be fine as it is ok*/
$DBuser = "******";
$DBpass = "******";
$DBName = "******";
$table = "pilotinfo"; /* DON'T CHANGE*/
mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable to connect to database");
// Create variables from URL.
$pid = $_REQUEST['id'];
$code = $_REQUEST['code'];
$sql = mysql_query("UPDATE pilotinfo SET visible='1' WHERE id='$pid' AND regcode='$regcode'")or die(mysql_error());
$sql_doublecheck = mysql_query("SELECT * FROM pilotinfo WHERE id='$pid' AND regcode='$regcode' AND activated='1'")or die(mysql_error());
$doublecheck = mysql_num_rows($sql_doublecheck)or die(mysql_error());
if($doublecheck == 0){
echo "Your account could not be activated, please contact [email]webmistress@hollowdreams.net[/email];
} elseif ($doublecheck > 0) {
echo "Your account has been activated. You may login below:<br />";
include 'login_form.html';
}
?>
apply.php
<?
print "<BODY BGCOLOR=\"#CCCCCC\">";
$DBhost = "localhost"; /* DON'T CHANGE should be fine as it is ok*/
$DBuser = "*******";
$DBpass = "******";
$DBName = "******";
$table = "pilotinfo"; /* DON'T CHANGE*/
mysql_connect($DBhost,$DBuser,$DBpass) or die("Unable to connect to database");
@mysql_select_db($DBName) or die("Unable to select
database $DBName");
$name = $_POST['name'];
$email = $_POST['email'];
$age = $_POST['age'];
$history = $_POST['history'];
$webaddyhist = $_POST['webaddyhist'];
$role = $_POST['role'];
$comments = $_POST['comments'];
$registered_on = gmdate("l d M Y");
$registered_at = gmdate("H:i:s");
$regcode = md5(uniqid(rand(),1));
$sqlquery = "INSERT INTO $table values ('$id','$visible','$name','$email','$age','$history','$webaddyhist','$role','$comments',0,'$registered_on','$registered_at','$regcode')";
$results = mysql_query($sqlquery);
$idquery = "SELECT id FROM $table WHERE regcode='$regcode'";
$results2 = mysql_query($idquery);
$pid = $results2;
####################################
#confirmation e-mail settings Below#
####################################
$subject = "easyJet Virtual Registration Confirmation";
$message = "Thank You For Registering At easyJet Virtual
Before you appear on the roster and before you can file pireps you are required to activate your account to do so please click on this link to activate your account http://www.danhill.frihost.net/easyjetv/activate.php?code='$regcode'&id='$pid'";
$headers = "From: register@easyjet-v.tk";
$mailsend = mail($email,$subject,$message,$headers);
#####################################
#End of confirmation e-mail settings#
#####################################
mysql_close();
print "<HTML><TITLE> PHP and MySQL </TITLE><center><table border=\"0\"
width=\"500\"><tr><td>";
print "<p><font face=\"verdana\" size=\"+0\"> <center>You
Just Entered This Information Into the
Database<p><blockquote>";
print "Name : $name
<p>
E-Mail : $email
<p
age : $age
<p>
History : $history
<p>
Url of previous VA or E-Mail address : $webaddyhist
<p>
Your Role within easyJet-V : $role
<p>
Comments : $comments
</blockquote></td></tr></table>
</center></BODY></HTML>";
?>