Exemple #1
0
/**
 * debug_array() - Formatted display of an array
 */
function debug_array($array, $name = '')
{
    ob_start();
    if ($name != '') {
        echo "{$name} = ";
    }
    print_r($array);
    debug_out(ob_get_clean());
}
 function post_xhr()
 {
     if (eregi('^/login/*', $_SERVER['REQUEST_URI'])) {
         $action = $_GET['action'];
         if ($action == 'login') {
             $user = stripslashes(trim($_POST['user']));
             $pass = stripslashes(trim($_POST['pass']));
             if (empty($user)) {
                 echo '用户名不能为空';
                 exit;
             }
             if (empty($pass)) {
                 echo '密码不能为空';
                 exit;
             }
             $md5pass = md5($pass);
             $query = mysql_query("select * from user where username='******'");
             debug_out("user is " . $user . " query is : " . $query);
             $us = is_array($row = mysql_fetch_array($query));
             $ps = $us ? $md5pass == $row['password'] : FALSE;
             debug_out("query is " . $row[0]);
             if ($ps) {
                 $counts = $row['login_counts'] + 1;
                 $_SESSION['user'] = $row['username'];
                 $_SESSION['login_time'] = $row['login_time'];
                 $_SESSION['login_counts'] = $counts;
                 $ip = "";
                 //get_client_ip();
                 $logintime = mktime();
                 $rs = mysql_query("update user set login_time='{$logintime}',login_ip='{$ip}',login_counts='{$counts}'");
                 if ($rs) {
                     //echo '1';exit;
                     $arr['success'] = 1;
                     $arr['msg'] = '登录成功!';
                     $arr['user'] = $_SESSION['user'];
                     $arr['login_time'] = date('Y-m-d H:i:s', $_SESSION['login_time']);
                     $arr['login_counts'] = $_SESSION['login_counts'];
                 } else {
                     $arr['success'] = 0;
                     $arr['msg'] = '登录失败';
                 }
             } else {
                 $arr['success'] = 0;
                 $arr['msg'] = '登录失败';
             }
             echo json_encode($arr);
         } elseif ($action == 'logout') {
             unset($_SESSION);
             session_destroy();
             echo '1';
         }
     }
 }
 function post_xhr()
 {
     global $mydb;
     if (eregi('^/api/picasa/save_albums.*', $_SERVER['REQUEST_URI'])) {
         echo $_POST['albums'];
         $albumsArray = $_POST['albums'];
         $albums = json_decode($albumsArray, true);
         $rows = count($albums);
         for ($i = 0; $i < $rows; $i++) {
             $al_id = $albums[$i]['al_id'];
             $al_num = $albums[$i]['al_num'];
             $al_title = $albums[$i]['al_title'];
             $al_feature = $albums[$i]['al_feature'];
             $str = 'INSERT INTO albums ( al_id, al_num, al_title, al_feature) VALUES ("' . $al_id . '",' . $al_num . ',"' . $al_title . '","' . $al_feature . '")';
             //$str = 'call save_picasa_albums("'+ $al_id +'",'+ $al_num +',"'+ $al_title +'","'+ $al_feature +'")';
             $mydb->query($str);
         }
     }
     if (eregi('^/api/picasa/save_photos.*', $_SERVER['REQUEST_URI'])) {
         //echo $_POST['photos'];
         $photosArray = $_POST['photos'];
         $photos = json_decode($photosArray, true);
         $rows = count($photos);
         for ($i = 0; $i < $rows; $i++) {
             $ph_id = $photos[$i]['ph_id'];
             $ph_width = $photos[$i]['ph_width'];
             $ph_height = $photos[$i]['ph_height'];
             $ph_type = $photos[$i]['ph_type'];
             $ph_src = $photos[$i]['ph_src'];
             $ph_title = $photos[$i]['ph_title'];
             $str = 'INSERT INTO photos ( ph_id, ph_width, ph_height, ph_type, ph_src, ph_title) VALUES ("' . $ph_id . '",' . $ph_width . ',' . $ph_height . ',"' . $ph_type . '","' . $ph_src . '","' . $ph_title . '")';
             //$str = 'call save_picasa_photos("'. $ph_id . '",' . $ph_width . ',' . $ph_height . ',"' . $ph_type .'","' . $ph_src . '","' . $ph_title . '")';
             debug_out("ithem: " . $i . $str);
             $mydb->query($str);
         }
     }
     // -----------------------------------------------------------------------
     // follow is add for front query picasa albums and photos ,  20150623
     if (eregi('^/api/picasa/query_albums.*', $_SERVER['REQUEST_URI'])) {
         $str = "select * from albums";
         $mydb->query($str);
         $albums = $mydb->get_results(null, OBJECT);
         echo json_encode($albums);
         //$len = $albums.length;
         //debug_out("query albums is: ".json_encode($albums));
     }
 }
