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
https://forums.phpfreaks.com/topic/17360-edit-password-and-email/
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
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 :)

Archived

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

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