Jump to content

cryptonim

New Members
  • Posts

    3
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

cryptonim's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. hello, I want to display the echo ''"; in the right place on my website in changepassword_form.html all messages are written in changepassword.php. how can i move these echo after entering the wrong password or username? changepassword.php <?php ........... //success //change password in db $querychange = mysql_query("UPDATE users SET password='$newpassword' WHERE username='$username'"); session_destroy(); echo 'Password Has Been Changed Successfully !'; //move these } else{ echo('new password doesnt match!'); //move these } } else { die('old password doesnt match!'); //move these } } else { echo ""; include 'changepassword_form.html'; exit(); } } else{ echo 'you must be logged '; } ?> move these echos somewhere to my html code how to do these??
  2. hi folks I have a problem with the code to change the password, it shows the message all time when I send the form: old password dont match! <?php session_start(); $user = $_SESSION['first_name']; if ($user) { //user is logged in if ($_POST['submit']) { //check fields $oldpassword = md5($_POST['oldpassword']); $newpassword = md5($_POST['newpassword']); $repeatnewpassword = md5($_POST['repeatnewpassword']); //check password against db //connect db $connect = mysql_connect("*******","****","****") or die(""); mysql_select_db("****") or die(""); $queryget = mysql_query("SELECT password FROM users WHERE username='$user'") or die("Query didnt work !!!"); $row = mysql_fetch_assoc($queryget); $oldpassworddb = $row['password']; //check password if ($oldpassword==$oldpassworddb) { //check to new password if ($newpassword==$repeatnewpassword) { //success //change password in db $querychange = mysql_query("UPDATE users SET password='$newpassword' WHERE username='$user'") or die (""); session_destroy(); die("YOUR PASSWORD HAS BEEN CHANGED.<a href='login_form.html'>RETURN</a> TO THE LOGIN PAGE"); } else die("new password dont match"); } else die("old password dont match"); } else { echo" <form action='changepassword.php' method='POST'> Old password: <input type='text' name='oldpassword'><br/> New password: <input type='password' name='newpassword'><br/> Repeat new password: <input type='password' name='repeatnewpassword'><br/> <input type='submit' name='submit' value='change password'> </form>"; } } else echo("YOU MUST BE LOGGED IN!!!!.<br><a href='login_form.html'>RETURN</a> TO THE LOGIN PAGE"); ?> please help thx!
  3. hi i have a problem with the code to remind the user's password if their forget, the user enter their email address and get them on the mailbox, everything works, but in a place where it should be the password is blank. Help please here's the code: <? include 'db.php'; // Conver to simple variables switch($_POST['recover']){ default: include 'lost_pw.html'; break; case "recover": recover_pw($_POST['email_address']); break; } function recover_pw($email_address){ if(!$email_address){ echo "You forgot to enter your Email address !!<br />"; include 'lost_pw.html'; exit(); } // quick check to see if record exists $sql_check = mysql_query("SELECT * FROM users WHERE email_address='$email_address'"); $sql_check_num = mysql_num_rows($sql_check); if($sql_check_num == 0){ echo "No records found matching your email address<br />"; include 'lost_pw.html'; exit(); } // Everything looks ok, generate password, update it and send it! $db_password = md5 ($password); $to = "email"; $sql = mysql_query("UPDATE users SET password='$password_md5' WHERE email_address='$email_address'"); $headers = "From: mymail@02.com"; $subject = "Your Password at MyWebsite!"; $message = "Hi $username your username and password is, Username:$username Password:$password http://www.something.com/login_form.html Thanks! The Webmaster This is an automated response, please do not reply!"; mail($email_address, $subject, $message, "From: M@m.com>\nX-Mailer: PHP/" . phpversion()); include 'password.html'; } ?>
×
×
  • 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.