-
Notifications
You must be signed in to change notification settings - Fork 3
/
usrprofile.php
133 lines (111 loc) · 4.72 KB
/
usrprofile.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
<?php
session_start();
if(!isset($_SESSION['userdata']))
{
header('Location: index.php');
}
if($_SESSION['userdata']['is_admin']==1)
{
include('header.php');
include('adminwrk.php');
?>
<header>
<nav class="navbar navbar-expand-lg">
<a class="navbar-brand nos" href="#">Ced<span class="gree">Cab</span></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span><i class="fas fa-bars logo text-dark"></i></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ml-auto">
<li class="nav-item rbtn">
<a class="btn" href="admin.php">Dashboard</a>
<a class="btn" href="logout.php">Logout</a>
</li>
</ul>
</div>
</nav>
</header>
<?php
echo '<h1 class="text-center text-weight-bold text-dark">ADMIN can not Enter User Area</h1>';
}
else {
include('user.php');
if (isset($_POST['change']))
{
$old = isset($_POST['old'])?$_POST['old']:'';
$new = isset($_POST['new'])?$_POST['new']:'';
$rnew = isset($_POST['rnew'])?$_POST['rnew']:'';
$idp = isset($_POST['id'])?$_POST['id']:'';
$adm = new user();
$admc = new dbcon();
$show = $adm->changep($old,$new,$rnew,$idp,$admc->conn);
}
$id=$_SESSION['userdata']['user_id'];
$adm = new user();
$admc = new dbcon();
$show = $adm->prof($id,$admc->conn);
foreach($show as $key=>$val)
{
$na=$val['name'];
$mo=$val['mobile'];
}
if (isset($_POST['edit']))
{
$name = isset($_POST['name'])?$_POST['name']:'';
$mobile = isset($_POST['mobile'])?$_POST['mobile']:'';
$ida = isset($_POST['id'])?$_POST['id']:'';
$adm = new user();
$admc = new dbcon();
$show = $adm->uprof($name,$mobile,$ida,$admc->conn);
}
include('header.php');
include('navs.php');
include('ussidebar.php');
?>
<nav class="nav nav-pills nav-justified col-sm-10">
<button class="nav-link btn btn-light " id="edipr">Edit Profile</button>
<button class="nav-link btn btn-light " id="chpa">Change Password</button>
</nav>
<div id="edi">
<h3 class="text-center">Edit Profile</h3>
<section class="container-fluid box col-lg-7 col-sm-10 col-xs-12 col-md-7 pt-lg-4 mt-lg-4 pt-sm-0 mt-sm-0 mb-5 pb-3 pt-2">
<form action="usrprofile.php" method="post">
<div class="form-group row feilds ">
<label class="col-sm-2" for="name" >Name</label>
<input class="form-control-plaintext col-sm-10 " type="text" pattern="^[a-zA-Z_]+( [a-zA-Z_]+)*$" name="name" id="name" placeholder="Enter Your Name" value="<?php if(isset($na)){ echo $na; } ?>" required>
</div>
<div class="form-group row feilds ">
<label class="col-sm-2" for="mobile">Mobile</label>
<input class="form-control-plaintext col-sm-10 " type="text" name="mobile" id="mobile" maxlength="10" minlength="10" placeholder="Enter Mobile Number" <?php if(isset($mo)){echo "value=".$mo ;} ?> required>
</div>
<input type="hidden" name="id" id="id" <?php if(isset($id)){ echo "value= ".$id; } ?>>
<div class="form-group ">
<input type="submit" class="btn green btn-primary btn-lg btn-block" id="edit" name="edit" value="Edit Profile">
</div>
</form>
</section>
</div>
<div id="cpaa">
<h3 class="text-center">Change Password</h3>
<section class="container-fluid box col-lg-7 col-sm-10 col-xs-12 col-md-7 pt-lg-4 mt-lg-4 pt-sm-0 mt-sm-0 mb-5 pb-3 pt-2">
<form action="usrprofile.php" method="post">
<div class="form-group row feilds ">
<label class="col-sm-2" for="old" >Old Password</label>
<input class="form-control-plaintext col-sm-10 " type="password" name="old" id="old" placeholder="Enter Old Password" required>
</div>
<div class="form-group row feilds ">
<label class="col-sm-2" for="new" >New Password</label>
<input class="form-control-plaintext col-sm-10 " type="password" name="new" id="new" placeholder="Enter New Password" required>
</div>
<div class="form-group row feilds ">
<label class="col-sm-2" for="rnew" >Re-enter New Password</label>
<input class="form-control-plaintext col-sm-10 " type="password" name="rnew" id="rnew" placeholder="Re-Enter New Password" required>
</div>
<input type="hidden" name="id" id="id" <?php if(isset($id)){ echo "value= ".$id; } ?>>
<div class="form-group ">
<input type="submit" class="btn green btn-primary btn-lg btn-block" id="change" name="change" value="Change Password">
</div>
</form>
</section>
</div>
<?php include('adfoot.php');} ?>