Blame view

view/edit_version.html 3.11 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
  <?php
  	include('cfg/file_name.php');
  	$open_version = 'version.txt';
  	shell_exec("sudo chmod 777 ".$open_version);
  	$nn = 0;
  	$i = 0;	
  	$handle = @fopen("php/".$open_version,"r");
  	//讀檔案
  	while(($data = fgetcsv($handle,1000,"
  ")) != false){
  		foreach($data as $key => $value){
  			if($value != ""){
  				$version_aa[] = $value;
  				$i++;
  			}
  		}
  	}
  	$content = array_filter($aa);
  	//$hidden  = array("[BLOCK_CONFIG_BY_ONE_ITEM]","[BACKUP_CONFIG]","[BACKUP_PROGRAM]","[BACKUP_IP]");
  	$ignore = array("Palert Advance");
  ?>
  <main class="mn-inner">
  	<div class="row">
  	<div class="card">
          <div class="card-content">
  		<label class="active card-title">Choice Version</label>
  			<div class="row">
  				<div class="col s12">
  				<form id="edit_config"  action="php/change_version.php" method="POST">
  					<p class="p-v-xs">
  						<input name="version" class="with-gap" type="radio" value="PX-01" <?php echo ($version_aa[0] == "PX-01") ? 'checked':''; ?> id="test1" />
  						<label for="test1">PX-01</label>
  					</p>
  					<p class="p-v-xs">
  						<input name="version" class="with-gap" type="radio" value="PX-01 Cube"  <?php echo ($version_aa[0] == "PX-01 Cube") ? 'checked':''; ?> id="test2" />
  						<label for="test2">PX-01 Cube</label>
  					</p>
  					<p class="p-v-xs">
  						<input name="version" class="with-gap" type="radio" value="Palert Advance"  <?php echo ($version_aa[0] == "Palert Advance") ? 'checked':''; ?> id="test3" />
  						<label for="test3">Palert Advance</label>
  					</p>
  					<p class="p-v-xs">
  						<input name="version" class="with-gap" type="radio" value="Palert Plus"  <?php echo ($version_aa[0] == "Palert Plus") ? 'checked':''; ?> id="test4" />
  						<label for="test4">Palert Plus</label>
  					</p>
  					<a class="waves-effect waves-light btn m-b-xs update"><?=UPDATE?></a>
  				</form>
  				</div>
  			</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>
  			$('.status').hide();
  			$('.update').click(function(){
  				$.ajax( {
  					  type: "POST",
  					  url: $('#edit_config').attr( 'action' ),
  					  data: $('#edit_config').serialize(),
  					  success: function( response ) {
  						if(response == '1'){
  							alert('Success !');
  							location.href='index.php?item=edit_version';
  						}else{
  							alert('Error !');
  						}
  					  },
  					  beforeSend:function(){
  						$('.status').show();
  					  }
  				});
  			})
  			
  			$('.reload').click(function(){
  				location.href='php/reload.php';				
  			})
  			
  		</script>
      </body>
  </html>