/var/www/hkosl.com/dirsignage/html/ajax_main.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
<?php
    
include_once ("webadmin/configure.php");

    
$lastupdate_string $_POST["lastupdate_string"];

    
//checking table update time
    
$real_lastupdate_string "";
    
$sql "select lastupdate from company";
    
$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_info $sth->fetchAll();


    foreach(
$all_info as $this_info){
        
$real_lastupdate_string .= $this_info{"lastupdate"}." "
    }

    
$sql "select lastupdate from config";
    
$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_info $sth->fetchAll();

    foreach(
$all_info as $this_info){
        
$real_lastupdate_string .= $this_info{"lastupdate"}." ";
    }

    
$sql "select lastupdate from slideshow";
    
$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_info $sth->fetchAll();

    foreach(
$all_info as $this_info){
        
$real_lastupdate_string .= $this_info{"lastupdate"}." ";
    }

    if(
$lastupdate_string != $real_lastupdate_string){
        echo 
"1";
    }else{
        echo 
"2";
    }
?>