phpcode Posted September 21, 2008 Share Posted September 21, 2008 <? 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: [email protected]\nContent-Type: text/html; charset=iso-8859-1\n", "[email protected]"); 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 https://forums.phpfreaks.com/topic/125142-code-stops-running/ Share on other sites More sharing options...
priti Posted September 21, 2008 Share Posted September 21, 2008 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 https://forums.phpfreaks.com/topic/125142-code-stops-running/#findComment-646930 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.