-
Notifications
You must be signed in to change notification settings - Fork 0
/
newpassworddb.php
38 lines (31 loc) · 922 Bytes
/
newpassworddb.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<?php
if(isset($_POST['submit']))
{
$email= $_POST['email'];
$password= $_POST['password'];
$password = md5($password);
$ip = $_SERVER['REMOTE_ADDR'];
$conn = mysqli_connect("localhost","root","","shop_db1");
$query1 = "select * from users where email='$email'";
$record1 =mysqli_query($conn,$query1);
$userdata = mysqli_fetch_array ($record1);
$username = $userdata ['name'];
$token = $userdata ['token'];
$query = "update users set password='$password' where token='$token'";
$record =mysqli_query($conn,$query);
if($record == true)
{
echo "password change";
include "login.php";
}
else
{
echo "Password does not change";
}
mysqli_close($conn);
}
else
{
header("Location: ./login.php");
}
?>