-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprofile.php
executable file
·87 lines (76 loc) · 2.3 KB
/
profile.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
<?php
include 'dbconnect.php';
session_start();
if(isset($_SESSION['username'])){
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.css"/>
<link rel="stylesheet" type="text/css" href="registration.css">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>User Profile</title>
</head>
<body>
<h1>You have Successfully Registered. However in order to login and access all features you need to fill and submit your profile</h1>
<div class="box">
<div class="field">
<h1><label>Profile Information</label></h1><br>
</div>
<div>
<form action="profile_verify.php" onsubmit="return check()" method="POST" enctype="multipart/form-data">
<div >
<div class="field">
<label>First Name</label><br>
<input type="text" name="first_name" placeholder="First Name" id="first_name" required><label id="error_first" style="visibility:hidden;" >Only Alphabets Allowed</label>
</div>
<div class="field">
<label>Last Name</label><br>
<input type="text" name="last_name" placeholder="Last Name" id="last_name" required><label id="error_last" style="visibility:hidden;">Only Alphabets Allowed</label>
</div>
<br>
<div class="field">
<label for="photo" >Profile Picture </label><br>
<input type="file" id="photo" name="avatar" required style="border:0px">
</div>
<br>
<button type="submit" name="update">Submit</button>
<?php
if(isset($_SESSION['message'])){
echo $_SESSION['message'];
unset($_SESSION['message']);
}
?>
</div>
</form>
</div>
</div>
<script>
function check(){
var first="/^[A-Za-z]{1,}$/";
var last="/^[A-Za-z]{1,}$/";
var first_name=document.getElementById("first_name").value;
var last_name=document.getElementById("last_name").value
if(first.test(first_name)){
document.getElementById("error_first").style.visibility="hidden"
}
else{
document.getElementById("error_first").style.visibility="visible";
return false;
}
if(last.test(last_name)){
document.getElementById("error_last").style.visibility="hidden"
}
else{
document.getElementById("error_last").style.visibility="visible";
return false;
}
}
</script>
</body>
</html>
<?php
}
else{
header("Location:index.php");
}