/var/www/hkosl.com/citysuper/webadmin/basic_info.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('configure.php');

    
//functions

    
if (!function_exists('random_string')) {
        function 
random_string($length 8)
        {
            
$chars         "abcdefghijkmnpqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ23456789abcdefghijkmnpqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ23456789";
            
$random_string substr(str_shuffle($chars), 0$length);
            return 
$random_string;
        }
    }


    if (!
function_exists('bind_pdo')) {
        function 
bind_pdo($sql$parameters NULL$action NULL)
        {
            global 
$dbh;

            if (
$action == "insert" || $action == "update" || $action == "delete" || empty($action)) {
                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()));
                }
            }

            if (
$action == "selectone") {
                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()));
                }

                return 
$sth->fetch(PDO::FETCH_ASSOC);

            }

            if (
$action == "selectall") {
                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()));
                }

                return 
$sth->fetchAll(PDO::FETCH_ASSOC);

            }


        }
    }

    function 
matched_option($data1$data2$type)
    {
        if (
$data1 == $data2) {
            if (
$type == "checkbox" || $type == "radiobutton") {
                return 
"checked";
            } else if (
$type == "select") {
                return 
"selected";
            } else {
            }

        }
    }

    if (!
function_exists('startsWith')) {
        function 
startsWith($haystack$needle)
        {
            
$length strlen($needle);
            return (
substr($haystack0$length) === $needle);
        }
    }

    if (!
function_exists('check_upload_path')) {
        function 
check_upload_path($img_file)
        {
            
$session_path_str  "/uploader/" $_SESSION['KCFINDER']['uploadURL'];
            
$session_path_long strlen($session_path_str);
            
$path_error        0;
            foreach (
$img_file as $key2 => $pathname) {
                if (
$key2 && $pathname) {
                    
$submit_path_str  substr($pathname0$session_path_long);
                    
$submit_path_long strlen($submit_path_str);
                    
$file             str_replace('..'''$pathname);
                    if (
$session_path_long <> $submit_path_long || $session_path_str <> $submit_path_str || !startsWith($file$session_path_str)) {
                        
$path_error 1;
                    }
                }
            }
        }
    }


    if (!
function_exists('get_site_info')) {
        function 
get_site_info()
        {
            
$sql        "SELECT * FROM site_info WHERE siteinfoid = ? ";
            
$parameters = array(1);
            
$site_info  bind_pdo($sql$parameters"selectone");

            return 
$site_info;
        }
    }

    
/*if (!function_exists('clean_data')) {
        function clean_data($data = array())
        {
            foreach ($data as $data_name => $data_value) {
                if (is_array($data_value)) {
                    clean_data($data_value);
                } else {
                    $_POST[$data_name] = htmlspecialchars($data_value, ENT_QUOTES);
                }
            }
        }
    }*/


    
$sql             "SELECT * FROM sys_lang WHERE langstatus = '1' ORDER BY langsort ASC ";
    
$lang_array_info bind_pdo($sqlNULL"selectall");
    foreach (
$lang_array_info as $lang_info) {
        
$arraylangcode[$lang_info{'langcode'}] = $lang_info{'langname'};
    }

    
//clean_data($_POST);