/var/www/hkosl.com/dashboard/webadmin/configure.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
<?php
    
if (session_id() === "") { session_start(); }

    
//new pdo

    
$dbh = new PDO("mysql:host=192.168.155.13;dbname=dashboard""admin""PHac7dru");


    
$dbh->exec("set names utf8");

    
date_default_timezone_set("Asia/Hong_Kong");

    
$nowdate date("Y-m-d H:i:s");


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


    
error_reporting(E_ALL);
    
ini_set('display_errors'0);


    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 "/web/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($pathname,0,$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;
                    }
                }
            }
        }
    }

    
$sql00 "SELECT * FROM sys_lang WHERE langstatus = '1' ORDER BY langsort ASC ";
    if (!(
$sth00 $dbh->prepare($sql00))) {
        throw new 
Exception('[' $sth00->errorCode() . ']: ' print_r($sth00->errorInfo()));
    }

    if (!
$sth00->execute()) {
        throw new 
Exception('[' $sth00->errorCode() . ']: ' print_r($sth00->errorInfo()));
    }

    while (
$row00 $sth00->fetch(PDO::FETCH_ASSOC)) {
        
$arraylangcode[$row00{'langcode'}] = $row00{'langname'};
    }