Exemple #4
0
function main_control()
{
    // These globals are used in the HTML template
    global $current_player, $history;
    global $heading, $name_white, $name_black;
    global $show_command_form, $flip_board;
    global $preset_from_value, $preset_to_value, $id_focus;
    global $chess_board_markup, $history_markup, $promotion_dialog_markup;
    global $board_encoded, $game_title, $turn_nr;
    global $history_next, $history_prev;
    global $href_this, $href_player, $href_flip;
    global $game_state_link, $hmw_home_link;
    // Initialize a bit
    $promotion_popup = false;
    //...NYI Show pawn promotion dialog
    $show_command_form = true;
    // Show the move input dialog
    $game_status = IN_PROGRESS;
    // The game has not ended yet
    $heading = '';
    // "White's move" caption
    $game_title = '';
    // Current game info for page title
    $game_state_link = '';
    // "Send this link"-link ..
    $hmw_home_link = '';
    // .. corrected for my stupid router
    //... Remember an initial double move of a pawn
    $get_en_passant = get_parameter(GET_EN_PASSANT);
    $new_en_passant = '';
    // Retreive GET data
    $flip_board = isset($_GET[GET_FLIP_BOARD]);
    $history = get_parameter(GET_HISTORY);
    $goto = get_parameter(GET_GOTO);
    $name_white = get_parameter(GET_WHITE, DEFAULT_NAME_WHITE);
    $name_black = get_parameter(GET_BLACK, DEFAULT_NAME_BLACK);
    if (get_parameter(GET_PLAYER, GET_WHITE) != GET_WHITE) {
        //  &player  set, but not to "white", is taken as "black"
        $current_player = BLACKS_MOVE;
    } else {
        $current_player = WHITES_MOVE;
    }
    // Load base positions of pieces
    $base_array = decode_board(get_parameter(GET_BASE_BOARD, INITIAL_BOARD_CODED));
    // Trace history (Reconstruct the current board from initial positions)
    //...list( $board_array, $tie_info ) = decode_history(
    $board_array = decode_history($base_array, $history, $goto);
    // Execute given command
    // Retreive FORM input
    // Move: "from" and "to" must be field names
    // Edit: "from" must be the code character for a piece and "to" a field
    $clickable = $selected = array();
    $redirect_after_move = false;
    $cmd_piece = get_parameter(GET_FROM);
    $cmd_from = strtoupper(get_parameter(GET_FROM));
    // Retreive commands
    $cmd_to = strtoupper(get_parameter(GET_TO));
    if ($cmd_from == $cmd_to) {
        // Deselect a piece
        $cmd_from = $cmd_to = '';
    }
    if ($cmd_from == '') {
        $cmd_to = '';
    }
    // Never allow only TO command
    // Exec: Editor
    if (strlen($cmd_from) == 1 && valid_field_name($cmd_to)) {
        if (strpos(WHITE_PIECES . BLACK_PIECES, $cmd_from) !== false) {
            list($row, $col) = field_to_rowcol($cmd_to);
            if ($base_array[$row][$col] == $cmd_piece) {
                // Delete existing piece
                $base_array[$row][$col] = '';
            } else {
                if ($base_array[$row][$col] == '') {
                    // Add new piece
                    $base_array[$row][$col] = $cmd_piece;
                }
            }
            #$base_array = $board_array;
            $redirect_after_move = true;
        }
        // No other commands with FROM being only one char.
        $cmd_from = $cmd_to = '';
    }
    // Make sure, no invalid data is being processed as a move
    if (!valid_field_name($cmd_from)) {
        $cmd_from = '';
    }
    if (!valid_field_name($cmd_to)) {
        $cmd_to = '';
    }
    // Exec: Move
    if ($cmd_from != '' && $cmd_to != '') {
        $turn_nr = i_to_round($history);
        if ($turn_nr - floor($turn_nr) == 0.5) {
            $turn_nr = floor($turn_nr);
            $color = 'Black';
        } else {
            $color = 'White';
        }
        debug_out($_SERVER['REMOTE_ADDR'] . " - {$name_white} vs. {$name_black}, {$turn_nr}, {$color}: {$cmd_from} - {$cmd_to}\n");
        list($f_row, $f_col) = field_to_rowcol($cmd_from);
        list($t_row, $t_col) = field_to_rowcol($cmd_to);
        list($clickable, $selected) = select_piece($board_array, $current_player, $cmd_from, $get_en_passant);
        // Check if it is our//... piece (or a piece at all)
        if (!in_array($cmd_from, $clickable)) {
            die("Error: clickable[{$f_row}][{$f_col}] empty.");
        }
        if (!in_array($cmd_to, $clickable)) {
            // Capturing a piece!
            echo "Capture! clickable = ";
            print_r($clickable);
            die;
        }
        // En passant
        $piece = $board_array[$f_row][$f_col];
        if ($piece == 'P' && $f_row == 1 || $piece == 'p' && $f_row == 6) {
            if ($t_row == 3 || $t_row == 4) {
                $get_en_passant = chr(ord('A') + $f_col);
            }
        }
        if ($piece == 'P' && $t_row - $f_row == +1 || $piece == 'p' && $t_row - $f_row == -1 || $piece != 'P' && $piece != 'p') {
            $get_en_passant = '';
        }
        // Promotion
        if ($piece == 'P' && $t_row == 7 || $piece == 'p' && $t_row == 0) {
            $href_this = update_href($href_this, GET_PROMOTE, chr(ord('A') + $t_col));
            $promotion_popup = true;
            $heading = 'Promote your pawn to:';
            $board_array = apply_move($board_array, $f_row, $f_col, $t_row, $t_col);
        }
        // New move applied, prepare for fresh move
        $clickable = $selected = array();
        $cmd_from = $cmd_to = '';
        // Fall through to NO COMMAND mode
        $current_player = !$current_player;
        $history .= encode_move($f_row, $f_col, $t_row, $t_col);
        // We changed the board, but the user's browser still shows the
        // move command in its address bar. An HTTP redirect is used to
        // update that address, but the URL is not determined yet
        if (!$promotion_popup) {
            $redirect_after_move = true;
        }
    }
    // Exec: Deselect, continuation of fall throughs above
    if ($cmd_from == '' && $cmd_to == '') {
        $clickable = find_movable_pieces($board_array, $current_player);
        // Get rid of moves with king in check afterwards
        $new = array();
        foreach ($clickable as $from_field) {
            // Get two arrays (clickable, selected)
            $temp = select_piece($board_array, $current_player, $from_field);
            // Ignore moves with only one "deselection entry"
            if (count($temp[0]) > 1) {
                $new[] = $from_field;
            }
        }
        $clickable = $new;
        if (count($clickable) == 0) {
            if (king_in_check($board_array, $current_player)) {
                $heading = HEADING_CHECK_MATE;
                $game_status = $current_player != WHITES_MOVE ? WHITE_WINS : BLACK_WINS;
            } else {
                $heading = HEADING_STALE_MATE;
                $game_status = NOONE_WINS;
            }
        }
    }
    // Exec: Select piece
    if ($cmd_from != '' && $cmd_to == '' && $goto == '') {
        list($clickable, $selected) = select_piece($board_array, $current_player, $cmd_from);
        $heading = 'Select target';
    }
    // Prepare move command form
    $preset_from_value = $cmd_from;
    $preset_to_value = $cmd_to;
    $id_focus = $preset_from_value == '' ? 'idFrom' : 'idTo';
    // Generate links for main menu and board markup (pieces)
    $board_encoded = encode_board($base_array);
    // Name parameter as code for who's player's term this is
    $p = $current_player == WHITES_MOVE ? GET_WHITE : GET_BLACK;
    $href_this = update_href();
    // get base link
    $href_this = update_href($href_this, GET_FROM, $preset_from_value);
    $href_this = update_href($href_this, GET_TO, $preset_to_value);
    $href_this = update_href($href_this, GET_PLAYER, $p);
    $href_this = update_href($href_this, GET_HISTORY, $history);
    $href_this = update_href($href_this, GET_WHITE, $name_white);
    $href_this = update_href($href_this, GET_BLACK, $name_black);
    $href_this = update_href($href_this, GET_EN_PASSANT, $get_en_passant);
    $href_this = update_href($href_this, GET_BASE_BOARD, $board_encoded);
    if ($flip_board) {
        $href_this = update_href($href_this, GET_FLIP_BOARD, '');
        $href_flip = update_href($href_this, GET_FLIP_BOARD, REMOVE_FROM_LINK);
    } else {
        $href_flip = update_href($href_this, GET_FLIP_BOARD, '');
    }
    if ($current_player == BLACKS_MOVE) {
        $href_player = update_href($href_this, GET_PLAYER, GET_WHITE);
    } else {
        $href_player = update_href($href_this, GET_PLAYER, GET_BLACK);
    }
    // HTTP redirect?
    if (!false && $redirect_after_move) {
        if (DEBUG) {
            #die( "Continue: <a href='$href_this'>$href_this</a>" );
        }
        // Game state has been updated. In case of an executed move,
        // the browser needs to reload the page with the updated URL:
        header('HTTP/1.0 303 Found');
        header('Location: ' . htmlspecialchars_decode($href_this));
        die;
    }
    // Create HTML markup
    // History
    $history_markup = history_markup($base_array, $history, $href_this, $name_white, $name_black, $game_status);
    // Promotion
    if ($promotion_popup) {
        $promotion_dialog_markup = promotion_dialog_markup($href_this, $current_player, $t_row, $t_col, $history);
        $clickable = $selected = array();
    } else {
        $promotion_dialog_markup = '';
    }
    // Board
    if (STEADY_BOARD && $current_player == BLACKS_MOVE) {
        //... GET switch
        $flip_board = !$flip_board;
    }
    if (isset($_GET[GET_GOTO])) {
        $clickable = $selected = array();
    } else {
        if ($history > '' && $cmd_from == $cmd_to) {
            if (substr($history, -4, 1) == '(') {
                // Skip promotion
                $selected[] = decode_field(substr($history, -3, 1));
                $selected[] = decode_field(substr($history, -6, 1));
            } else {
                // Normal move
                $selected[] = decode_field(substr($history, -2, 1));
                $selected[] = decode_field(substr($history, -1, 1));
            }
        }
    }
    $chess_board_markup = chess_board_markup($href_this, $board_array, $clickable, $selected, $current_player, $flip_board);
    // If no heading was set above, say who's next
    if ($goto != '') {
        $current_player = $goto % 2 != 0;
    }
    if ($heading == '') {
        $heading = $current_player ? $name_white : $name_black;
        $heading = ucfirst($heading) . "'";
        if (substr($heading, -2, 1) != 's') {
            $heading .= 's';
        }
        $heading .= ' move';
    }
    if (king_in_check($board_array, $current_player) && strpos($heading, 'mate') === false) {
        $heading .= ' - <strong>Check!</strong>';
    }
    if ($goto != '') {
        $turn_nr = goto_to_round($history, $goto);
        $heading = "Round {$turn_nr}, {$heading}";
    }
    $heading = get_parameter(GET_COMMENT, $heading);
    // Game title
    if (isset($_GET[GET_WHITE])) {
        $turn_nr = i_to_round($history);
        $game_title = "{$name_white} vs. {$name_black} - Turn #{$turn_nr} - ";
    }
    $turn_nr = floor($turn_nr);
    // History links
    $next_goto = ($goto + 1) % (count_moves($history) + 1);
    $history_next = update_href($href_this, GET_GOTO, $next_goto);
    $next_goto = ($goto + count_moves($history)) % (count_moves($history) + 1);
    $history_prev = update_href($href_this, GET_GOTO, $next_goto);
    // Links for copy and paste
    if (!isset($_GET[GET_NEW_GAME]) && !isset($_GET[GET_BASE_BOARD]) && isset($_SERVER['HTTP_REFERER']) && $_SERVER['QUERY_STRING'] != '' && $cmd_from == '' && $cmd_to == '') {
        // Empty referer: Not reached by clicking a link in the browser
        $t = str_replace('&amp;', '&', $href_this);
        $game_state_link = str_replace(' ', '+', $t);
        $home_IPs = array('192.168.14.1', '213.47.94.176', 'local.at');
        foreach ($home_IPs as $ip_address) {
            if (strpos($game_state_link, $ip_address) !== false) {
                $hmw_home_link = str_replace($ip_address, 'harald.ist.org/home', $game_state_link);
            }
        }
        if ($hmw_home_link != '') {
            $game_state_link = $hmw_home_link;
        }
        $game_state_link = str_replace('flip&', '', $game_state_link);
        $game_state_link = str_replace('&', '&amp;', $game_state_link);
    }
    debug_out("board_encoded = {$board_encoded}\n");
}
Exemple #5
0
        bank_add($allbet);
        while (true) {
            $map = generate_randmap();
            $win = summ_map($map, $numbers);
            if ($win !== null and $win * $allbet < winlimit()) {
                break;
            }
        }
        $allwin = $win * $allbet;
        mysql_query("INSERT INTO stat_game VALUES('NULL','" . date("d.m.y") . "','" . date("H:i:s") . "','" . $l . "','" . cash_balance($l) . "','" . $allbet . "','" . $allwin . "','Stars Keno')");
        if ($allwin > 0) {
            cash_add($l, $allwin);
            bank_pay($allwin);
            echo "&RESULT=OK" . "&NUMBERS=" . implode("|", $map) . "&PAYOUT=" . $allwin . "&BALANCE=" . cash_balance($l);
        } else {
            //include( "../../par_prog.php" );
            echo "&RESULT=OK" . "&NUMBERS=" . implode("|", $map) . "&PAYOUT=0" . "&BALANCE=" . cash_balance($l);
        }
        //RESULT
        //BET
        //NUMBERS
        //BALANCE
        //PAYOUT
        //echo "&RESULT=OK&NUMBERS=1|2|3|4|5|6|7|8|9|10&PAYOUT=1";
        break;
    case "MOVE":
        echo "&RESULT=NOT_IMPL_MOVE&BALANCE=" . cash_balance($l);
        break;
}
debug_out("end\r\n================\r\n");
/**
 * piece_glyph()
 */
