-
Notifications
You must be signed in to change notification settings - Fork 0
/
manual_wl_save.php
45 lines (38 loc) · 1.6 KB
/
manual_wl_save.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
<?php
include('include/connect.php');
session_start();
//ST001 01012016,09 1228,12 1229,15 1230,18 1231,06 1235
if (isset($_POST['wl_text'])) {
$massege = $_POST['wl_text'];
$exp = explode(",",$massege);
if(sizeof($exp)==6){
$wl = explode(',',$massege);
$stationDate = explode(' ', $wl[0]);
$station = $stationDate[0];
$DD = $stationDate[1][0].$stationDate[1][1];
$MM = $stationDate[1][2].$stationDate[1][3];
$YYYY= $stationDate[1][4].$stationDate[1][5].$stationDate[1][6].$stationDate[1][7];
$d1=$YYYY."-".$MM."-".($DD-1)." "."09:00:00";
$d2=$YYYY."-".$MM."-".($DD-1)." "."12:00:00";
$d3=$YYYY."-".$MM."-".($DD-1)." "."15:00:00";
$d4=$YYYY."-".$MM."-".($DD-1)." "."18:00:00";
$d5=$YYYY."-".$MM."-".$DD." "."06:00:00";
// echo $d1;
$wl1 = (explode(' ', $wl[1])[1])/100;
$wl2 = (explode(' ', $wl[2])[1])/100;
$wl3 = (explode(' ', $wl[3])[1])/100;
$wl4 = (explode(' ', $wl[4])[1])/100;
$wl5 = (explode(' ', $wl[5])[1])/100;
$query = "INSERT INTO water_level (`station_name`, `water_level`, `time`) VALUES";
$query.= "('{$station}', '{$wl1}', '{$d1}'),";
$query.= "('{$station}', '{$wl2}', '{$d2}'),";
$query.= "('{$station}', '{$wl3}', '{$d3}'),";
$query.= "('{$station}', '{$wl4}', '{$d4}'),";
$query.= "('{$station}', '{$wl5}', '{$d5}')";
mysqli_query($connection,$query);
$_SESSION['manual_save']='ok';
// echo $query;
}
}
header('Location: manual_entry.php');
?>