-
Notifications
You must be signed in to change notification settings - Fork 61
/
Copy pathforgotusername.php
44 lines (40 loc) · 1.62 KB
/
forgotusername.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();
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] == true) {
header('location: /index.php');
die();
}
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$username = $_POST['username'];
include('includes/db_connect.php');
$ret = pg_query($db, "select * from users where username='".$username."';");
if (pg_num_rows($ret) === 1) {
$success = true;
} else {
$error = true;
}
}
?>
<html>
<head>
<title>TUDO/Forgot Username</title>
<link rel="stylesheet" href="style/style.css">
</head>
<body>
<?php include('includes/header.php'); ?>
<div id="content">
<form class="center_form" action="forgotusername.php" method="POST">
<h1>Forgot Username:</h1>
<p>Forgetting your username can be very frustrating. Unfortunately, we can't just list all the accounts out for everyone
to see. What we can do is let you look up your username guesses and we will check if they are in the system. Hopefully it
won't take you too long :(</p>
<input name="username" placeholder="Username"><br><br>
<input type="submit" value="Send Reset Token">
<?php if (isset($error)){echo "<span style='color:red'>User doesn't exist.</span>";}
else if (isset($success)){echo "<span style='color:green'>User exists!</span>";} ?>
<br><br>
<?php include('includes/login_footer.php'); ?>
</form>
</div>
</body>
</html>