-
Notifications
You must be signed in to change notification settings - Fork 0
/
registration_page.php
163 lines (143 loc) · 3.4 KB
/
registration_page.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
<?php
include 'resource.php';
session_start();
//for form data
$UserId=$_REQUEST['UserId'];
$pwd=$_REQUEST['pwd'];
$Fname=$_REQUEST['FName'];
$Date=$_REQUEST['Date'];
$Month=$_REQUEST['Month'];
$Year=$_REQUEST['Year'];
$ConNum=$_REQUEST['ConNum'];
$add=$_REQUEST['Address'];
$OrigCap=$_REQUEST['OrigCap'];
$UipCap=$_REQUEST['UipCap'];
//business logic
if($_REQUEST['submit'])
{
if($UserId=="" or $pwd=="" or $Fname=="" or $Date=="" or
$Month=="" or $Year=="" or $ConNum=="" or $add=="" or
$UipCap=="")
{
$errorMsg="Fill all req.. fields!";
}
else
{
if($OrigCap!=$UipCap)
{
$errorMsg="You have entered wrong captcha";
}
else
{
if(file_exists("userProfile/$UserId"))
{
//check User Id if already taken by other
$errorMsg="Id not avl...";
}
else
{
//create new profile
mkdir("userProfile/$UserId");
mkdir("userProfile/$UserId/inbox");
mkdir("userProfile/$UserId/sent");
mkdir("userProfile/$UserId/draft");
mkdir("userProfile/$UserId/trash");
mkdir("userProfile/$UserId/labels");
mkdir("userProfile/$UserId/chatRoom");
$details=$Fname."\t".$Date."-".$Month."-".$Year."\t".$ConNum."\t".$add;
file_put_contents("userProfile/$UserId/$pwd",$details);
$_SESSION['UserId'] = $UserId;
$_SESSION['Password'] =$pwd;
header("location: welcomeMsg.php");
}
}
}
}
?>
<html>
<head>
<meta charset="utf-8">
<title>Registration Page</title>
<link href="registration_page.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="wrapper"><!-- page starts-->
<div id="header"><!--header starts-->
<img src="logo.png" alt="" id="logo"/>
<a href="index.php" id="SignInLink">Sign In</a>
</div><!--header ends-->
<p id="text">Create your Google Account</p>
<form id="RegistrationForm" action="#" method="post">
<table id="RegistrationTable">
<tr>
<td id="error"><?php echo $errorMsg; ?></td>
</tr>
<tr>
<td><input type="text" value placeholder="Create User Id"
name="UserId" id="UId"></td>
</tr>
<tr>
<td><input type="password" value placeholder="Create password"
name="pwd" id="UId"></td>
</tr>
<tr>
<td><input type="text" value placeholder="Full Name"
name="FName" id="UId"></td>
</tr>
<tr>
<td>
<select id="date" name="Date">
<option>Date</option>
<?php
for($i=0;$i<$Cdate;$i++)
{
echo "<option>".$date[$i]."</option>";
}
?>
</select>
<select id="month" name="Month">
<option>Month</option>
<?php
for($i=0;$i<$Cmonth;$i++)
{
echo "<option>".$month[$i]."</option>";
}
?>
</select>
<select id="year" name="Year">
<option>Year</option>
<?php
for($i=0;$i<$Cyear;$i++)
{
echo "<option>".$year[$i]."</option>";
}
?>
</select>
</td>
</tr>
<tr>
<td><input type="text" value placeholder="Contact Number"
name="ConNum" id="UId"></td>
</tr>
<tr>
<td><input type="text" value placeholder="Address"
name="Address" id="UId"></td>
</tr>
<tr>
<td><input type="text" value="<?php echo $captcha; ?>" name="OrigCap"
id="UId1" readonly ></td>
</tr>
<tr>
<td><input type="text" value placeholder="Enter captcha code"
name="UipCap" id="UId1"></td>
</tr>
<tr>
<td>
<input type="submit" value="Create Account" name="submit" id="UId2">
</td>
</tr>
</table>
</form>
</div><!--Page ends-->
</body>
</html>