Blame view

view/edit_geophone.html 4.88 KB
cf76164e6   Ting Chan   20190709
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
  <?php
  	//include('cfg/file_name.php');
      $open_geophone = '/home/pi/Desktop/vAlert/bin/geophoneData';
      shell_exec("sudo chmod 777 ".$open_geophone);
  	$nn = 0;
  	$handle = @fopen($open_geophone, "r");
          while(($data = fgets($handle,1000)) != false){
                  $output = explode(" ", $data);
                  if($output[0] == "GAIN"){
                      $GAIN=$output[1];
                  }
                  if($output[0] == "DAMPING_RATIO"){
                      $DAMPING_RATIO=$output[1];
                  }
                  if($output[0] == "RESISTANCE"){
                      $RESISTANCE=$output[1];
                  }
                  if($output[0] == "DAMPING_RESISTOR"){
                      $DAMPING_RESISTOR=$output[1];
                  }
                  if($output[0] == "MASS"){
                      $MASS=$output[1];
                  }                
                  if($output[0] == "FREQUENCY"){
                      $FREQUENCY=$output[1];
                  }
          }
  	if($_SESSION['account'] == 'sanlien'){
  		$action = 'php/change_geophone.php';
  	}
  
  ?>				
  					<main class="mn-inner">
  						<div class="row">	
  						<div class="card">
                              <div class="card-content">
                                  <span class="card-title">GeoPhone</span><br>
                                  <div class="row">
                                      <form class="col s12" id="msform" action='<?php echo $action; ?>' method="post">
  										
                                          <div class="row" >
  
  											<div class="input-field col s12">
                                                  <input type="text" name="GAIN" value="<?php echo $GAIN;?>" placeholder='GAIN'/>
                                                  <label for="first_name">GAIN</label>
                                              </div>
  											<div class="input-field col s12">
                                                  <input type="text" name="DAMPING_RATIO" value="<?php echo $DAMPING_RATIO;?>" placeholder='DAMPING_RATIO'/>
                                                  <label for="first_name">DAMPING_RATIO</label>
                                              </div>
  											<div class="input-field col s12">
                                                  <input type="text" name="RESISTANCE" value="<?php echo $RESISTANCE;?>" placeholder='RESISTANCE'/>
                                                  <label for="first_name">RESISTANCE</label>
                                              </div>
  											<div class="input-field col s12">
                                                  <input type="text" name="DAMPING_RESISTOR" value="<?php echo $DAMPING_RESISTOR;?>" placeholder='DAMPING_RESISTOR'/>
                                                  <label for="first_name">DAMPING_RESISTOR</label>
                                              </div>
  											<div class="input-field col s12">
                                                  <input type="text" name="MASS" value="<?php echo $MASS;?>" placeholder='MASS'/>
                                                  <label for="first_name">MASS</label>
                                              </div>
  											<div class="input-field col s12">
                                                  <input type="text" name="FREQUENCY" value="<?php echo $FREQUENCY;?>" placeholder='FREQUENCY'/>
                                                  <label for="first_name">FREQUENCY</label>
                                              </div>
  											
  											
                                          </div>
  										<a class="waves-effect waves-light btn m-b-xs update"><?=UPDATE?></a>
  											
                                      </form>
                                  </div>  
                              </div>
                          </div>
  						</div>
  						
  					</main>
  				</div>
  			
          <div class="left-sidebar-hover"></div>
          
          <!-- Javascripts -->
          <script src="assets/plugins/jquery/jquery-2.2.0.min.js"></script>
          <script src="assets/plugins/materialize/js/materialize.min.js"></script>
          <script src="assets/plugins/material-preloader/js/materialPreloader.min.js"></script>
          <script src="assets/plugins/jquery-blockui/jquery.blockui.js"></script>
          <script src="assets/plugins/select2/js/select2.min.js"></script>
          <script src="assets/js/alpha.min.js"></script>
          <script src="assets/js/pages/form-select2.js"></script>
          <script>
  			$('.update').click(function(){
  				$.ajax( {
  					  type: "POST",
  					  url: $('#msform').attr( 'action' ),
  					  data: $('#msform').serialize(),
  					  success: function( response ) {
  						if(response == '1'){
  							alert('Success !');
  							location.href='index.php?item=edit_geophone';
  						}else{
  							alert('Error !');
  						}
  					  }
  				});
  			})
  		</script>
      </body>
  </html>