Jump to content

Code stops running


phpcode

Recommended Posts

<?
mysql_connect ("localhost", "root", "lllllll");
mysql_select_db ("db");


$usernameF = $_POST['usernameF'];
$action = $_POST['action'];

if ($usernameF != "" and $action == "Lost Password") {
$SQLquery = "select name from userslist where instr(email,'$usernameF') > 0 and length(email) = length('$usernameF')";
$result = mysql_query ($SQLquery)
  		or die ("Query failed");
if (mysql_num_rows($result) > 0) {
	for ($n = mysql_num_rows ($result) - 1; $n >=0; $n--) {
		if (!mysql_data_seek ($result, $n)) {
       			printf ("Cannot seek to row %d\n", $n);
       		continue;
       		}
    		if(!($row = mysql_fetch_object ($result)))
		echo "t1";
       			continue;
		}

	$passwordF = strtoupper(substr(ereg_replace("[^A-Z0-9]", "", crypt(time())) .
                         ereg_replace("[^A-Z0-9]", "", crypt(time())) .
                         ereg_replace("[^A-Z0-9]", "", crypt(time())),
                     0, );
	$SQLquery = "update userslist set passwd = '".crypt($passwordF,substr($usernameF,0,2))."' where instr(email,'$usernameF') > 0 and length(email) = length('$usernameF') and name = '$row->name'";
		$result = mysql_query ($SQLquery)
  				or die ("Query2 failed");


	$recipient = $usernameF;
	$subject = "Login Details";
	mail($recipient, "$subject", "Your password has been changed to :- $passwordF", "From: info@nodomainyet.com\nContent-Type: text/html; charset=iso-8859-1\n", "-finfo@nodomainyet.com");
echo "
<script>
location.href='?display=Member%20Password%20Sent&menu=nonmenu';
</script>";

}
}
?>

 

When I run this code it stops but doesn't tell me why. I checked the error log but nothing is there and I have changed the error reporting. Can anyone see whats wrong?

Link to comment
Share on other sites

Make sure following things:

 

1. $usernameF is not empty.

2. print this query and try to run it on sql mode to make sure it is behaving as expected.

3.why

 

<script>

location.href='?display=Member%20Password%20Sent&menu=nonmenu';

</script>"; ?????

 

they to redirect to a correct page after login with header() in php.

 

Thanks

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.