Example #1
0
<?php

$timeStart = microtime(true);
session_start();
if (empty($_SESSION)) {
    exit(header("Location: ../../index.php"));
}
require_once $_SESSION['File_Root'] . '/Kernel/Include.php';
require_once $_SESSION['File_Root'] . '/HTML/Header.php';
require_once 'Functions/SQL.php';
redirectToLogin($accountID, $linkRoot);
redirectToBattle($verifyBattle, $linkRoot);
hasAdmin($accountAccess);
if (isset($_POST['Edit'])) {
    $configurationName = htmlspecialchars(addslashes($_POST['configurationName']));
    $configurationPresentation = htmlspecialchars(addslashes($_POST['configurationPresentation']));
    $configurationAccess = htmlspecialchars(addslashes($_POST['configurationAccess']));
    updateConfiguration($bdd, $confName, $confPresentation, $confAccess);
    exit(header("Location: {$linkRoot}/Admin/index.php"));
}
require_once $_SESSION['File_Root'] . '/HTML/Footer.php';
        if ($passwd == '') {
            $error[] = "パスワードを正しく入力してください";
        }
        if ($email == '' || !preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\\._-]+)+\$/", $email)) {
            $error[] = "メールアドレスを正しく入力してください";
        }
        if ($log != 'true' && $log != 'false') {
            $error[] = "ログ機能を正しく選択してください";
        }
        if (count($error) == 0) {
            $success = "登録が成功しました";
            updateConfiguration("", "ZAIKOROBOT_ENABLE", $enable);
            updateConfiguration("", "ZAIKOROBOT_USERID", $id);
            updateConfiguration("", "ZAIKOROBOT_PASSWORD", $passwd);
            updateConfiguration("", "ZAIKOROBOT_EMAIL", $email);
            updateConfiguration("", "ZAIKOROBOT_LOG", $log);
            if ($log == 'true') {
                $sql = "create table if not exists " . FILENAME_ZAIKOROBOT_LOGS . " (\n                  zaikorobot_logs_id int(11) auto_increment\n                 ,from_zaikorobot    text\n                 ,to_zaikorobot      text\n                 ,date_added         datetime\n                 ,primary key (zaikorobot_logs_id)\n                )";
                $db->Execute($sql);
            }
        }
        break;
}
function updateConfiguration($title, $key, $value)
{
    global $db;
    $result = $db->Execute("select * from " . TABLE_CONFIGURATION . " where configuration_key = '" . zen_db_input($key) . "'");
    if ($result->EOF) {
        $sql_data_array = array('configuration_title' => $title, 'configuration_key' => $key, 'configuration_value' => $value, 'configuration_description' => '', 'configuration_group_id' => 0, 'sort_order' => 0, 'last_modified' => 'now()', 'date_added' => 'now()');
        zen_db_perform(TABLE_CONFIGURATION, $sql_data_array);
    } else {