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

Recommended Answers

All 8 Replies

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.

hi ivatanako

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

still getting te same blank page...

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 !

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..

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 !

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....

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,

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

:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.