-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathload_adminusers.php
More file actions
104 lines (90 loc) · 3.6 KB
/
load_adminusers.php
File metadata and controls
104 lines (90 loc) · 3.6 KB
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
<?php
include('access1.php');
include('include/connection.php');
include('include/query-helper.php');
include('include/pagination-helper.php');
$fm_caname = $_SESSION['sqyard_user'];
if(isset($_POST['hid_user_reg']) && $_POST['hid_user_reg'] == '1')
{
$txt_email = mysqli_real_escape_string($db_con,$_POST['txt_email']);
$sql_adhnocheck = " select * from tbl_change_agents where emailId = '".$txt_email."' ";
$res_adhnocheck = mysqli_query($db_con,$sql_adhnocheck);
$tot_adhnocheck = mysqli_num_rows($res_adhnocheck);
if($tot_adhnocheck == 0)
{
$txt_name = mysqli_real_escape_string($db_con,$_POST['txt_name']);
$txt_userType = mysqli_real_escape_string($db_con,$_POST['txt_userType']);
$txt_password = mysqli_real_escape_string($db_con,$_POST['txt_password']);
$txt_mobileno = mysqli_real_escape_string($db_con,$_POST['txt_mobileno']);
if($txt_email != '' && $txt_mobileno != '' && $txt_password != '')
{
// Query for inserting the users into tbl_change_agents table
$sql_insert_adminusers = " INSERT INTO `tbl_change_agents`(`userType`, `fname`, `emailId`, `contactno`, `password`, ";
$sql_insert_adminusers .= " `reg_status`, `register_dt`) ";
$sql_insert_adminusers .= " VALUES ('".$txt_userType."', '".$txt_name."', '".$txt_email."', '".$txt_mobileno."', ";
$sql_insert_adminusers .= " '".$txt_password."', '1', '".$datetime."') ";
$res_insert_adminusers = mysqli_query($db_con, $sql_insert_adminusers) or die(mysqli_error($db_con));
if($res_insert_adminusers)
{
quit('Success', 1);
}
else
{
quit('Insertion Error, Please try after sometime');
}
}
else
{
quit('Email,Mobile and Password no cannot be blank!!!');
}
}
else
{
quit('Email id already in use!!!');
}
}
if(isset($_POST['hid_user_edit']) && $_POST['hid_user_edit'] == '1')
{
$hid_user_id = mysqli_real_escape_string($db_con,$_POST['hid_user_id']);
$txt_email = mysqli_real_escape_string($db_con,$_POST['txt_email']);
$sql_adhnocheck = "Select * from tbl_change_agents where emailId = '".$txt_email."' AND id ='".$hid_user_id."'";
//quit('error',$sql_adhnocheck);
$res_adhnocheck = mysqli_query($db_con,$sql_adhnocheck);
$tot_adhnocheck = mysqli_num_rows($res_adhnocheck);
if($tot_adhnocheck == 1)
{
$txt_name = mysqli_real_escape_string($db_con,$_POST['txt_name']);
$txt_userType = mysqli_real_escape_string($db_con,$_POST['txt_userType']);
$txt_password = mysqli_real_escape_string($db_con,$_POST['txt_password']);
$txt_mobileno = mysqli_real_escape_string($db_con,$_POST['txt_mobileno']);
if($txt_email != '' && $txt_mobileno != '' && $txt_password != '')
{
// Query for Updating the farmer into tbl_farmers table
$sql_update_farmer = " UPDATE `tbl_change_agents` ";
$sql_update_farmer .= " SET `userType`='".$txt_userType."', ";
$sql_update_farmer .= " `fname`='".$txt_name."', ";
$sql_update_farmer .= " `emailId`='".$txt_email."', ";
$sql_update_farmer .= " `contactno`='".$txt_mobileno."', ";
$sql_update_farmer .= " `password`='".$txt_password."', ";
$sql_update_farmer .= " `updated_dt`='".$datetime."' ";
$sql_update_farmer .= " WHERE `id` = '".$hid_user_id."' ";
$res_update_farmer = mysqli_query($db_con, $sql_update_farmer) or die(mysqli_error($db_con));
if($res_update_farmer)
{
quit('Success', 1);
}
else
{
quit('Insertion Error, Please try after sometime');
}
}
else
{
quit('Email, Mobile, Password no cannot be blank!!!');
}
}
else
{
quit('Email id already in use!!!');
}
}