-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlog.php
84 lines (69 loc) · 1.7 KB
/
log.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
<!DOCTYPE html>
<html>
<head>
<title>Profile Page</title>
</head>
<body>
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST")
{
$emails = $_POST["emails"];
echo $emails;
}
echo '<form name="myForm" method="post" action="login.php" enctype="multipart/form-data">
<input type="email" id="emails" name="emails" value='.$emails.' readonly><br>
Username<input type="text" name="username" id="username"><br>
Phone Number<input type="text" id="phone" name="phone"><br>
Gender<br>
<input type="radio" id="male" name="gender" value="male">Male
<input type="radio" id="female" name="gender" value="female">Female
<input type="radio" id="other" name="gender" value="other">Other
<br>
First name<input type="text" name="firstname" id="firstname">
<br>
Last name<input type="text" name="lastname" id="lastname">
<br>
Profile picture<input type="file" name="fileToUpload" id="fileToUpload"><br>
<input type="submit" value="Sign up" onclick = "validateform()">
</form>
<script>
function validateform(form)
{
var user = document.getElementById("username").value;
if(user=="")
{
alert("Username must be filled out");
return false;
}
var regex = /(\+91)*(\-)*[6-9]{1}[0-9]{9}$/;
var phone = document.getElementById("phone").value;
if(regex.test(phone)==false)
{
alert("Invalid phone number");
return false;
}
var regex1 = /[A-Za-z0-9]*$/;
if(regex1.test(user)==false)
{
alert("Invalid username");
return false;
}
var regex2 = /[A-Z][a-z]+/;
var first = document.getElementById("firstname");
var last = document.getElementById("lastname");
if(regex2.test(first)==false)
{
alert("Invalid firstname");
return false;
}
if(regex2.test(last)==false)
{
alert("Invalid second name");
return false;
}
return true;
}
</script>'
?>
</body>
</html>