-
Notifications
You must be signed in to change notification settings - Fork 0
/
registerandlogin.php
123 lines (123 loc) · 5.88 KB
/
registerandlogin.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
<?php
if(isset($_SESSION["userid"]))
{
header("Location:index.php");
}
else if(isset($_POST["op"]))
{
if ($_POST["op"] == "login")
{
include("Users/do_login.php");
}
else if ($_POST["op"] == "register")
{
include("Users/do_register.inc.php");
}
exit;
}
include("include/header.php");
?>
<body>
<script>
function check_form() {
password = document.getElementById("reg-pass").value;
password2 = document.getElementById("reg-pass2").value;
mail = document.getElementById("reg-mail").value;
firstname = document.getElementById("reg-firstname").value;
lastname = document.getElementById("reg-lastname").value;
emsg = "";
var pattern = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;
if(!pattern.test(mail)) emsg += "Invalid email address. \n";
if(password == "") emsg += "Please enter your password. \n";
else if(password != password2) emsg += "The passwords you entered do not match. \n";
if(firstname == "") emsg += "Please enter your first name. \n";
if(lastname == "") emsg += "Please enter your last name. \n";
if(emsg != "" ) {
emsg = "------------------------------------------\n\n"+emsg;
emsg = emsg+"\n------------------------------------------";
alert(emsg);
return false;
}else {
return true;
}
}
</script>
<div id="wrap">
<?php include("include/title.php") ?>
<div id="main">
<div id="login">
<h3>Login</h3>
<!-- begin content -->
<form action="registerandlogin.php" method="post" id="user_login">
<div>
<div class="form-item">
<label for="login-mail">Email</label>
<input type="text" maxlength="60" name="login[mail]" id="login-mail" size="30" class="form-text required" />
</div>
<div class="form-item">
<label for="login-pass">Password</label>
<input type="password" maxlength="" name="login[pass]" id="login-pass" size="30" class="form-text required" />
</div>
<input type="submit" name="op" value="login" class="form-submit" />
</div>
</form>
</div>
<!-- begin content -->
<div id="register">
<h3>Register</h3>
<form action="registerandlogin.php" method="post" id="user_register">
<div>
<div class="form-item">
<label for="reg-mail">Email <span class="form-required" title="This field is required.">*</span></label>
<div><input type="text" maxlength="64" name="reg[mail]" id="reg-mail" size="30" value="" class="form-text required" /></div>
</div>
<div class="form-item">
<label for="reg-pass">Password <span class="form-required" title="This field is required.">*</span></label>
<div><input type="password" maxlength="64" name="reg[pass]" id="reg-pass" size="30" value="" class="form-text required" /></div>
</div>
<div class="form-item">
<label for="reg-pass2">Confirm Password <span class="form-required" title="This field is required.">*</span></label>
<div><input type="password" maxlength="64" name="reg[pass2]" id="reg-pass2" size="30" value="" class="form-text required" /></div>
</div>
<div class="form-item">
<label for="reg-title">Title</label>
<div><input type="text" maxlength="20" name="reg[title]" id="reg-title" size="30" value=""/></div>
</div>
<div class="form-item">
<label for="reg-firstname">First Name <span class="form-required" title="This field is required.">*</span></label>
<div><input type="text" maxlength="64" name="reg[first_name]" id="reg-firstname" size="30" value="" class="form-text required" /></div>
</div>
<div class="form-item">
<label for="reg-lastname">Last Name <span class="form-required" title="This field is required.">*</span></label>
<div><input type="text" maxlength="64" name="reg[last_name]" id="reg-lastname" size="30" value="" class="form-text required" /></div>
</div>
<div class="form-item">
<label for="reg-gender">Gender: </label>
<div>
<input type="radio" name="reg[gender]" value="0" checked=checked />Secret
<input type="radio" name="reg[gender]" value="1" />Male
<input type="radio" name="reg[gender]" value="2" />Female
</div>
</div>
<div class="form-item">
<label for="reg-tel">Phone: </label>
<div>
<input type="text" maxlength="64" name="reg[tel]" id="reg-tel" size="30" value="" />
</div>
</div>
<div class="form-item">
<label for="reg-birthday">Birthday: </label>
<div>
<input type="text" maxlength="64" name="reg[birthday]" id="reg-birthday" size="30" value="" />
</div>
</div>
<input type="submit" name="op" value="register" class="form-submit" onClick="return check_form();" />
</div>
</form>
</div>
</div>
<?php include("include/sidebar.php") ?>
<?php include("include/footer.php")?>
</div>
</body>
</html>