Jump to content

mohit587

Members
  • Posts

    12
  • Joined

  • Last visited

    Never

Everything posted by mohit587

  1. Thank you Drummin you are a real programmer may god bless u with gr8 life ....u saved my life hehe i cant thank u enough man ..there were some probs here which were very minor n i fixed it myself hehe n it worked like a charm ;D once again drummin thank u man . $sql="SELECT id password FROM user WHERE username='$user' and password='$oldpass'"; $sql=mysql_query("UPDATE user SET password='$pass2' where id='{$row[0]}' username=''$user");
  2. With ur all kind support i ve fixed the code nw everythins workin fine just one error so i m attachin the pic of the error so plz help me fix that error......my new code is: <?php include "connection.php"; session_start(); $msg=""; if (isset($_POST["username"]) && isset($_POST["oldpass"]) && isset($_POST["pass1"]) && isset($_POST["pass2"]) ){ if($_POST["username"]==""){ $msg = "empty uname <br/>"; } if($_POST["oldpass"]==""){ $msg = "empty oldy <br/>"; } if($_POST["pass1"]==""){ $msg=" empty pass1 <br/>"; } if($_POST["pass2"]==""){ $msg =" empty pass2 <br/>"; }} if($_SERVER['REQUEST_METHOD']=='POST' && !empty($_POST['username']) || !empty($_POST['oldpass']) || !empty($_POST['pass1']) || !empty($_POST['pass2']) ) { $user = $_POST['username']; $oldpass=$_POST['oldpass']; $pass1 = $_POST['pass1']; $pass2 = $_POST['pass2']; //if($pass1=="" || $pass2=="" || $user=="" || $oldpass) { $msg='Empty fields not allowed ' ;} if($pass1 != $pass2) { $msg = "Passwords do not match"; } $result= mysql_query("SELECT password FROM user WHERE username='$user' and password='$oldpass'"); mysql_num_rows($result); if(!$result) { $msg="The Username You Entered Does not Exist"; } if(!$oldpass = mysql_result($result,0)) { echo $msg="You Entered An Incorrect Password"; } elseif($pass1==$pass2) $sql=mysql_query("update user set password='$pass2' where username ='$user'"); if($sql) { echo "Congrats you have successfully changed your password."; } header('refresh:300 databases.php');} ?> <html> <head></head> <body> <div><?php echo $msg; ?> <form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>"> Username:<input type="text" name="username"/> Old password:<input type="password" name="oldpass"/><br/> New password:<input type="password" name="pass1"/><br/> Confirm New password: <input type="password" name="pass2"/><br/> <input class="cpassbtn" name="Submit" type="image" value="Submit" src="passnrm.png" onmouseover="this.src='passhvr.png'" onmouseout="this.src='passnrm.png'"> </form> </div> </body> </html>
  3. yes this is the last script which is workin fine and updating passwords but the prob in this is that : 1. its not showing any validations . 2. when i enter only one new password ...even then also it changes the pass 3 when i enter only username and old pass and leave the new pass and retype fields blank even then also it changes the pass to blank and says congrats pass has been changed. <?php include "connection.php"; session_start(); $msg=""; $user=$_POST['username']; $pass=$_POST['password']; $newpass=$_POST['newpass']; $confirmpass=$_POST['newpassconfirm']; $result=mysql_query("SELECT password FROM user WHERE username='$user'"); if(!$result) { $msg="The Username You Entered Does not Exist"; } elseif($pass!= mysql_result($result,0)) { echo $msg="You Entered An Incorrect Password"; } if($newpass==$confirmpass) $sql=mysql_query("update user set password='$newpass' where username ='$user'"); if($sql) { echo "Congrats you have successfully changed your password."; } header('refresh:3 databases.php'); ?>
  4. yes sir my current code is: <?php session_start(); include "connection.php"; //include_once('header1.php'); $msg=""; if($_SERVER['REQUEST_METHOD']=='POST' && empty($_POST['username']) || empty($_POST['password']) || empty($_POST['newpass']) || empty($_POST['newpassconfirm']) ) { $msg="empty fields"; } { $user=$_POST['username']; $pass=$_POST['password']; $newpass=$_POST['newpass']; $confirmpass=$_POST['newpassconfirm']; $result=mysql_query("SELECT password FROM user WHERE username='$user'"); if(!$result) { $msg="The Username You Entered Does not Exist"; } elseif($pass!= mysql_result($result,0)) { echo $msg="You Entered An Incorrect Password"; } if($newpass != $confirmpass) { $msg = "Passwords do not match"; } elseif($newpass==$confirmpass) $sql=mysql_query("update user set password='$newpass' where username ='$user'"); if($sql) { echo "Congrats you have successfully changed your password."; } header('refresh:3 databases.php'); } ?> <html> <body> <?php echo $msg ; ?> <form class="changepass" action="changepass.php" method="POST"><P> <table><tr><td> Enter ur username :</td> <td> <input type="text" name="username" /></td></tr> <tr><td>Enter ur existing pass : </td><td><input type="password" name="password" /></td></tr> <tr><td>Enter ur new pass :</td> <td><input type="password" name="newpass" /></td></tr> <tr><td>Renter ur new pass :</td> <td><input type="password" name="newpassconfirm" /></td></tr> <tr><td><input class="cpassbtn" name="Submit" type="image" value="Submit" src="passnrm.png" onmouseover="this.src='passhvr.png'" onmouseout="this.src='passnrm.png'"></td></tr> </table> </form> </body> </html> Hopin some help frm ur side
  5. Sir m a beginner in php so m unable to follow up with ur suggestions..... so i request u to please help me by editing my code.... as wen utold me to use mysql_num_rows which i dunno hw to use can u please fix my code n tell me how t use it , i wud really appreciate it
  6. Is der no programmer left on this forum who can help me out
  7. I m really new to php david can u plz implement the changes in my code as i dunno hw to use mysql_fetch_ array ???? :-\
  8. Thank u NLT sir it did as u said nt still not wrkin and i myself did some tweakin wit the code and now my code is : <?php include "connection.php"; session_start(); $msg=""; if($_SERVER['REQUEST_METHOD']=='POST' && !empty($_POST['username']) || !empty($_POST['oldpass']) || !empty($_POST['pass1']) || !empty($_POST['pass2']) ) { $user = trim($_POST['username']); $oldpass=trim($_POST['oldpass']); $pass1 = trim($_POST['pass1']); $pass2 = trim($_POST['pass2']); if($pass1 != $pass2) { $msg = "Passwords do not match"; } elseif($pass1=="" || $pass2=="" || $user=="" || $oldpass) { $msg='Empty fields not allowed ' ;} $result=mysql_query("SELECT password FROM user WHERE username='$user'"); if(!$result) { $msg="The Username You Entered Does not Exist"; } if(!$pass1= mysql_result($result,0)) { echo $msg="You Entered An Incorrect Password"; } elseif($pass1==$pass2) $sql=mysql_query("update user set password='$pass1' where username ='$user'"); if($sql) { echo "Congrats you have successfully changed your password."; } header('refresh:300 databases.php');} ?> <html> <head></head> <body> <div><?php echo $msg; ?> <form method="POST" action="<?php echo $_SERVER['PHP_SELF']; ?>"> Username:<input type="text" name="username"/> Old password:<input type="password" name="oldpass"/><br/> New password:<input type="password" name="pass1"/><br/> Confirm New password: <input type="password" name="pass2"/><br/> <input class="cpassbtn" name="Submit" type="image" value="Submit" src="passnrm.png" onmouseover="this.src='passhvr.png'" onmouseout="this.src='passnrm.png'"> </form> </div> </body> </html> The prob is that it doesnt change password even after filling all the fields correctly it says empty fields nt allowed and if i change invalid username its nt showing the correct validation rather it shows all the validations that incorrect pass, congratulations pass changed etc etc????? why this can u please help its nt workin
  9. I ve numerous issues??? as m a beginner to php, its just a small bug with codin so if u cant help in solving such a small prob den wot this forum is for ??????
  10. Ok sir i ll keep in mind abt these tags in future as m new to this forum . Its not working as : Validations are nt working properly, passwords even gets changed without even putting confirm password ..kindly help me with this script it ll be very helpfull to me as m new to php .
  11. Hello ever1 , I ve created a php password change script with validation but its nt working properly can any1 plz help me with this as m new with php???? below m pasting the code : <?php session_start(); include "connection.php"; //include_once('header1.php'); $msg=""; if($_SERVER['REQUEST_METHOD']=='POST' && empty($_POST['username']) || empty($_POST['password']) || empty($_POST['newpass']) || empty($_POST['newpassconfirm']) ) { $msg="empty fields"; } { $user=$_POST['username']; $pass=$_POST['password']; $newpass=$_POST['newpass']; $confirmpass=$_POST['newpassconfirm']; $result=mysql_query("SELECT password FROM user WHERE username='$user'"); if(!$result) { $msg="The Username You Entered Does not Exist"; } elseif($pass!= mysql_result($result,0)) { echo $msg="You Entered An Incorrect Password"; } if($newpass != $confirmpass) { $msg = "Passwords do not match"; } elseif($newpass=$confirmpass) $sql=mysql_query("update user set password='$newpass' where username ='$user'"); if($sql) { echo "Congrats you have successfully changed your password."; } header('refresh:3 databases.php'); } { ?> <html> <body> <?php echo $msg ; ?> <form class="changepass" action="changepass.php" method="POST"><P> <table><tr><td> Enter ur username :</td> <td> <input type="text" name="username" /></td></tr> <tr><td>Enter ur existing pass : </td><td><input type="password" name="password" /></td></tr> <tr><td>Enter ur new pass :</td> <td><input type="password" name="newpass" /></td></tr> <tr><td>Renter ur new pass :</td> <td><input type="password" name="newpassconfirm" /></td></tr> <tr><td><input class="cpassbtn" name="Submit" type="image" value="Submit" src="passnrm.png" onmouseover="this.src='passhvr.png'" onmouseout="this.src='passnrm.png'"></td></tr> </table> </form> </body> </html> <?php }?>
×
×
  • 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.