-
Notifications
You must be signed in to change notification settings - Fork 0
/
account.php
163 lines (151 loc) · 6.13 KB
/
account.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
<?php
include 'core/init.php';
$user_id = $_SESSION['user_id'];
$user = $getFromU->userData($user_id);
$notify = $getFromM->getNotificationCount($user_id);
$notification = $getFromM->notification($user_id);
if($getFromU->loggedIn()===false){
header('Location: '.BASE_URL.'index.php');
}
if(isset($_POST['submit'])){
$username = $getFromU->checkInput($_POST['username']);
$email = $getFromU->checkInput($_POST['email']);
$error = array();
// $lmao = '/^[a-zA-Z0-9]{4,}$/';
if(!empty($username) and !empty($email)){
if($user->username != $username and $getFromU->checkUsername($username) === true){
$error['username'] = "username is not available, try diffrent username";
} else if(!preg_match('/^[a-zA-Z0-9]{4,}$/', $username)){
$error['username'] = "only character and numbers allowed";
} else if(!filter_var($email,FILTER_VALIDATE_EMAIL)){
$error['email'] = "Invalid email format";
}else if($user->email != $email and $getFromU->checkEmail($email) === true){
$error['email'] = "email already in use";
} else {
$getFromU->update('users',$user_id,array('username'=>$username,'email'=>$email));
header('Location: '.BASE_URL.'settings/account');
}
}else {
$error['fields'] = "all fields are required";
}
}
?>
<!DOCTYPE HTML>
<html>
<head>
<title>Account settings page</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1" />
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<link rel="stylesheet" href="<?php echo BASE_URL; ?>assets/css/style-complete.css"/>
<link rel="stylesheet" href="<?php echo BASE_URL; ?>assets/css/cs.css"/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.css"/>
</head>
<!--Helvetica Neue-->
<body style=" min-height: 110vh;">
<?php
include 'includes/entities/loader.php';
?>
<div class="wrapper">
<?php
include 'includes/entities/side-pro-link.php';
?>
<div class="righter">
<div class="inner-righter">
<div class="acc">
<div class="acc-heading">
<h2>Account</h2>
<h3>Change your basic account settings.</h3>
</div>
<div class="acc-content">
<form method="POST">
<div class="acc-wrap">
<div class="acc-left">
USERNAME
</div>
<div class="acc-right">
<input type="text" name="username" placeholder="<?php echo $user->username ?>" value="<?php echo $user->username ?>" />
<br>
<div style="text-align: center; margin: 2px 0; font-size: 14px; color: #ed3f3f; padding: 5px;">
<?php if(isset($error['username'])){
echo $error['username'];
}
?>
</div>
</div>
</div>
<div class="acc-wrap">
<div class="acc-left">
Email
</div>
<div class="acc-right">
<input type="text" name="email" placeholder="<?php echo $user->email ?>" value="<?php echo $user->email ?>"/>
<br>
<div style="text-align: center; margin: 2px 0; font-size: 14px; color: #ed3f3f; padding: 5px;">
<?php if(isset($error['email'])){
echo $error['email'];
}
?>
</div>
</div>
</div>
<div class="acc-wrap">
<div class="acc-left">
</div>
<div class="acc-right">
<input type="Submit" name="submit" value="Save changes"/>
</div>
<div class="settings-error" style="color:var( --primary-text-color);">
<?php if(isset($error['fields'])){
echo $error['fields'];
}
?>
</div>
</div>
</form>
<?php if($user->statusVerify == 0) echo '<div class="req-for-verify" style="width: 90%; margin-bottom:20px;">
<h4 style="font-size: 18px; font-weight:600;"> Verified </h4>
<h5 style="font-size:13px;" class="res"> No. <span style="color:var( --primary-theme-color); cursor:pointer; margin-left:3.5px;" id="req-for-verify-form" data-user="<?php echo $user->user_id ?>"> Request Verification </span> </h5>
</div>'; ?>
</div>
</div>
<div class="option-box">
<ul>
<li>
<a href="<?php echo BASE_URL;?>settings/password">
<div>
Change Password
<span><i class="fa fa-angle-right" aria-hidden="true"></i></span>
</div>
</a>
</li>
</ul>
</div>
</div>
</div><!--RIGHTER ENDS-->
<div class="popupTweet"></div>
<div class="alert hide">
<span id="iconSign" class="fa "></span>
<span class="msgs"> SAMPLE TEXT </span>
<div class="close-btn">
<span class="fa fa-times"></span>
</div>
</div>
<script type="text/javascript" src="<?php echo BASE_URL;?>assets/js/custome-complete-js.js"></script>
<script type="text/javascript" src="<?php echo BASE_URL;?>assets/js/popupForm.js"></script>
<script type="text/javascript" src="<?php echo BASE_URL;?>assets/js/search.js"></script>
<script type="text/javascript" src="<?php echo BASE_URL;?>assets/js/hashtag.js"></script>
<script type="text/javascript" src="<?php echo BASE_URL;?>assets/js/messages.js"></script>
<script type="text/javascript" src="<?php echo BASE_URL;?>assets/js/delete.js"></script>
<script type="text/javascript" src="<?php echo BASE_URL;?>assets/js/postMessage.js"></script>
<script type="text/javascript" src="<?php echo BASE_URL;?>assets/js/notification.js"></script>
<script type="text/javascript" src="<?php echo BASE_URL;?>assets/js/like.js"></script>
</div>
<!--CONTAINER_WRAP ENDS-->
</div><!-- ends wrapper -->
<?php
include 'includes/entities/bottom-nav.php';
?>
</body>
</html>