/
register.php
61 lines (52 loc) · 1.28 KB
/
register.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
<h1><div align="center">CHECK PLAG</div></h1>
<?php
require 'DB_FUNCTIONS.php';
$db=new DB_FUNCTIONS();
if(isset($_POST['email']) and !empty($_POST['email']) and isset($_POST['password']) and !empty($_POST['password']) and isset($_POST['un']) and !empty($_POST['un']) and isset($_POST['confirmpassword']) and !empty($_POST['confirmpassword']))
{
$email=$_POST['email'];
$password=$_POST['password'];
$un=$_POST['un'];
$confirmpassword=$_POST['confirmpassword'];
if(!filter_var($email,FILTER_VALIDATE_EMAIL))
{
$emailerr="Invalid email";
echo $emailerr;
}
else
{
if(!($password==$confirmpassword))
{
$passworderr="Passwords Don't match";
echo $passworderr;
}
else
{
$a=$db->userExists($email);
if($a==true)
{
echo "email aldready exists";
}
else
{
$db->storeUser($email,$password,$un);
}
}
}
}
else
{
}
?>
<form action="register.php" method="POST">
<strong> ALL FIELDS ARE MANDATORY </strong><br><br>
email<br>
<input type="text" name="email"><br><br>
Username<br>
<input type="text" name="un"><br><br>
Password<br>
<input type="password" name="password"><br><br>
Confirm Password<br>
<input type="password" name="confirmpassword"><br><br>
<input type="submit" name="submit">
</form>