/var/www/hkosl.com/citysuper/magicinfo_index.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
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
<?php
    
require_once('webadmin/basic_info.php');

    
$sql       "select * from logo";
    
$logo_info bind_pdo($sqlNULL"selectone");

    
$sql         "select * from config where id = 1";
    
$config_info bind_pdo($sqlNULL"selectone");
?>

<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <title>City Super</title>
    <script type="text/javascript" src="js/jquery-1.11.1.min.js"></script>
    <script type="text/javascript" src="js/jquery-migrate-1.2.1.min.js"></script>
    <script type="text/javascript" src="js/jquery-ui-1.11.4/jquery-ui.min.js"></script>
    <link type="text/css" href="js/jquery-ui-1.11.4/jquery-ui.css" rel="stylesheet"/>
    <link rel="stylesheet" type="text/css" href="css/style.css"/>

    <script type="text/javascript">
        function startTime() {
            var today = new Date();
            var day = today.getDate();
            var month = parseInt(today.getMonth()) + 1;
            var year = today.getFullYear();
            var h = parseInt(today.getHours());
            var m = today.getMinutes();
            if (h >= 12) {
                if (h > 12) {
                    h = h - 12;
                }

                var am_pm = "pm";
            } else {
                var am_pm = "am";
            }

            m = checkTime(m);
            document.getElementById('current_time').innerHTML = day + "-" + month + "-" + year + "<br>" + h + " : " + m + " <div id='am_pm'>" + am_pm + "</div>";
            var t = setTimeout(function () {
                startTime()
            }, 1000);
        }

        function checkTime(i) {
            if (i < 10) {
                i = "0" + i
            }  // add zero in front of numbers < 10
            return i;
        }

        $(function () {
            startTime();
        });

    </script>

    <script>
        function get_latest_count() {
            
            if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
                xmlhttp = new XMLHttpRequest();
            }
            else {// code for IE6, IE5
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            xmlhttp.onreadystatechange = function () {
                if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
                    //document.getElementById("txtHint").innerHTML=xmlhttp.responseText;
                    //console.log(xmlhttp.responseText);
                    var result = $.trim(xmlhttp.responseText);

                    //console.log(result);

                    if (result != "" && result != null) {
                        var obj = JSON.parse(result);

                        if (obj.Response == "SUCCESS") {
                            var startno = obj.startno;
                            var endno = obj.endno;

                            $("#counting").html(startno);
                            $("#last_ticket").html(endno);

                        } else {
                            //alert("Fail.");
                        }
                    } else {
                        //alert("Fail.");
                    }

                    setTimeout(get_latest_count(), <?=$config_info{"config_value"}?>);

                }
            }
            xmlhttp.open("GET", "get_count_num.php", true);
            xmlhttp.send();
        }

        $(function () {
            get_latest_count();
        });
    </script>
</head>
<body id="magicinfo_index_body">

<div id="container">
    <div id="head_title">
        Now Serving<br>
        正在服務
    </div>

    <div id="content">
        <div id="counting"></div>

        <div id="last_serving">
            Last Serving

            <div style="text-align: right;">
                <div id="last_ticket"></div>
            </div>
        </div>


        <div id="current_time"></div>
    </div>

</div>

</body>
</html>