1 | <?php
|
---|
2 | include '../include/factdb.php';
|
---|
3 |
|
---|
4 | $Time =$_GET['Time'];
|
---|
5 | $SelectedSource = $_GET['Source'];
|
---|
6 | $Date = $_GET['Date'];
|
---|
7 |
|
---|
8 | $SelectedMeasure = $_GET['measure'];
|
---|
9 | $TimeEX = explode("-",$Date);
|
---|
10 |
|
---|
11 | echo $TimeEX2 = "day=".$TimeEX[0]."&month=".$TimeEX[1]."&year=".$TimeEX[2];
|
---|
12 | echo $limtex = count(explode(",",$SelectedSource));
|
---|
13 | $insertdate = $TimeEX[2]."-".$TimeEX[1]."-".$TimeEx[0];
|
---|
14 | $value = $_GET['Data'];
|
---|
15 | $Date = $_GET['Date2'];
|
---|
16 | //$date = new DateTime($_GET['Date']);
|
---|
17 | $n_value = explode(",",$value);
|
---|
18 | echo "<br />";
|
---|
19 | //echo $date->format('Y-m-d H:i:s');
|
---|
20 | //fdgdfgdf
|
---|
21 | $Time = explode(",",$Time);
|
---|
22 | $select = explode(",",$SelectedSource);
|
---|
23 | $measure = explode(",",$SelectedMeasure);
|
---|
24 | echo "<br />";
|
---|
25 | $temp = "";
|
---|
26 | $insert_count = 0;
|
---|
27 |
|
---|
28 |
|
---|
29 |
|
---|
30 | /////// for measurement id///////
|
---|
31 | $new_limit = $limtex;
|
---|
32 | for($j=0;$j<=$new_limit-1;$j++){
|
---|
33 |
|
---|
34 | $Timef = $Time[$i];
|
---|
35 |
|
---|
36 | $ex_counter = explode(":",$Timef);
|
---|
37 | //$ex_counter2 = explode(" ",$ex_counter[1]);
|
---|
38 |
|
---|
39 | $counter[$j] = $ex_counter[0];
|
---|
40 |
|
---|
41 | }
|
---|
42 |
|
---|
43 | if($new_limit > 1){
|
---|
44 | for($j=0;$j<=$new_limit-1;$j++){
|
---|
45 |
|
---|
46 | for($y=0;$y<=$new_limit-1;$y++){
|
---|
47 |
|
---|
48 | if($counter[$j]==$counter[$y+1]){
|
---|
49 |
|
---|
50 | if(empty($by_count[$j])){
|
---|
51 |
|
---|
52 | $by_count[$j] = $y;
|
---|
53 | }
|
---|
54 | }
|
---|
55 |
|
---|
56 | }
|
---|
57 | }
|
---|
58 |
|
---|
59 | }else{
|
---|
60 |
|
---|
61 |
|
---|
62 | $by_count[0]=0;
|
---|
63 |
|
---|
64 | }
|
---|
65 |
|
---|
66 |
|
---|
67 |
|
---|
68 |
|
---|
69 |
|
---|
70 |
|
---|
71 | for($i=0;$i<=$limtex-1;$i++){
|
---|
72 |
|
---|
73 | $n1 = $n_value[$i];
|
---|
74 | $select[$i];
|
---|
75 | $selectf = $select[$i];
|
---|
76 | //////Time////
|
---|
77 | $Timef = $Time[$i];
|
---|
78 |
|
---|
79 | //////// for measurement /////////
|
---|
80 |
|
---|
81 | $measuref = $measure[$i];
|
---|
82 |
|
---|
83 | //////// Date parsing into format////////
|
---|
84 | $dateTime=new DateTime($date." ".$Time[$i]);
|
---|
85 | $parsed_date = $dateTime->format('Y-m-d H:i:s');
|
---|
86 |
|
---|
87 | echo $by_count[$i]."----".$counter[$j];
|
---|
88 | echo "<br />";
|
---|
89 |
|
---|
90 |
|
---|
91 | //$insert = mysql_query("INSERT INTO schedule values('','$parsed_date','$parsed_date','','','$n1','$selectf','$measuref')") or die(mysql_error());
|
---|
92 |
|
---|
93 | }
|
---|
94 | if($insert){
|
---|
95 |
|
---|
96 | ?>
|
---|
97 | <script type="text/javascript">
|
---|
98 |
|
---|
99 | alert("Sucessfully save");
|
---|
100 | window.location = '../index.php?<?php echo $TimeEX2; ?>';
|
---|
101 | </script>
|
---|
102 | <?php
|
---|
103 |
|
---|
104 | }
|
---|
105 |
|
---|
106 | ?> |
---|