-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathupload_documents.php
More file actions
320 lines (272 loc) · 9.65 KB
/
upload_documents.php
File metadata and controls
320 lines (272 loc) · 9.65 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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
<?php
include("includes/a_config.php");
//error_reporting(0);
?>
<?php
include("includes/conn.php");
include("includes/sessionconfig.php");
?>
<?php
if(isset($_POST['btn_proceed'])){
$a1=$_POST['sele_sell'];
$sql2="SELECT * FROM project_master WHERE projmas_key='$a1'";
$result2 = mysqli_query($link,$sql2);
while($row2=mysqli_fetch_array($result2)){
$a2=$row2['bid_type'];
}
echo "<script>
alert('Upload Document Started');
window.location.href='upload_documents.php?p=$a1&t=$a2';
</script>";
}
if(isset($_GET['p']) && isset($_GET['t'])){
$sql3="SELECT * FROM project_master WHERE projmas_key='$_GET[p]'";
$result3 = mysqli_query($link,$sql3);
while($row3=mysqli_fetch_array($result3)){
$p_id=$row3['project_id'];
$p_nme=$row3['project_nme'];
}
}
if($_GET['t']=='NCB'){
$target_dir = "upload_doc/";
if(isset($_POST['btn_adduploaddoc'])){
$target_file = $target_dir . basename($_FILES["upload_doc"]["name"]);
$uploadOk = 1;
$imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
$check = getimagesize($_FILES["upload_doc"]["tmp_name"]);
// Check file size
if ($_FILES["upload_doc"]["size"] > 50000000) {
echo "<script>
alert('Sorry, your file is too large.');
</script>";
$uploadOk = 0;
}
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
$y1= "Sorry, your file was not uploaded.";
// if everything is ok, try to upload file
} else {
$target_new = $target_dir .$_GET['p']."-003-NCBBidding-Document.".$imageFileType;
if (file_exists($target_new)) {
move_uploaded_file($_FILES["upload_doc"]["tmp_name"], $target_new);
$sql5="UPDATE upload_documents SET sys_actperson='$ses_ukey' WHERE project_key='$_GET[p]'";
if(mysqli_query($link,$sql5)){
echo "<script>
alert('Documents Replace Successfully.');
window.location.href='upload_documents.php?p=$_GET[p]&t=$_GET[t]';
</script>";
}
}
else{
if (move_uploaded_file($_FILES["upload_doc"]["tmp_name"], $target_new)) {
$gcr=$_GET['p']."-003-NCBBidding-Document.".$imageFileType;
$sql4="INSERT INTO upload_documents (status,uploaddoc_key,project_key,doc_type,doc_nme,sys_actperson)
VALUES(
0,
NULL,
'$_GET[p]',
'003-NCB_Bidding_Document',
'$gcr',
'$ses_ukey'
)";
if(mysqli_query($link,$sql4)){
echo "<script>
alert('Documents Upload Successfully.');
window.location.href='upload_documents.php?p=$_GET[p]&t=$_GET[t]';
</script>";
}
}
}
}
}
}
if($_GET['t']=='Shopping'){
$target_dir = "upload_doc/";
if(isset($_POST['btn_adduploaddoc'])){
$target_file = $target_dir . basename($_FILES["upload_doc"]["name"]);
$uploadOk = 1;
$imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
$check = getimagesize($_FILES["upload_doc"]["tmp_name"]);
// Check file size
if ($_FILES["upload_doc"]["size"] > 50000000) {
echo "<script>
alert('Sorry, your file is too large.');
</script>";
$uploadOk = 0;
}
// Check if $uploadOk is set to 0 by an error
if ($uploadOk == 0) {
$y1= "Sorry, your file was not uploaded.";
// if everything is ok, try to upload file
} else {
$target_new = $target_dir .$_GET['p']."-Shopping-Bidding-Document.".$imageFileType;
if (file_exists($target_new)) {
move_uploaded_file($_FILES["upload_doc"]["tmp_name"], $target_new);
$sql5="UPDATE upload_documents SET sys_actperson='$ses_ukey' WHERE project_key='$_GET[p]'";
if(mysqli_query($link,$sql5)){
echo "<script>
alert('Documents Replace Successfully.');
window.location.href='upload_documents.php?p=$_GET[p]&t=$_GET[t]';
</script>";
}
}
else{
if (move_uploaded_file($_FILES["upload_doc"]["tmp_name"], $target_new)) {
$gcr=$_GET['p']."-Shopping-Bidding-Document.".$imageFileType;
$sql4="INSERT INTO upload_documents (status,uploaddoc_key,project_key,doc_type,doc_nme,sys_actperson)
VALUES(
0,
NULL,
'$_GET[p]',
'Shopping_Bidding_Document',
'$gcr',
'$ses_ukey'
)";
if(mysqli_query($link,$sql4)){
echo "<script>
alert('Documents Upload Successfully.');
window.location.href='upload_documents.php?p=$_GET[p]&t=$_GET[t]';
</script>";
}
}
}
}
}
}
?>
<!DOCTYPE html>
<html>
<head>
<?php include("includes/head-tag-contents.php");?>
<meta charset="utf-8">
<script type="text/javascript" src="js/jquery3.3.1.js"></script>
</head>
<body>
<?php include("includes/design-top.php");?>
<?php include("includes/navigation.php");?>
<div class="container" id="main-content">
<h2> Will create the BOQ here </h2>
<p> TextBoxes will create when we click on the "Create TextBoxes" Button </p>
<form name="f1" method="post" >
<div class="form-group">
<label for="sel1">Select the Project ID</label>
<select class="form-control input-sm" id="sel1" name="sele_sell">
<?php
if(isset($_GET['p'])){
?>
<option value="<?php echo $_GET['p'];?>"><?php echo $p_id." - ".$p_nme; ?></option>
<?php
}
else{
$sql1="SELECT * FROM project_master WHERE status=0";
$result1 = mysqli_query($link,$sql1);
while($row1=mysqli_fetch_array($result1)){
?>
<option value="" disabled selected hidden>Please Choose.............</option>
<option value="<?php echo $row1['projmas_key'];?>"><?php echo $row1['project_id']." - ".$row1['project_nme'] ?></option>
<?php
}
}
?>
</select>
</div>
<?php
if(!isset($_GET['p'])){
?>
<button type="submit" class="btn btn-success" name="btn_proceed">Proceed >></button>
<?php
}
?>
</form>
</br>
</br>
</br>
<?php
if(isset($_GET['p']) && isset($_GET['t'])){
?>
<?php
if($_GET['t']=='NCB'){
?>
<div class="row">
<div class="col-md-2">
</div>
<div class="col-md-8">
<section class="panel panel-primary panel-transparent">
<div class="panel-body">
<div class="col-md-2">
<a href="ncb_specification_upload.php?p=<?php echo $_GET['p']; ?>&t=NCB" class="btn btn-success"><div style="font-size:20px; font-weight:bold;">« Previous</div></a>
</div>
<div class="col-md-8">
<div style="font-size:20px; color:green; font-weight:bold;" align="center"> Correct and Upload NCB Document </div>
</div>
<div class="col-md-2">
<a href="bid_process.php?p=<?php echo $_GET['p'];?>&t=NCB" class="btn btn-warning btn-block"><div style="font-size:20px; font-weight:bold;">Next »</div></a>
</div>
</div>
</section>
</div>
</div>
<br>
<br>
<form name="f2" method="POST" enctype="multipart/form-data">
<div class="form-group">
<label>Upload NCB Bidding Document</label>
<input type="file" class="form-control input-md" name="upload_doc" required>
</div>
<div class="form-group">
<button type="submit" name="btn_adduploaddoc" class="btn btn-primary btn-lg btn-block">Upload Document</button>
</div>
</form>
<?php
}
if($_GET['t']=='Shopping'){
?>
<div class="row">
<div class="col-md-2">
</div>
<div class="col-md-8">
<section class="panel panel-primary panel-transparent">
<div class="panel-body">
<div class="col-md-2">
<a href="shp_specification_upload.php?p=<?php echo $_GET['p']; ?>&t=Shopping" class="btn btn-success"><div style="font-size:20px; font-weight:bold;">« Previous</div></a>
</div>
<div class="col-md-8">
<div style="font-size:20px; color:green; font-weight:bold;" align="center"> Correct and Upload Shopping Document </div>
</div>
<div class="col-md-2">
<a href="shp_bid_process.php?p=<?php echo $_GET['p'];?>&t=Shopping" class="btn btn-warning btn-block"><div style="font-size:20px; font-weight:bold;">Next »</div></a>
</div>
</div>
</section>
</div>
</div>
<br>
<br>
<form name="f2" method="POST" enctype="multipart/form-data">
<div class="form-group">
<label>Upload Shopping Bidding Document</label>
<input type="file" class="form-control input-md" name="upload_doc" required>
</div>
<div class="form-group">
<button type="submit" name="btn_adduploaddoc" class="btn btn-primary btn-lg btn-block">Upload Document</button>
</div>
</form>
<?php
}
?>
<?php
}
?>
<?php include("includes/footer.php");?>
</body>
<script type="text/javascript">
$(window).scroll(function() {
sessionStorage.scrollTop = $(this).scrollTop();
});
$(document).ready(function() {
if (sessionStorage.scrollTop != "undefined") {
$(window).scrollTop(sessionStorage.scrollTop);
}
});
</script>
</html>