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
110
111
112
113
|
<?php include_once ("webadmin/configure.php"); set_time_limit(0);
if($_GET["for"] == "config"){ $lastupdate = $_POST["lastupdate"];
$sql = "select * from config order by lastupdate DESC limit 1"; $parameters = array(); if (!($sth = $dbh->prepare($sql))) { throw new Exception('[' . $sth->errorCode() . ']: ' . print_r($sth->errorInfo())); }
if (!$sth->execute($parameters)) { throw new Exception('[' . $sth->errorCode() . ']: ' . print_r($sth->errorInfo())); } $result = $sth->fetch(PDO::FETCH_ASSOC);
if($result["lastupdate"] != $lastupdate){ $_SESSION["config_lastupdate"] = $result["lastupdate"];
//need to pass updated data $sql = "select * from config where deleted = 0 order by id ASC"; $parameters = array(); if (!($sth = $dbh->prepare($sql))) { throw new Exception('[' . $sth->errorCode() . ']: ' . print_r($sth->errorInfo())); }
if (!$sth->execute($parameters)) { throw new Exception('[' . $sth->errorCode() . ']: ' . print_r($sth->errorInfo())); }
$config_info = $sth->fetchAll();
echo json_encode($config_info); } }else if($_GET["for"] == "slideshow"){ $lastupdate = $_POST["lastupdate"];
$sql = "select * from slideshow order by lastupdate DESC limit 1"; $parameters = array(); if (!($sth = $dbh->prepare($sql))) { throw new Exception('[' . $sth->errorCode() . ']: ' . print_r($sth->errorInfo())); }
if (!$sth->execute($parameters)) { throw new Exception('[' . $sth->errorCode() . ']: ' . print_r($sth->errorInfo())); } $result = $sth->fetch(PDO::FETCH_ASSOC);
if($result["lastupdate"] != $lastupdate){ $_SESSION["slideshow_lastupdate"] = $result["lastupdate"]; //need to pass updated data $sql = "select * from slideshow where status = 1 and deleted = 0 order by sort ASC"; $parameters = array(); if (!($sth = $dbh->prepare($sql))) { throw new Exception('[' . $sth->errorCode() . ']: ' . print_r($sth->errorInfo())); }
if (!$sth->execute($parameters)) { throw new Exception('[' . $sth->errorCode() . ']: ' . print_r($sth->errorInfo())); }
$all_slideshow_info = $sth->fetchAll();
$content = ""; foreach($all_slideshow_info as $row){
$content .= '<div class="item"> <div class="slideshow_img" style="background: url(images/slideshow/' . $row{"slideimg_" . $_SESSION["langcode"]} . ') center center no-repeat; background-size:contain;"></div> </div>'; }
echo $content; } } else if($_GET["for"] == "rolling_text"){ $lastupdate = $_POST["lastupdate"];
$sql = "select * from rolling_text order by lastupdate DESC limit 1"; $parameters = array(); if (!($sth = $dbh->prepare($sql))) { throw new Exception('[' . $sth->errorCode() . ']: ' . print_r($sth->errorInfo())); }
if (!$sth->execute($parameters)) { throw new Exception('[' . $sth->errorCode() . ']: ' . print_r($sth->errorInfo())); } $result = $sth->fetch(PDO::FETCH_ASSOC);
if($result["lastupdate"] != $lastupdate){ $_SESSION["rolling_text_lastupdate"] = $result["lastupdate"]; //need to pass updated data $sql = "select * from rolling_text where status = 1 and deleted = 0 order by sort ASC"; $parameters = array(); if (!($sth = $dbh->prepare($sql))) { throw new Exception('[' . $sth->errorCode() . ']: ' . print_r($sth->errorInfo())); }
if (!$sth->execute($parameters)) { throw new Exception('[' . $sth->errorCode() . ']: ' . print_r($sth->errorInfo())); }
$all_rolling_text_info = $sth->fetchAll();
$content = ""; foreach($all_rolling_text_info as $row){ $content .= '<li>' . $row{"content_".$_SESSION["langcode"]} . '</li>'; }
echo $content; } }
|