The14thGOD Posted August 2, 2007 Share Posted August 2, 2007 I have this code on other sites and when I put it on another site it doesnt work. I changed everything to adjust so the variables work. Here's the code: <?php if ($_GET['task'] == 'send') { $error = 'true'; include("includes/include_connect_db.php"); $query = "SELECT * FROM user WHERE personal_email='$email' "; if (mysql_query($query)) { $error = 'false'; include("includes/include_random_gen.php"); $new_pw = get_rand_id(7); $newpassword = md5($new_pw); $query = "UPDATE user SET password='$newpassword' WHERE personal_email='$email' "; if (mysql_query($query)) { //do this mail("$email" , "Password Reset for: site.com" , $body, "From: me@email.com \r\n"); } }else{ $error = 'true'; } } if (mysql_error()) { echo (mysql_error()); } ?> Now it gets all the way to the point of emailing...and i recieve an email but the password doesnt reset...anyone see what im missing o.O? ***edit*** so i just found out my first query isn't working right, ive been puttin in a wrong email and it still goes through everything... Quote Link to comment https://forums.phpfreaks.com/topic/62959-change-passwordnot-working-oo/ Share on other sites More sharing options...
dbillings Posted August 2, 2007 Share Posted August 2, 2007 Check your mysql database to see if the following tables are named correctly. user password personal_email Quote Link to comment https://forums.phpfreaks.com/topic/62959-change-passwordnot-working-oo/#findComment-313504 Share on other sites More sharing options...
The14thGOD Posted August 2, 2007 Author Share Posted August 2, 2007 ya they are all named correctly Quote Link to comment https://forums.phpfreaks.com/topic/62959-change-passwordnot-working-oo/#findComment-313509 Share on other sites More sharing options...
The14thGOD Posted August 2, 2007 Author Share Posted August 2, 2007 ok, so the code works except for the first line of the query: <?php include("includes/include_connect_db.php"); $query = "SELECT * FROM user WHERE personal_email='$email' "; if (mysql_query($query)) {?> so basically...it's getting into that if statement even if the email entered is not in the database... Quote Link to comment https://forums.phpfreaks.com/topic/62959-change-passwordnot-working-oo/#findComment-313515 Share on other sites More sharing options...
teng84 Posted August 2, 2007 Share Posted August 2, 2007 heres what you can do first do this $query = "SELECT * FROM user WHERE personal_email='$email' "; print_r(mysql_fetch_array(mysql_query($query))); that will show you why because maybe if the everything is good and maybe the $email is empty and maybe that matches in your db Quote Link to comment https://forums.phpfreaks.com/topic/62959-change-passwordnot-working-oo/#findComment-313521 Share on other sites More sharing options...
The14thGOD Posted August 2, 2007 Author Share Posted August 2, 2007 nothing shows up... Quote Link to comment https://forums.phpfreaks.com/topic/62959-change-passwordnot-working-oo/#findComment-313541 Share on other sites More sharing options...
teng84 Posted August 2, 2007 Share Posted August 2, 2007 there should be if the query failed it should show an error but in succes but no value retrieve it will show like array() now maybe you have to put it out side the if ($_GET['task'] == 'send') { maybe this is not satasfied Quote Link to comment https://forums.phpfreaks.com/topic/62959-change-passwordnot-working-oo/#findComment-313543 Share on other sites More sharing options...
The14thGOD Posted August 2, 2007 Author Share Posted August 2, 2007 ill try to figure it out later, i have some other stuff to do, maybe with fresh eyes ill figure it out, thanks for your help Quote Link to comment https://forums.phpfreaks.com/topic/62959-change-passwordnot-working-oo/#findComment-313548 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.