Jump to content

Edit password and email


whare

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.