-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsignup.php
146 lines (134 loc) · 7.81 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
include 'includes/scripts.php';
include 'includes/config.php';
include 'includes/classes/Account.php';
include 'includes/classes/Constants.php';
$account = new Account($con);
include 'includes/handlers/register-handler.php';
?>
<?php
// function sanitizeFormInput($inputText)
// {
// $inputText=trim($inputText);
// // $inputText=strip_tags($inputText);
// // $inputText=str_replace(" ","",$inputText);
// return $inputText;
// }
// $userEmail="hi";
// if(isset($_POST['registerBtn']))
// {
// $userEmail=$_POST['InputEmail1'];
// $password1=sanitizeFormInput($_POST['password1']);
// $password2=sanitizeFormInput($_POST['password2']);
// $profileName= sanitizeFormInput($_POST['profileName']);
// $contactNo=sanitizeFormInput($_POST['contactNo']);
// $date=sanitizeFormInput($_POST['dobDate']);
// $month=sanitizeFormInput($_POST['dobMonth']);
// $year=sanitizeFormInput($_POST['dobYear']);
// $tnc=isset($_POST['tnc']);
// echo $userEmail;
// }
function rememberInput($name)
{
if (isset($_POST[$name])) {
echo $_POST[$name];
}
}
?>
<html>
<head>
<title> Sign up </title>
<link rel='stylesheet' href="assets/styles/signup.css" >
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
<div class="background1">
<div class="background2">
<div class="row background4">
<div class="col-12 col-md-6 background3">
<img src="assets/images/signup/signup.gif" class="img-fluid d-block w-100 si-img">
</div>
<div class="col-12 col-md-6 px-5 py-5 form-col">
<div class="row pb-4">
<h1 class="si-title"> Sign up </h1>
</div>
<form method="POST" action="signup.php" class="signup-form" autocomplete="off">
<div class="form-group">
<label for="InputEmail1">What's your email?</label>
<input type="email" class="form-control si-in" id="InputEmail1" name="InputEmail1" aria-describedby="emailHelp" value="<?php rememberInput('InputEmail1');?>" required>
<?php echo $account->getError(Constants::$invalidEmail); ?>
<?php echo $account->getError(Constants::$emailAlreadyRegistered); ?>
<small id="emailHelp" class="form-text text-muted">We'll never share your email with anyone else.</small>
</div>
<div class="form-group">
<label for="password1">Create a password: </label>
<input type="password" class="form-control si-in" id="password1" name="password1" aria-describedby="passwordHelp" required>
<?php echo $account->getError(Constants::$invalidCreatePassword); ?>
<small id="passwordHelp" class="form-text text-muted">The password should contain:
<ul>
<li>8-20 Characters</li>
<li>Atleast one Uppercase </li>
<li>Atleast one number </li>
<li>Atleast one special character </li>
</ul>
</small>
</div>
<div class="form-group">
<label for="password2">Confirm password: </label>
<input type="password" class="form-control si-in" id="password2" name="password2" required>
<?php echo $account->getError(Constants::$passwordsNoMatch); ?>
</div>
<div class="form-group">
<label for="profileName">What should we call you? </label>
<input type="text" class="form-control si-in" id="profileName" name="profileName" value="<?php rememberInput('profileName');?>" required>
<?php echo $account->getError(Constants::$invalidProfName); ?>
</div>
<div class="form-group">
<label for="contactNo">What is your contact number? </label>
<input type="text" class="form-control si-in" id="contactNo" name="contactNo" value="<?php rememberInput('contactNo');?>" required>
<?php echo $account->getError(Constants::$contactLengthWrong); ?>
<?php echo $account->getError(Constants::$contactStartWrong); ?>
</div>
<div class="form-group">
<label for="dob">What is your date of birth? </label>
<div class="row">
<input type="text" class="form-control col-md-3 si-in" id="date" name="dobDate" placeholder="Date" value="<?php rememberInput('dobDate');?>" required>
<select id="month" name="dobMonth" class="form-control si-in col-md-3 mx-3" id="month" required>
<option value="">Month</option>
<option value="01">January</option>
<option value="02">February</option>
<option value="03">March</option>
<option value="04">April</option>
<option value="05">May</option>
<option value="06">June</option>
<option value="07">July</option>
<option value="08">August</option>
<option value="09">September</option>
<option value="10">October</option>
<option value="11">November</option>
<option value="12">December</option>
</select>
<input type="text" class="form-control si-in col-md-3" name="dobYear" id="year" placeholder="Year" value="<?php rememberInput('dobYear');?>" required>
</div>
<?php echo $account->getError(Constants::$invalidDOBYear); ?>
<?php echo $account->getError(Constants::$invalidDOBMonth); ?>
<?php echo $account->getError(Constants::$invalidDOBDate); ?>
</div>
<div class="form-check form-group">
<input class="form-check-input" type="checkbox" name='tnc'>
<label class="form-check-label">Accept our terms and conditions</label>
<?php echo $account->getError(Constants::$AcceptTnC); ?>
</div>
<div class="form-group">
<button type="submit" name="registerBtn" class="btn si-btn" title="Sign up"> SIGN UP </button>
</div>
<div class="form-group si-alt">
Already have an account? <a href="signin.php">Sign in here. </a>
</div>
</form>
</div>
</div>
</div>
</div>
</body>
</html>