forked from rajanpatel1011/Courier-Management-System
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocess.php
More file actions
153 lines (114 loc) · 3.74 KB
/
process.php
File metadata and controls
153 lines (114 loc) · 3.74 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
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
<?php
//start session
session_start();
require_once('database.php');
$action = $_GET['action'];
switch($action) {
case 'add-cons':
addCons();
break;
case 'delivered':
markDelivered();
break;
case 'add-office':
addNewOffice();
break;
case 'add-manager':
addManager();
break;
case 'update-status':
updateStatus();
break;
case 'change-pass':
changePass();
break;
case 'logOut':
logOut();
break;
}//switch
function addCons(){
$Shippername = $_POST['Shippername'];
$Shipperphone = $_POST['Shipperphone'];
$Shipperaddress = $_POST['Shipperaddress'];
$Receivername = $_POST['Receivername'];
$Receiverphone = $_POST['Receiverphone'];
$Receiveraddress = $_POST['Receiveraddress'];
$ConsignmentNo = $_POST['ConsignmentNo'];
$Shiptype = $_POST['Shiptype'];
$Weight = $_POST['Weight'];
$Invoiceno = $_POST['Invoiceno'];
$Qnty = $_POST['Qnty'];
$Bookingmode = $_POST['Bookingmode'];
$Totalfreight = $_POST['Totalfreight'];
$Mode = $_POST['Mode'];
$Packupdate = $_POST['Packupdate'];
$Pickuptime = $_POST['Pickuptime'];
$status = $_POST['status'];
$Comments = $_POST['Comments'];
$sql = "INSERT INTO tbl_courier (cons_no, ship_name, phone, s_add, rev_name, r_phone, r_add, type, weight, invice_no, qty, book_mode, freight, mode, pick_date, pick_time, status, comments, book_date )
VALUES('$ConsignmentNo', '$Shippername','$Shipperphone', '$Shipperaddress', '$Receivername','$Receiverphone','$Receiveraddress', '$Shiptype',$Weight , '$Invoiceno', $Qnty, '$Bookingmode', '$Totalfreight', '$Mode', '$Packupdate', '$Pickuptime', '$status', '$Comments', NOW())";
//echo $sql;
dbQuery($sql);
header('Location: courier-add-success.php');
//echo $Ship;
}//addCons
function markDelivered() {
$cid = (int)$_GET['cid'];
$sql = "UPDATE tbl_courier
SET status = 'Delivered'
WHERE cid= $cid";
dbQuery($sql);
header('Location: delivered-success.php');
}//markDelivered();
function addNewOffice() {
$OfficeName = $_POST['OfficeName'];
$OfficeAddress = $_POST['OfficeAddress'];
$City = $_POST['City'];
$PhoneNo = $_POST['PhoneNo'];
$OfficeTiming = $_POST['OfficeTiming'];
$ContactPerson = $_POST['ContactPerson'];
$sql = "INSERT INTO tbl_offices (off_name, address, city, ph_no, office_time, contact_person)
VALUES ('$OfficeName', '$OfficeAddress', '$City', '$PhoneNo', '$OfficeTiming', '$ContactPerson')";
dbQuery($sql);
header('Location: office-add-success.php');
}//addNewOffice
function addManager() {
$ManagerName = $_POST['ManagerName'];
$Password = $_POST['Password'];
$Address = $_POST['Address'];
$Email = $_POST['Email'];
$PhoneNo = $_POST['PhoneNo'];
$OfficeName = $_POST['OfficeName'];
$sql = "INSERT INTO tbl_courier_officers (officer_name, off_pwd, address, email, ph_no, office, reg_date)
VALUES ('$ManagerName', '$Password', '$Address', '$Email', '$PhoneNo', '$OfficeName', NOW())";
dbQuery($sql);
header('Location: manager-add-success.php');
}//addNewOffice
function updateStatus() {
$OfficeName = $_POST['OfficeName'];
$status = $_POST['status'];
$comments = $_POST['comments'];
$cid = (int)$_POST['cid'];
$cons_no = $_POST['cons_no'];
//$OfficeName = $_POST['OfficeName'];
$sql = "INSERT INTO tbl_courier_track (cid, cons_no, current_city, status, comments, bk_time)
VALUES ($cid, '$cons_no', '$OfficeName', '$status', '$comments', NOW())";
dbQuery($sql);
$sql_1 = "UPDATE tbl_courier
SET status = '$status'
WHERE cid = $cid
AND cons_no = '$cons_no'";
dbQuery($sql_1);
header('Location: update-success.php');
}//addNewOffice
function logOut(){
if(isset($_SESSION['user_name'])){
unset($_SESSION['user_name']);
}
if(isset($_SESSION['user_type'])){
unset($_SESSION['user_type']);
}
session_destroy();
header('Location: login.php');
}//logOut
?>