-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathchangepcode2.php
More file actions
36 lines (32 loc) · 908 Bytes
/
Copy pathchangepcode2.php
File metadata and controls
36 lines (32 loc) · 908 Bytes
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
<?php
session_start();
if(isset($_POST['confirmpasscode']) && $_POST['confirmpasscode'] <> '')
{
include('dbcon.php');
$matric = $_SESSION['stid'];
$pwd = $_POST['passcode'];
$cpwd = $_POST['confirmpasscode'];
$opwd = $_POST['opasscode'];
if($pwd <> $cpwd)
{
$message = "<br /> Passcode and Comfirm Passcode do not match please try again.";
}
else
{
$opwd = sha1($opwd);
$pwd = sha1($pwd);
$login = mysqli_query($con,"select * from student_table where student_id = ".$matric." and password = '".$opwd."'");
while($log = mysqli_fetch_array($login))
{
$flag = true;
mysqli_query($con,"update student_table set password = '".$pwd."' where student_id = ".$matric);
$message = "Your passcode has been changed successfully!";
}
if(!$flag)
{
$message = "<br /> Incorrect old passcode";
}
}
}
include('changepcode.php');
?>