forked from pinico42/revi.se
-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.php
63 lines (53 loc) · 1.47 KB
/
login.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
// Copyright © 2014 Max Penrose
?>
<?php
include 'private/pwds.php';
if(isset($_POST['email']) && isset($_POST['pwd'])){
$email = $_POST['email'];
$pwd = $_POST['pwd'];
$conn = mysqli_connect('localhost',$mysqlUsername,$mysqlPassword, 'revise');
$request = "SELECT * FROM accounts WHERE email = '".$email."' AND pwd = '".sha1($pwd,FALSE)."';";
$query = mysqli_query($conn, $request);
$nameArray = mysqli_fetch_array($query, MYSQLI_ASSOC);
if(!is_null($nameArray)){
setcookie("email", $email, time()+259200);
setcookie("pwd", sha1($pwd), time()+259200);
header('Location: index.php');
}
}
?>
<?php
include "layouts.php";
$l = getLayout("basic.layout");
$l->writeHeader();
?>
<h1>Welcome to YouRevise!</h1>
<table id='loginsignup' cellspacing="0" cellpadding="9px">
<tbody>
<tr>
<td>Login</td>
<td>Sign Up</td>
</tr>
<tr>
<td>
<form method='POST' action='#'>
<input type='text' name='email' placeholder='E-mail'><br/>
<input type='password' name='pwd' placeholder='Password'><br/>
<input type='submit' value='Log In'>
</form>
</td>
<td>
<form method='POST' action='signup.php'>
<input type='text' name='fname' placeholder='First Name' class='halfwidth'>
<input type='text' name='sname' placeholder='Surname' class='halfwidth'><br/>
<input type='text' name='email' placeholder='E-mail'><br/>
<input type='submit' value='Sign Up'>
</form>
</td>
</tr>
</tbody>
</table>
<?php
$l->writeFooter();
?>