0

im a newbie php developer...

i've tried sending an email n receiving the confirmation back for activating the users...

here is the email sending code :

if($res)
{
	echo "record added";
	$to = $mail;
	$sub = "Confirm Mail From LeLys";
	$header = "from: admin<support@domain.org>";
	
	$message = "confirm link \r\n";
	$message.= "click to activete your account";
	$message.= "http://www.domain.org/confirmation.php?key=$ccode";
	
	$sending = mail($to,$sub,$message,$header);
	
		if($sending)
			echo ("email comfirm");
		else
			echo("email not sent");

}

here is the Confirmation Page :

$passkey = $_GET['key'];
$sql1 = "SELECT * FROM temp_db WHERE code='$passkey'";
$result1 = mysql_query($sql1);

if($result1)
{
	// Count how many row has this passkey
	$count = mysql_num_rows($result1);
	
	// if found this passkey in our database, retrieve data from table "temp_members_db"	
	if($count == 1)
	{
		$rows = mysql_fetch_array($result1);
		$a = $rows['fname'];
		$b = $rows['mname'];
		$c = $rows['lname'];
		$d = $rows['dob'];
		$e = $rows['gender'];
		$f = $rows['email'];
		$g = $rows['country'];
		$h = $rows['phno'];
		$i = $rows['mobile'];
		$j = $rows['userid'];
		$k = $rows['password'];
		$l = $rows['mti'];
		$m = = $rows['rtime'];
		
		$sql2 = "INSERT INTO regd_db(fname,mname,lname,dob,gender,email,country,phno,mobile,userid,password,mti,rtime)
				 VALUES('$a','$b','$c','$d','$e','$f','$g','$h','$i','$j','$k','$l','$m')";
		$result2 = mysql_query($sql2);
	}
	// if not found passkey, display message "Wrong Confirmation code"
	else
		echo "Wrong confirmation code";
	// if successfully moved data from table"temp" to table "registered" display"Your account has been activated"
	if($result2)
	{
		echo "You hav Been Activated.. please log in";
		
		$sql3 = "DELETE FROM temp_db WHERE code='$passkey'";
		$result3 = mysql_query($sql3) or die("Cud not delete temp files");
	}
}

On clicking the link in my email, i get a BLANK confirmation page...

wat is the prob.. ?

need help

3
Contributors
8
Replies
9
Views
8 Years
Discussion Span
Last Post by wilch
0

im a newbie php developer...

i've tried sending an email n receiving the confirmation back for activating the users...

here is the email sending code :

if($res)
{
	echo "record added";
	$to = $mail;
	$sub = "Confirm Mail From LeLys";
	$header = "from: admin<support@domain.org>";
	
	$message = "confirm link \r\n";
	$message.= "click to activete your account";
	$message.= "http://www.domain.org/confirmation.php?key=$ccode";
	
	$sending = mail($to,$sub,$message,$header);
	
		if($sending)
			echo ("email comfirm");
		else
			echo("email not sent");

}

here is the Confirmation Page :

$passkey = $_GET['key'];
$sql1 = "SELECT * FROM temp_db WHERE code='$passkey'";
$result1 = mysql_query($sql1);

if($result1)
{
	// Count how many row has this passkey
	$count = mysql_num_rows($result1);
	
	// if found this passkey in our database, retrieve data from table "temp_members_db"	
	if($count == 1)
	{
		$rows = mysql_fetch_array($result1);
		$a = $rows['fname'];
		$b = $rows['mname'];
		$c = $rows['lname'];
		$d = $rows['dob'];
		$e = $rows['gender'];
		$f = $rows['email'];
		$g = $rows['country'];
		$h = $rows['phno'];
		$i = $rows['mobile'];
		$j = $rows['userid'];
		$k = $rows['password'];
		$l = $rows['mti'];
		$m = = $rows['rtime'];
		
		$sql2 = "INSERT INTO regd_db(fname,mname,lname,dob,gender,email,country,phno,mobile,userid,password,mti,rtime)
				 VALUES('$a','$b','$c','$d','$e','$f','$g','$h','$i','$j','$k','$l','$m')";
		$result2 = mysql_query($sql2);
	}
	// if not found passkey, display message "Wrong Confirmation code"
	else
		echo "Wrong confirmation code";
	// if successfully moved data from table"temp" to table "registered" display"Your account has been activated"
	if($result2)
	{
		echo "You hav Been Activated.. please log in";
		
		$sql3 = "DELETE FROM temp_db WHERE code='$passkey'";
		$result3 = mysql_query($sql3) or die("Cud not delete temp files");
	}
}

On clicking the link in my email, i get a BLANK confirmation page...

wat is the prob.. ?

need help

How about putting a else statement here

if($result2)
	{
		echo "You hav Been Activated.. please log in";
		
		$sql3 = "DELETE FROM temp_db WHERE code='$passkey'";
		$result3 = mysql_query($sql3) or die("Cud not delete temp files");
	}else
{
         echo 'problems found';
}

let see if which will it print.

0

hi ivatanako

tried wat u said.. but still no hope..

still getting te same blank page...

0

Usually all output disappears from your browser if you have an error in your code, and error_reporting is set to E_ALL & E_NOTICE in your php.ini file.
In this case, i think your error, is that you are using trying to access array items using associative indices, when your array only has number indices because you used mysql_fetch_array.

Therefore if you use mysql_fetch_array($result1), then access your array items as $rows[0], $rows[1], ...
If you use mysql_fetch_assoc($result1), then access your array items as $rows, $rows, ...

Try that !

0

hey wilch..

i've tried that assoc fetch, but still get the same blank page..

i saw my php.ini file..

error_reporting
; Default Value: E_ALL & ~E_NOTICE
; Development Value: E_ALL | E_STRICT
; Production Value: E_ALL & ~E_DEPRECATED

this is wat i found in it...

does this mean anything related to my prob.. ? coz i dont know..

0

well, then that's not the problem for you, but ofr me - i once experienced it on that part.

Anyway, i think i see where the problem is. Line 26, there's an extra = sign.
Remove it !

0

Dude...

thanks man... its working now...

but... need some tuning help...

You hav Been Activated.. please log in
Cud not insert into regd user

this is the output im getting...

but the database has been updated into regd user....

0

hey Wilch...

thanks... the "=" sign was the prob i think...

i found, why the above posted error was coming...

i stupidly echo'd it...

thanks again.. i myself did not read my code fully,

0

Cool buddy !
Plus the gratitude is even better, if you Add To Their Reputation, the thread they helped you solve.

:)

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.