This repository has been archived by the owner on Sep 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
192 lines (183 loc) · 5.22 KB
/
index.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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
<?php
session_start();
$classvalue = 'hidden';
if(isset($_SESSION['error'])){
$classvalue = '';
}
if(isset($_SESSION['loggedin'])){
header("location:users/");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="css/jquery-ui-1.10.4.custom.min.css" />
<script src="js/jquery-1.10.2.js"></script>
<script src="js/jquery-ui-1.10.4.custom.min.js"></script>
<script>
$(function(){
$("#loginform").dialog({
autoOpen:true,
modal:true,
draggable:false,
resizable:false,
title:'Login',
width:420,
close:function(event, ui){
$("#username").val('');
$("#password").val('');
$("#registerform").dialog("open");
}
});
$("#registerform").dialog({
autoOpen:false,
modal:true,
draggable:false,
resizable:false,
title:'Register',
width:550,
close:function(event,ui){
$("#apassword").val('');
$("#cpassword").val('');
$("#fullname").val('');
$("#email").val('');
$("#loginform").dialog("open");
}
});
$("#submit").button( { icons:{ primary:"ui-icon-key" } } )
.click(function(event){
$("#form").submit();
}
);
$("#register").button( { icons:{ primary:"ui-icon-gear" } } )
.click(function(event){
$("#loginform").dialog("close");
$("#registerform").dialog("open");
}
);
$("#registerbutton").button( { icons:{ primary:"ui-icon-pencil" } } )
.click(function(event){
$("#regform").submit();
}
);
});
function submitButton(){
$("#form").submit();
}
function validate(){
var un = $("#username").val();
var pw = $("#password").val();
if( un == "" || un == null ){
$("#username").focus();
return false;
}
if( pw == "" || pw == null ){
$("#password").focus();
return false;
}
return true;
}
function validatereg(){
var fn = $("#fullname").val();
var em = $("#email").val();
var apw = $("#apassword").val();
var cpw = $("#cpassword").val();
if( fn == "" || fn == null ) {
$("#fullname").focus();
return false;
}
if( em == "" || em == null ) {
$("#email").focus();
return false;
}
if( apw == "" || apw == null ) {
$("#apassword").focus();
return false;
}
if( cpw == "" || cpw == null ) {
$("#cpassword").focus();
return false;
}
if( apw != cpw ) {
$("#cpassword").select();
return false;
}
return true;
}
</script>
<style>
body {
font-family: "Trebuchet MS", "Helvetica", "Arial", "Verdana", "sans-serif" !important;
font-size: 80% !important;
border:none !important;
}
.long{
width:300px;
}
.hidden {
display:none !important;
}
</style>
<title>Home</title>
</head>
<body class="ui-state-error">
<div id="loginform">
<form action="login.php" method="POST" id="form" onsubmit="return validate();">
<table align="center">
<tr>
<td>Username</td>
<td><input type="email" placeholder="[email protected]" autofocus="autofocus" name="email" id="username" class="ui-corner-all ui-widget-content long" /></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" placeholder="Password" name="password" id="password" class="ui-corner-all ui-widget-content long" /></td>
</tr>
<tr>
<td colspan="2" align="center">
<span class="ui-state-error ui-state-error-text <?php echo $classvalue; ?>">
<?php if(isset($_SESSION['error'])) echo $_SESSION['error']; unset($_SESSION['error']); ?>
</span>
</td>
</tr>
<tr>
<td colspan="2" align="center">
<button id="submit">Login</button>
<button id="register">Register</button>
</td>
</tr>
</table>
</form>
</div>
<div id="registerform">
<form action="register.php" method="post" id="regform" onsubmit="return validatereg();">
<table align="center">
<tr>
<td>Full Name</td>
<td><input type="text" placeholder="Full Name" name="fullname" id="fullname" class="ui-corner-all ui-widget-content long" /></td>
</tr>
<tr>
<td>E Mail</td>
<td><input type="email" placeholder="E Mail" name="email" id="email" class="ui-corner-all ui-widget-content long" /></td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" placeholder="Password" name="password" id="apassword" class="ui-corner-all ui-widget-content long" /></td>
</tr>
<tr>
<td>Confirm Password</td>
<td><input type="password" placeholder="Retype Password" name="cpassword" id="cpassword" class="ui-corner-all ui-widget-content long" /></td>
</tr>
<tr>
<td align="center" colspan="2" class="ui-state-highlight">Your account needs admin approval.</td>
</tr>
<tr>
<td colspan="2" align="center">
<button id="registerbutton">Register</button>
</td>
</tr>
</table>
</form>
</div>
</body>
</html>