this is my script for inserting a data to mysql at the same time sending an activation link to the new registered user
insert.php
<?
$database="database_registration";
$email =$_POST['emailForm'];
$password =$_POST['passwordForm'];
$fname =$_POST['fnameForm'];
$lname =$_POST['lnameForm'];
$address =$_POST['addressForm'];
$cnumber =$_POST['cnumberForm'];
$timeColumn = time();
$statColumn = 0;
$url = 'http://www.domain.com/test/activate.php?reg='.md5($password).'&code='.base64_encode($timeColumn);
$db_connection = mysql_connect("localhost","domain","password");
$result = mysql_query($sql, $db_connection);
mysql_select_db($database) or die(mysql_error());
$query="INSERT INTO regusers VALUES ('','$email','$password','$fname','$lname','$address','$cnumber','$timeColumn','$statColumn')";
mysql_query($query);
mysql_close();
$From ="Company";
$ToEmail = "$email";
$ToName = "$fname $lname";
$ToSubject = "Company Registration";
$Message = "Please activate your registration : \n $url \n Company Registration Activate";
mail($ToName." <".$ToEmail.">",$ToSubject, $Message, "From: ".$From." <".$Email.">");
?>
with that, this is how my activation email looks like :
Please activate your registration :
http://www.domain.com/test/activate.php?reg=5f4dcc3b5aa765d61d8327deb882cf99&code=MTExOTg2MTU0OA==
Company Registration Activate
...ive been wondering how did i get that last 2 "==" after my link. means to say that my link stops at the last "OA" but the 2 equal signs stays just right after "OA". is there a way that i could take that off if thats not part of the link
for the second question
activate.php
<?
$database="database_registration";
$db_connection = mysql_connect("localhost","domain","password");
mysql_select_db($database) or die(mysql_error());
mysql_query("UPDATE regusers SET status = 1 WHERE (passworddb = " .md5($_GET['reg']) . ") AND (timedb = " .base64_decode($_GET['code']). ")", $db_connection) or die(mysql_error());
mysql_close();
?>
is there something wrong with this line???
mysql_query("UPDATE regusers SET status = 1 WHERE (passworddb = " .md5($_GET['reg']) . ") AND (timedb = " .base64_decode($_GET['code']). ")", $db_connection) or die(mysql_error());
...coz ive been getting this kind of error
Unknown column '696d29e0940a4957748fe3fc9efd22a3' in 'where clause'
thanks in advance!