whare Posted August 12, 2006 Share Posted August 12, 2006 Hi AllYep Im back again to pick your brains lolright I trying to create a page to edit the users password (that they can use) now i have tried to use [code]$sql = mysql_query("SELECT * FROM pilot WHERE email='$email' and fullname='$_SESSION['fullname']"); if($_SESSION['fullname'] != $row['fullname']){ echo "There has been a problem loading this page please try logging in again<br />"; include 'login.php';if($email == $row['email'] AND $newemal == $newemailc){ $sql = mysql_qurey("UPDATE pilot SET email='$newemail' WHERE fullname='$_SESSION['fullname']"); echo "Your email has been changed";}[/code]but just keep pulling out errors anyideas guys? Link to comment https://forums.phpfreaks.com/topic/17360-edit-password-and-email/ Share on other sites More sharing options...
newb Posted August 12, 2006 Share Posted August 12, 2006 would help if u posted the full code Link to comment https://forums.phpfreaks.com/topic/17360-edit-password-and-email/#findComment-73838 Share on other sites More sharing options...
dual_alliance Posted August 12, 2006 Share Posted August 12, 2006 Why dont you have something like this:[code=php:0]if(isset($_POST['submit1'])) { // Convert the data into variables. $oldPasswordf = $_POST['password1']; $newPassword = $_POST['password2']; $cNewPassword = $_POST['password3']; $idg = $_SESSION['userid']; //Add new password to MySQL Database $query = "UPDATE `users` SET `password` = MD5( '$cNewPassword' ) WHERE `userid` = $idg LIMIT 1 "; mysql_query($query) or die('Error : ' . mysql_error() ); echo "<b>Password updated!</b>";[/code]Its just basic but l hope it gives you the idea Link to comment https://forums.phpfreaks.com/topic/17360-edit-password-and-email/#findComment-73839 Share on other sites More sharing options...
whare Posted August 12, 2006 Author Share Posted August 12, 2006 Thanx for that DualI will give that a go and let you no if I got the hang of it lol its hard work creating and editing code when you only been doing php for a few weeks lol but im getting there and at least I tried to create the code I needed lol :) Link to comment https://forums.phpfreaks.com/topic/17360-edit-password-and-email/#findComment-73845 Share on other sites More sharing options...
whare Posted August 13, 2006 Author Share Posted August 13, 2006 Well thde worked with some minor edits lolhave a look[code]<?session_start();include 'config.php';$oldPasswordf = $_POST['password1'];$newPassword = $_POST['password2'];$cNewPassword = $_POST['password3'];$idg = $_SESSION['userid']; if($newPassword == $cNewPassword){ $query = "UPDATE `pilot` SET `password` = MD5( '$cNewPassword' ) WHERE `userid` = $idg LIMIT 1"; mysql_query($query) or die('Error : ' . mysql_error() ); echo "<b>Password updated!</b>";} else { echo "Your passwords did not match! <br />Please try again"; include 'pchange.php';}?>[/code]Big Thank you to Dual for that code just need to edit it alittle for the email then I will be done on that part of the code so I can start on the rest :) Link to comment https://forums.phpfreaks.com/topic/17360-edit-password-and-email/#findComment-74045 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.