-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverification.php
More file actions
51 lines (32 loc) · 1.11 KB
/
verification.php
File metadata and controls
51 lines (32 loc) · 1.11 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
//Verfication must be in-line with whatever credentaials are entered
<?php
//database initialization.
$db_name = "id1296369_software1";
$db_host = "localhost";
$db_user = "id1296369_rspurl1";
$db_pw = "cosc455";
//Create connection
$conn = new mysqli($db_host, $db_user, $db_pw, $db_name);
//Check connection
if ($conn->connect_errno)
{
echo "Failed to connect to MySQL: (" . $conn->connect_errno . ") " . $conn->connect_error;
} else
{
echo "Database connection successful" . "<br>";
//ensuring button actually sent data to php.
$vCode = $conn->escape_string ($_POST['verification']);
//compares vCode in database vs vCode being entered
$verify = $conn->query ("SELECT vCode FROM Users WHERE vCode = 'vCode' LIMIT 1");
$username = $conn->query ("SELECT Username FROM Users WHERE vCode = 'vCode' LIMIT 1");
if ($vCode == $verify)
{
$conn->query ("UPDATE Users SET Verfied = 1 WHERE Username = '$username' LIMIT 1");
echo "Thank you for registering."
header('Location: login.html');
exit;
}
}
mysqli_close($conn);
//Written by Andrew Welsh
?>