function piece_glyph($piece, $class = 'glyph')
{
    $ret = '';
    if (USE_UNICODE_GLYPHS) {
        switch ($piece) {
            case 'P':
                $ret .= '&#9817;';
                break;
            case 'S':
                // Fall through: Not yet moved white rook
            // Fall through: Not yet moved white rook
            case 'R':
                $ret .= '&#9814;';
                break;
            case 'N':
                $ret .= '&#9816;';
                break;
            case 'B':
                $ret .= '&#9815;';
                break;
            case 'Q':
                $ret .= '&#9813;';
                break;
            case 'L':
                // Fall through: Not yet moved white king
            // Fall through: Not yet moved white king
            case 'K':
                $ret .= '&#9812;';
                break;
            case 'p':
                $ret .= '&#9823;';
                break;
            case 's':
                // Fall through: Not yet moved black rook
            // Fall through: Not yet moved black rook
            case 'r':
                $ret .= '&#9820;';
                break;
            case 'n':
                $ret .= '&#9822;';
                break;
            case 'b':
                $ret .= '&#9821;';
                break;
            case 'q':
                $ret .= '&#9819;';
                break;
            case 'l':
                // Fall through: Not yet moved black king
            // Fall through: Not yet moved black king
            case 'k':
                $ret .= '&#9818;';
                break;
            default:
                debug_out("generate_markup: piece_glyph: ");
                debug_out("Unknown piece code: {$piece}\n");
                return '?';
        }
    } else {
        $ret = $piece;
    }
    return $ret;
}
Exemple #7
0
// Constant values, signal names
include 'movement_rules.php';
// Find fields a piece can move to
include 'url_helpers.php';
//  update_href() , etc.
include 'generate_markup.php';
// Output to HTML
include 'game_logic.php';
// Main game control
main_control();
// see  game_logic.php
$cpu_mhz = substr(trim(shell_exec('grep MHz /proc/cpuinfo | head -n 1')), 11);
$cpu_mhz = round($cpu_mhz * 100) / 100;
$elapsed_ms = round((microtime(true) - $start_time) * 100000) / 100;
$cycles = round($elapsed_ms / 100 * $cpu_mhz) / 10;
debug_out("<span class=\"time\">{$elapsed_ms}ms@{$cpu_mhz}MHz={$cycles}Mc</span>");
/******************************************************************************
* OUTPUT TO BROWSER - after  main_control()  returns, markup is built and sent
******************************************************************************/
////////////////////////////////////////////////////////////// COMMON HEADER
?>
<!DOCTYPE html><html id="top" lang="en"><head><meta charset="utf-8">
<title><?php 
echo $game_title;
echo $PROGRAM_NAME;
?>
 - <?php 
