Jump to content

Archived

This topic is now archived and is closed to further replies.

whare

Edit password and email

Recommended Posts

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

[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?

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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 :)

Share this post


Link to post
Share on other sites
Well thde worked with some minor edits lol

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

Share this post


Link to post
Share on other sites

×

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.