-
Notifications
You must be signed in to change notification settings - Fork 1
/
signup.php
146 lines (126 loc) · 3.88 KB
/
signup.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
<?php session_start();
session_destroy();
if(file_exists("./formatting/header.php")){
include "./formatting/header.php";
}
?>
<style type="text/css">
.buttondiv {
margin-top: 10px;
}
.messagebox{
border:1px solid #c93;
background:#ffc;
padding:3px;
}
.messageboxok{
border:1px solid #349534;
background:#C9FFCA;
padding:3px;
font-weight:bold;
color:#008000;
}
.messageboxerror{
border:1px solid #CC0000;
background:#F7CBCA;
padding:3px;
font-weight:bold;
color:#CC0000;
}
</style>
<body>
<div data-role="page">
<div data-role="header">
<h1>Log in</h1>
<!--<a href="logout.php" data-icon="check" id="logout" class="ui-btn-right">Logout</a>-->
<a href="#" data-rel="back" data-icon="arrow-l" id="logout" data-transition="slide" data-direction="reverse" data-role="button" class="ui-btn-left">Back</a>
</div><!-- /header -->
<div data-role="content">
<script src="jquery/jquery.js" type="text/javascript" language="javascript"></script>
<script language="javascript">
// Developed by Roshan Bhattarai
// Visit http://roshanbh.com.np for this script and more.
// This notice MUST stay intact for legal use
$(document).ready(function()
{
$(".signup_form").submit(function()
{
//remove all the class add the messagebox classes and start fading
$("#msgbox_signup").removeClass().addClass('messagebox').text('Validating....').fadeIn(1000);
//check the username exists or not from ajax
$.post("ajax_signup.php",{ username_signup:$('#username_signup').val(),email:$('#email').val(),firstName:$('#firstName').val(),lastName:$('#lastName').val(),password_signup:$('#password_signup').val(),passwordconfirm:$('#passwordconfirm').val(),rand:Math.random() } ,function(data)
{
if(data=='yes') //if correct login detail
{
$("#msgbox_signup").fadeTo(200,0.1,function() //start fading the messagebox
{
//add message and change the class of the box and start fading
$(this).html('Signing up.....').addClass('messageboxok').fadeTo(900,1,
function()
{
//redirect to secure page
document.location='iAmHungryPage.php';
});
});
}
else
{
$("#msgbox_signup").fadeTo(200,0.1,function() //start fading the messagebox
{
//add message and change the class of the box and start fading
$(this).html(data).addClass('messageboxerror').fadeTo(5,1);
});
}
});
return false; //not to post the form physically
});
//now call the ajax also focus move from
//$("#passwordconfirm").blur(function()
//{
// $(".signup_form").trigger('submit');
//});
});
</script>
<form action="" method="post" class="signup_form">
<label for="bar">First Name:</label>
<input type="text" name="firstName" id="firstName">
<label for="bar">Last Name:</label>
<input type="text" name="lastName" id="lastName">
<label for="bar">Email:</label>
<input type="text" name="email" id="email">
<label for="foo">Username:</label>
<input type="text" name="username" id="username_signup">
<label for="bar">Password:</label>
<input type="password" name="password" id="password_signup">
<label for="bar">Confirm Password:</label>
<input type="password" name="passwordconfirm" id="passwordconfirm">
<div id="info">
<span id="msgbox_signup" style="display:none"></span>
</div>
<input type="submit" id="submitting_signup" value="Sign Up">
</form>
<div data-role="fieldcontain">
</div>
</div><!-- /content -->
<!-- No Footer
<?php include("footer_menu.php") ?>
-->
<!--<script type="text/javascript">
$("#logout").hide();
$("#info").hide();
var retrievedObject = localStorage.getItem('username');
if (retrievedObject == "test") {
$("#form").hide();
$("#logout").show();
$("#info").show();
}
$("#logout").click(function() {
localStorage.removeItem('username');
$("#form").show();
$("#logout").hide();
$("#info").hide();
});
</script>-->
</div><!-- /page -->
</body>
</html>