-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathsetup.php
77 lines (72 loc) · 1.55 KB
/
setup.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
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
<?
// ===================================================================
// License: GPL v3 (http://www.gnu.org/licenses/gpl.html)
// Copyright (c) 2016-2020 Xzero Systems, http://sim-roulette.com
// Author: Nikita Zabelin
// ===================================================================
include("_func.php");
$status=1;
if ($_POST['submit']) // Save the settings | Сохранение настроек
{
unset($_POST['submit']);
$qry="DELETE FROM `values`";
mysqli_query($db,$qry);
foreach ($_POST as $key => $value)
{
if (strpos($key,'_check')===false)
{
if ($_POST[$key.'_check']==2){$value=$_POST[$key.'_check'];}
$qry="INSERT `values` SET `name`='".$key."',`value`='".$value."'";
mysqli_query($db,$qry);
}
}
header('location: setup.php');
exit();
}
sr_header("Настройки"); // Output page title and title | Вывод титул и заголовок страницы
?>
<form method="post">
<?
$a=explode("\n",$GLOBALS['sets']);
for ($i=0; $i<count($a);$i++)
{
if ($b=trim($a[$i]))
{
$b=explode(';',$b);
$c=explode(':',$b[0]);
if ($c[1]<>'')
{
$name=$c[0].'['.$c[1].']';
$data=$GLOBALS['set_data'][$c[0]][$c[1]];
}
else
{
$name=$b[0];
$data=$GLOBALS['set_data'][$b[0]];
}
if ($b[0]=='---')
{
if ($b[1])
{
?>
<h2><?=$b[1]?></h2>
<?
}
else
{
echo '<hr>';
}
}
else
{
echo auto_field($b[1],$name,$b[2],$b[0],$data,$b[3]).'<br>';
}
}
}
?>
<br>
<input type="submit" name="submit" value="Сохранить" style="padding: 10px;">
</form>
<?
sr_footer();
?>