-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfirmStudent.php
More file actions
64 lines (55 loc) · 1.47 KB
/
confirmStudent.php
File metadata and controls
64 lines (55 loc) · 1.47 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
<html>
<head>
<title>CONFIRM PASSWORD</title>
</head>
<body>
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "demo_form";
$message="";
$result="";
$row="";
$Roll = substr($_SERVER['REQUEST_URI'],-9);
$In_Passcode = "";
$Passcode = "dresqw3";
$Next_url="";
// Create connection
$con = mysqli_connect($servername, $username, $password);
// Check connection
if (!$con) {
$message = "Not connected to server";
}
//echo "Connected successfully";
if(!mysqli_select_db($con,$dbname))
{
$message = "Database not selected";
}
$sql_pass = "SELECT passcode FROM student WHERE roll_number=".$Roll;
if($result = mysqli_query($con,$sql_pass)){
while($row = mysqli_fetch_row($result)){
$Passcode = $row[0];
}
}
if(isset($_POST['submit'])){
$In_Passcode = $_POST["pass"];
echo nl2br("\n\nEntered Passcode is ".$In_Passcode);
if($In_Passcode===$Passcode){
$Next_url = "http://localhost/newedit.php?edit_roll_no=".$Roll;
}
else{
$message = "Wrong Passcode";
$Next_url = "http://".$_SERVER["HTTP_HOST"].$_SERVER["PHP_SELF"]."?edit_roll_no=".$Roll;
}
header("Location: ".$Next_url);
}
?>
<form method="POST" action="" name="confirmForm">
<p>Roll number: <input type="text" name="roll" readonly value="<?php echo $Roll;?>"></input></p>
<p>Enter Passcode : <input type="password" name="pass"></input></p>
<input type="submit" name="submit" value="submit"/>
<?php echo $message?>
</form>
</body>
<html>