-
Notifications
You must be signed in to change notification settings - Fork 1
/
chgpas.php
44 lines (39 loc) · 901 Bytes
/
chgpas.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
39
40
41
42
43
44
<?php
session_start();
$chgp=$_POST['chgp'];
$chgcp=$_POST['chgcp'];
$usernaa=$_SESSION['userna'] ;
if(!empty($chgp) && !empty($chgcp)){
$host="localhost";
$dbname="id7285592_kugesh";
$use="id7285592_root";
$pas="11111";
$conn=new mysqli($host,$use,$pas,$dbname);
if(mysqli_connect_error())
{
die('connect error ('.mysqli_connect_error().')');
}
else{
if($chgp!=$chgcp){
echo "Password Mismatch";
}
else{
$select2="DELETE FROM reg WHERE user='".$usernaa."'";
$ins = "INSERT INTO reg(pass,user) values('$chgp','$usernaa')";
$res2=$conn->query($select2);
$res=$conn->query($ins);
//$row = $res->fetch_assoc();
if($res){
echo "Successfully Changed";
}
else{
echo "Failed";
}
$conn->close();
}
}
}
else{
echo "enter Valid Data";
}
?>