Jump to content


Photo

Edit password and email


  • Please log in to reply
4 replies to this topic

#1 whare

whare
  • Members
  • PipPipPip
  • Advanced Member
  • 75 posts

Posted 12 August 2006 - 09:11 PM

Hi All

Yep Im back again to pick your brains lol

right I trying to create a page to edit the users password (that they can use) now i have tried to use

$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";
}

but just keep pulling out errors anyideas guys?

#2 newb

newb
  • Members
  • PipPipPip
  • Advanced Member
  • 454 posts

Posted 12 August 2006 - 09:27 PM

would help if u posted the full code

#3 dual_alliance

dual_alliance
  • Members
  • PipPipPip
  • Advanced Member
  • 140 posts
  • LocationNSW, Australia

Posted 12 August 2006 - 09:28 PM

Why dont you have something like this:

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>";

Its just basic but l hope it gives you the idea

#4 whare

whare
  • Members
  • PipPipPip
  • Advanced Member
  • 75 posts

Posted 12 August 2006 - 09:40 PM

Thanx for that Dual

I 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 :)

#5 whare

whare
  • Members
  • PipPipPip
  • Advanced Member
  • 75 posts

Posted 13 August 2006 - 11:10 AM

Well thde worked with some minor edits lol

have a look

<?
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';
}
?>

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 :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users