echo $VERSION;
?>
</title>
<meta name="author" content="Harald Markus Wirth, http://harald.ist.org/">
Exemple #8
0
 function post_xhr()
 {
     global $mydb;
     debug_out("now i in Post_xhr");
     if (eregi('^/api/picasa/save_albums.*', $_SERVER['REQUEST_URI'])) {
         echo $_POST['albums'];
         //$json = '{"a":1,"b":2,"c":3,"d":4,"e":5}';
         // echo $json;
         $albumsArray = $_POST['albums'];
         $albums = json_decode($albumsArray, true);
         $rows = count($albums);
         for ($i = 0; $i < $rows; $i++) {
             $al_id = $albums[$i]['al_id'];
             $al_num = $albums[$i]['al_num'];
             $al_title = $albums[$i]['al_title'];
             $al_feature = $albums[$i]['al_feature'];
             $str = 'INSERT INTO albums ( al_id, al_num, al_title, al_feature) VALUES ("' . $al_id . '",' . $al_num . ',"' . $al_title . '","' . $al_feature . '")';
             $mydb->query($str);
         }
     }
     if (eregi('^/api/picasa/save_photos.*', $_SERVER['REQUEST_URI'])) {
         //echo $_POST['photos'];
         $photosArray = $_POST['photos'];
         $photos = json_decode($photosArray, true);
         $rows = count($photos);
         for ($i = 0; $i < $rows; $i++) {
             $ph_id = $photos[$i]['ph_id'];
             $ph_width = $photos[$i]['ph_width'];
             $ph_height = $photos[$i]['ph_height'];
             $ph_type = $photos[$i]['ph_type'];
             $ph_src = $photos[$i]['ph_src'];
             $ph_title = $photos[$i]['ph_title'];
             $str = 'INSERT INTO photos ( ph_id, ph_width, ph_height, ph_type, ph_src, ph_title) VALUES ("' . $ph_id . '",' . $ph_width . ',' . $ph_height . ',"' . $ph_type . '","' . $ph_src . '","' . $ph_title . '")';
             debug_out("ithem: " . $i . $str);
             $mydb->query($str);
         }
     }
 }
