forked from maxkirchoff/UPGRAYDD
-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.php
92 lines (84 loc) · 2.06 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
require('request.php');
$request = new Request_Thingy();
if (! empty($_COOKIE['username']) && ! empty($_COOKIE['password']))
{
header('Location: index.php');
}
if (isset($_GET['username']) && isset($_GET['password']))
{
try
{
$cred_array = array(
"username" => $_GET['username'],
"password" => $_GET['password']
);
$request->set_credentials($cred_array);
$request->check_credentials();
$username = $_GET['username'];
$password = $_GET['password'];
setcookie("username", $username);
setcookie("password", $password);
header('Location: index.php');
}
catch (Exception $e)
{
$invalid_login = true;
}
}
elseif (isset($_GET['email']))
{
$email_sent = $request->create_account($_GET['email']);
}
?>
<!DOCTYPE HTML>
<html>
<head>
<style>
<!--
#login {
background :red;
padding: 20px;
}
-->
-->
</style>
</head>
<body>
<div id="login">
<h2>You must log in.</h2>
<form action="login.php">
<?php
if (isset($invalid_login))
{
echo "Invalid Login provided. Try again.<br /><br />";
}
?>
Username: <input type="text" name="username"></input><br /><br />
Password: <input type="password" name="password"></input><br /><br />
<input type="submit" value="Login" />
</form>
</div>
<div id="signup">
<h2>Sign up for an account</h2>
<form action="login.php">
<?php
if (isset($email_sent))
{
if ($email_sent)
{
echo "You will recieve your password via email.<br /><br />";
}
else
{
echo "Your account could not be created.<br /><br />";
}
}
?>
Email: <input type="text" name="email"></input><br /><br />
*must be a shopigniter.com email address.
<input type="submit" value="Create Account" />
</form>
</div>
</body>
</html>