-
Notifications
You must be signed in to change notification settings - Fork 0
/
manage_vendor_management.php
106 lines (92 loc) · 3.37 KB
/
manage_vendor_management.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
<?php
require('top.inc.php');
isAdmin();
$username='';
$password='';
$email='';
$mobile='';
$msg='';
if(isset($_GET['id']) && $_GET['id']!=''){
$image_required='';
$id=get_safe_value($con,$_GET['id']);
$res=mysqli_query($con,"select * from admin_users where id='$id'");
$check=mysqli_num_rows($res);
if($check>0){
$row=mysqli_fetch_assoc($res);
$username=$row['username'];
$email=$row['email'];
$mobile=$row['mobile'];
$password=$row['password'];
}else{
header('location:vendor_management.php');
die();
}
}
if(isset($_POST['submit'])){
$username=get_safe_value($con,$_POST['username']);
$email=get_safe_value($con,$_POST['email']);
$mobile=get_safe_value($con,$_POST['mobile']);
$password=get_safe_value($con,$_POST['password']);
$res=mysqli_query($con,"select * from admin_users where username='$username'");
$check=mysqli_num_rows($res);
if($check>0){
if(isset($_GET['id']) && $_GET['id']!=''){
$getData=mysqli_fetch_assoc($res);
if($id==$getData['id']){
}else{
$msg="Username already exist";
}
}else{
$msg="Username already exist";
}
}
if($msg==''){
if(isset($_GET['id']) && $_GET['id']!=''){
$update_sql="update admin_users set username='$username',password='$password',email='$email',mobile='$mobile' where id='$id'";
mysqli_query($con,$update_sql);
}else{
mysqli_query($con,"insert into admin_users(username,password,email,mobile,role,status) values('$username','$password','$email','$mobile',1,1)");
}
header('location:vendor_management.php');
die();
}
}
?>
<div class="content pb-0">
<div class="animated fadeIn">
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-header"><strong>MANAGE USERS </strong><small> </small></div>
<form method="post" enctype="multipart/form-data">
<div class="card-body card-block">
<div class="form-group">
<label for="username" class=" form-control-label">Username</label>
<input type="text" name="username" placeholder="Enter username" class="form-control" required value="<?php echo $username?>">
</div>
<div class="form-group">
<label for="password" class=" form-control-label">Password</label>
<input type="text" name="password" placeholder="Enter password" class="form-control" required value="<?php echo $password?>">
</div>
<div class="form-group">
<label for="password" class=" form-control-label">Email</label>
<input type="email" name="email" placeholder="Enter email" class="form-control" required value="<?php echo $email?>">
</div>
<div class="form-group">
<label for="categories" class=" form-control-label">Mobile</label>
<input type="text" name="mobile" placeholder="Enter mobile" class="form-control" required value="<?php echo $mobile?>">
</div>
<button id="payment-button" name="submit" type="submit" class="btn btn-lg btn-info btn-block">
<span id="payment-button-amount">SUBMIT</span>
</button>
<div class="field_error"><?php echo $msg?></div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<?php
require('footer.inc.php');
?>