Exemple #9
0
 function get()
 {
     // Twig Test Code
     global $twig;
     //$template = $twig->loadTemplate('index.twig');
     //$template->display(array('name' => 'TWIG'));
     echo $twig->render('index.twig', array('name' => 'TWIG'));
     //echo "success";
     debug_out("Twig Test success");
 }
Exemple #10
0
include 'helpers.php';
// Debug and other small helper functions
include 'definitions.php';
// Constant values, signal names
include 'movement_rules.php';
// Find fields a piece can move to
include 'url_helpers.php';
//  update_parameters() , etc.
include 'generate_markup.php';
// Output to HTML
include 'game_logic.php';
// Main game control
main_control();
// see  game_logic.php
$elapsed_seconds = round((microtime(true) - $start_time) * 100000) / 100;
debug_out("<span class=\"time\">Time = {$elapsed_seconds}ms</span>");
/******************************************************************************
* OUTPUT TO BROWSER - after  main_control()  returns, markup is built and sent
******************************************************************************/
////////////////////////////////////////////////////////////// COMMON HEADER
?>
<!DOCTYPE html><html id="top" lang="en"><head><meta charset="utf-8">
<title><?php 
echo $game_title;
echo $PROGRAM_NAME;
?>
 - <?php 
echo $VERSION;
?>
</title>
<meta name="author" content="Harald Markus Wirth, http://harald.ist.org/">
Exemple #11
0
function change_user($login, $realname, $password)
{
    $dbh =& get_db();
    if ($password != '') {
        $stmt = $dbh->prepare('UPDATE users SET realname=:realname, password=SHA1(:password) WHERE LOWER(login)=LOWER(:login)');
        debug_out("UPDATE users SET realname={$realname}, password=SHA1({$password}) WHERE LOWER(login)=LOWER({$login})");
        $stmt->bindParam(':realname', $realname);
        $stmt->bindParam(':password', $password);
        $stmt->bindParam(':login', $login);
    } else {
        $stmt = $dbh->prepare('UPDATE users SET realname=:realname WHERE LOWER(login)=LOWER(:login)');
        debug_out("UPDATE users SET realname={$realname} WHERE LOWER(login)=LOWER({$login})");
        $stmt->bindParam(':realname', $realname);
        $stmt->bindParam(':login', $login);
    }
    $stmt->execute();
    $stmt = null;
    $dbh = null;
}
Exemple #12
0
 public function footer($exit = 0)
 {
     global $allgAr;
     if ($this->ajax) {
         $this->json['headerAdds'] = $this->headerAdds;
         $this->json['bodyendAdds'] = $this->bodyendAdds;
         $this->json['content'] = ob_get_clean();
         if (isset($allgAr['modrewrite']) and $allgAr['modrewrite'] == 1) {
             $this->json['content'] = self::rewriteLinks($this->json['content']);
         }
         echo json_encode($this->json);
         exit;
     }
     $this->html[1] = str_replace('</body>', $this->bodyendAdds . "\n</body>", $this->html[1]);
     echo '</div>' . $this->html[1];
     unset($this->html[1]);
     if (isset($allgAr['modrewrite']) and $allgAr['modrewrite'] == 1) {
         echo self::rewriteLinks(ob_get_clean());
     }
     if ($exit == 1) {
         if (DEBUG) {
             debug_out();
         }
         exit;
     }
 }
Exemple #13
0
 /**
  * 首页
  */
 public function index()
 {
     echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
     debug_out(HOST, WEB_ROOT, BASIC_PATH, APPHOST, $config, $_COOKIE, $_SESSION, $_SERVER);
 }
Exemple #14
0
require_once 'include/includes/config.php';
require_once 'include/includes/loader.php';
// Allgemeiner Konfig-Array
$allgAr = getAllgAr();
// Menu, Nutzerverwaltung und Seitenstatistik laden
$menu = new menu();
$m = $menu->get_complete();
user_identification($m);
// Sprachdateien oeffnen
load_global_lang();
load_modul_lang();
//Ajaxreload für Boxen
design::ajax_boxload();
site_statistic();
// Wartungsmodus
if ($allgAr['wartung'] == 1) {
    if (is_admin()) {
        @define('DEBUG', true);
        debug('Wartungsmodus aktiv !');
    } else {
        die($allgAr['wartungstext']);
    }
}
/* ENTWICKLUNGSVERSION SQL UPDATES */
require_once 'update/update.php';
// Modul oeffnen
require_once 'include/contents/' . $menu->get_url();
// Datenbank schließen
db_close();
debug_out();