-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpass.php
More file actions
128 lines (104 loc) · 2.49 KB
/
pass.php
File metadata and controls
128 lines (104 loc) · 2.49 KB
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<?php
session_start();
?>
<!DOCTYPE html>
<html>
<head>
<title>
PEOPLE SEARCH
</title>
<link href="main.css" rel="stylesheet" type="text/css">
</head>
<body>
<img style="margin-left:40%" src="./images/index.jpeg" width="220px" height="220px">
<br>
<fieldset>
<legend>SIGN IN </legend>
<form action="<?php echo $_SERVER["PHP_SELF"];?>" name="myform" method="post" onsubmit="checking()">
<table>
<tr>
<td>
Current Password
</td>
<td>
<input type="password" placeholder="username" name="user" required >
</td>
</tr>
<tr>
<td>
New Password:
</td>
<td>
<input type="password" placeholder="password" name="pass" required>
</td>
<td>
</td>
</tr>
<tr>
<td>
Confirm Password:
</td>
<td>
<input type="password" placeholder="password" name="confirm" required>
</td>
</tr>
<tr>
<td>
<input type="submit" value="login" onsubmit="checking()">
</td>
</tr>
</table>
</form>
<body>
<script>
var c= 0, d= 0, e= 0, f= 0, g= 0, h= 0, i= 0;
function validate_form(){
console.log("hello");
var name = document.forms["myform"]["user"].value;
var pass = document.forms["myform"]["pass"].value;
// var email = document.forms["myform"]["email"].value;
var pass1 = document.forms["myform"]["confirm"].value;
}
if(pass.length<7){
document.getElementById('error_password').innerHTML="*Please enter a password of length more than 7";
d++;
}
else{
document.getElementById('error_password').innerHTML="";
d = 0;
}
</script>
<?php
include("config.php");
if(isset($_SESSION["username"])){
$ipass=md5($_POST['user']);
$pass=md5($_POST['pass']);
$cpass=md5($_POST['confirm']);
$sql = "SELECT password FROM shivansh_people where username= '".$_SESSION["username"]."';";
$result=$con->query($sql);
if($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
if(strlen($_POST['pass'])>7){
if($ipass==$row["password"])
{
if($pass==$cpass)
{
$sql1="update shivansh_people set password= '".$pass."' where username = '".$_SESSION["username"]."';";
$result1=$con->query($sql1);
echo "updated pass word";
header("location:./profile.php");
}
echo "wrong match";
}
echo "dont mess with it";
}echo "please enter new password of length more than 7";
}
}}
else
{
echo "you are logged out";
//echo "<form action='index.php'> <input type='submit' value='login in'></form> ";
}
?>
</html>