Beispiel #1
0
 public function mux($logged)
 {
     $session = new USession();
     $VIndex = new VIndex();
     switch ($VIndex->getController()) {
         case 'log':
             $CLog = new CLog();
             $log = $CLog->mux();
             if ($VIndex->getTask() == 'in' || $VIndex->getTask() == 'out') {
                 $VIndex->deleteController();
                 $VIndex->deleteTask();
                 return $this->setPage();
             } else {
                 return $log;
             }
         case 'rent':
             if ($logged >= 0) {
                 $CRent = new CRent();
                 return $CRent->mux();
             } else {
                 return $VIndex->fetch('forbidden_user.tpl');
             }
         case 'user':
             if ($logged >= 0) {
                 $CUser = new CUser();
                 return $CUser->mux();
             } else {
                 return $VIndex->fetch('forbidden_user.tpl');
             }
         case 'admin':
             if ($logged >= 1) {
                 $CAdmin = new CAdmin();
                 return $CAdmin->mux();
             } else {
                 return $VIndex->fetch('forbidden_admin.tpl');
             }
         case 'static':
             $CStatic = new CStatic();
             return $CStatic->mux($logged);
         default:
             $CStatic = new CStatic();
             return $CStatic->mux($logged);
     }
 }
}
if (!$bCronEnabled) {
    if ($oR3DCQuery->ELOIsActive()) {
        $oR3DCQuery->ELOCreateRatings();
    }
    $oR3DCQuery->MangeGameTimeOuts();
}
$txtUser = $_POST['txtUser'];
$txtPass = $_POST['txtPass'];
$cmdCloseAccount = $_POST['cmdCloseAccount'];
$txtMessage = "";
if ($cmdCloseAccount != "" && $txtUser != "" && $txtPass != "") {
    $UID = $oR3DCQuery->LoginTemp($txtUser, $txtPass);
    if ($UID != "") {
        //Instantiate the CAdmin Class
        $oAdmin = new CAdmin($config);
        $oAdmin->DisablePlayer($UID);
        $oAdmin->Close();
        unset($oAdmin);
        $txtMessage = GetStringFromStringTable("IDS_CHESS_CLOSE_TXT_1", $config);
    }
}
?>

<html>
<head>
<title><?php 
echo GetStringFromStringTable("IDS_PAGETITLES_33", $config);
?>
</title>
Beispiel #3
0
<?php

require_once __DIR__ . "/logic.php";
if (isset($_POST["login"]) && isset($_POST["password"])) {
    $username = post("login");
    $password = post("password");
    $r = CAdmin::login($username, $password);
    if ($r) {
        header("Location: /admin/index.php");
    }
}
if (CAdmin::checkLogin()) {
    header("Location: /admin/index.php");
}
?>

<!DOCTYPE html>
<html lang="en">
<meta charset="UTF-8">
<head>
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <link rel="stylesheet" href="css/bootstrap-theme.min.css">
</head>
<body>
<div class="container">

    <div class="jumbotron">
        <h3 class="center-block">Login</h3>
        <form method="post" accept-charset="UTF-8" enctype="application/x-www-form-urlencoded" autocomplete="off">
            <div class="form-group form-group-sm">
                <input type="text" class="form-control input-sm" id="inputLogin" placeholder="Login" name="login">
Beispiel #4
0
                $id = intval($v);
                if ($id > 0 && !is_array($v)) {
                    $ans = CAdmin::removeGroup($id);
                    echo $ans ? "OK" : "Can't remove group";
                    exit;
                } else {
                    exit;
                }
            } else {
                exit;
            }
            break;
        default:
            exit;
    }
}
$content = "<div class='container'><div class='page-header'> ";
$content = "<div class='panel'>\n<form class=\"form-inline toggle-disabled\" method='post'>\n  <div class=\"form-group\">\n    <label for=\"name\">Name</label>\n    <input type=\"text\" name='name' class=\"form-control valid\"  placeholder=\"Group name\"\n     data-validation-event='keyup'\n     data-validation=\"alphanumeric,required,length\"\n     data-validation-length=\"2-64\"\n     >\n  </div>\n  <button type='submit' class=\"btn btn-default\">Add Group</button>\n  <button class=\"btn btn-info media-right\" id='button-refresh-table'>Refresh Table</button>\n</form>\n<script>\n\$.validate({\n    modules :  'security, toggleDisabled',\n    disabledFormFilter : 'form.toggle-disabled',\n    onModulesLoaded : function() {\n        console.log('validators loaded');\n    }\n  });\n</script>\n</div>";
$content .= "<table class='table table-hover'>\n<thead>\n<tr>\n    <td>#</td>\n    <td>Group Name</td>\n    <td>Created</td>\n    <td></td>\n</tr>\n</thead>\n<tbody>";
$users = CAdmin::getGroupArray();
$i = 0;
foreach ($users as $name) {
    $i++;
    $date = date("d-m-Y", strtotime($name["created"]));
    $id = $name['id'];
    $actions = "<a href='#' class=\"glyphicon glyphicon-remove button_group_remove\" data-target='{$id}' aria-hidden=\"true\"  style=\"text-decoration: none\"/>";
    $content .= "<tr id='group-row-{$id}'><td>{$i}</td><td>{$name["name"]}</td><td>{$date}</td><td>{$actions}</td></tr>";
}
$content .= "</tbody></table>";
$content .= "</div></div>";
include "_main.html";
//Skin - standard includes
//////////////////////////////////////////////////////////////
$SSIfile = "./skins/" . $SkinName . "/standard_cfg.php";
if (file_exists($SSIfile)) {
    include $SSIfile;
}
//////////////////////////////////////////////////////////////
require $Root_Path . "bin/CR3DCQuery.php";
require $Root_Path . "bin/CTipOfTheDay.php";
require $Root_Path . "includes/siteconfig.php";
require $Root_Path . "includes/language.php";
require $Root_Path . "bin/CAdmin.php";
//////////////////////////////////////////////////////////////
//Instantiate the Classes
$oR3DCQuery = new CR3DCQuery($config);
$oAdmin = new CAdmin($config);
$bCronEnabled = $oR3DCQuery->IsCronManagementEnabled();
//////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////
//Check if the logged in user has access
if (!isset($_SESSION['sid']) && !isset($_SESSION['user']) && !isset($_SESSION['id'])) {
    $_SESSION['PageRef'] = $url;
    header('Location: ./chess_login.php');
} else {
    $oR3DCQuery->CheckSIDTimeout();
    if ($oR3DCQuery->CheckLogin($config, $_SESSION['sid']) == false) {
        $_SESSION['PageRef'] = $url;
        header('Location: ./chess_login.php');
    } else {
        $_SESSION['PageRef'] = "";
        $oR3DCQuery->UpdateSIDTimeout($ConfigFile, $_SESSION['sid']);
Beispiel #6
0
<div class="panel panel-default">
    <div class="panel-heading">Task list</div>
    <div class="panel-body">
        <table class="table table-bordered">
            <thead>
                <tr>
                    <td>#</td>
                    <td>Name</td>
                    <td>Type</td>
                    <td>Group</td>
                    <td>Action</td>
                </tr>
            </thead>
            <tbody id="task_list_table">
                ';
$tasks = CAdmin::getTaskArray();
$i = 0;
foreach ($tasks as $t) {
    $i++;
    $id = $t['id'];
    $name = $t['name'];
    $type = $t['type'];
    if (!isset($t['groups']) || $t['groups'] == null) {
        $group = 'Common task';
    } else {
        $group = $t['groups'];
    }
    $additional = $t['additional'];
    $delete_button = "<button class='btn btn-sm btn-danger delete-task-button' data-id='{$id}'>Delete</button>";
    $additional_button = "<button class='btn btn-sm btn-info' data-toggle='tooltip' data-placement='left' title='{$additional}'>See JSON</button>";
    $content .= "<tr><td>{$i}</td><td>{$name}</td><td>{$type}</td><td>{$group}</td><td>{$additional_button} {$delete_button} </td></tr>";
//Skin - standard includes
//////////////////////////////////////////////////////////////
$SSIfile = "../skins/" . $SkinName . "/standard_cfg.php";
if (file_exists($SSIfile)) {
    include $SSIfile;
}
//////////////////////////////////////////////////////////////
require $Root_Path . "bin/CR3DCQuery.php";
require $Root_Path . "bin/CAdmin.php";
require $Root_Path . "bin/config.php";
require $Root_Path . "includes/siteconfig.php";
require $Root_Path . "includes/language.php";
//////////////////////////////////////////////////////////////
//Instantiate the Classes
$oR3DCQuery = new CR3DCQuery($config);
$oAdmin = new CAdmin($config);
$bCronEnabled = $oR3DCQuery->IsCronManagementEnabled();
//////////////////////////////////////////////////////////////
////////////////////////////////////////////////
//Login Processing
////////////////////////////////////////////////
//Check if admin is logged in already
if (!isset($_SESSION['LOGIN'])) {
    $login = "******";
    header('Location: ./index.php');
} else {
    if ($_SESSION['LOGIN'] != true) {
        if (isset($_SESSION['UNAME'])) {
            unset($_SESSION['UNAME']);
        }
        if (isset($_SESSION['LOGIN'])) {
//Skin - standard includes
//////////////////////////////////////////////////////////////
$SSIfile = "../skins/" . $SkinName . "/standard_cfg.php";
if (file_exists($SSIfile)) {
    include $SSIfile;
}
//////////////////////////////////////////////////////////////
require $Root_Path . "bin/CR3DCQuery.php";
require $Root_Path . "bin/CAdmin.php";
require $Root_Path . "bin/config.php";
require $Root_Path . "includes/siteconfig.php";
require $Root_Path . "includes/language.php";
//////////////////////////////////////////////////////////////
//Instantiate the Classes
$oR3DCQuery = new CR3DCQuery($config);
$oAdmin = new CAdmin($config);
$bCronEnabled = $oR3DCQuery->IsCronManagementEnabled();
//////////////////////////////////////////////////////////////
////////////////////////////////////////////////
//Login Processing
////////////////////////////////////////////////
//Check if admin is logged in already
if (!isset($_SESSION['LOGIN'])) {
    $login = "******";
    header('Location: ./index.php');
} else {
    if ($_SESSION['LOGIN'] != true) {
        if (isset($_SESSION['UNAME'])) {
            unset($_SESSION['UNAME']);
        }
        if (isset($_SESSION['LOGIN'])) {
Beispiel #9
0
                $id = intval($v);
                if ($id > 0 && !is_array($v)) {
                    $ans = CAdmin::removeUser($id);
                    echo $ans ? "OK" : "Can't remove user";
                    exit;
                } else {
                    exit;
                }
            } else {
                exit;
            }
            break;
        default:
            exit;
    }
}
$content = "<div class='container'><div class='page-header'> ";
$content = "<div class='panel'>\n<form class=\"form-inline toggle-disabled\" method='post'>\n  <div class=\"form-group\">\n    <label for=\"name\">Name</label>\n    <input type=\"text\" name='username' class=\"form-control valid\" id=\"username\" placeholder=\"Jane Doe\"\n     data-validation-event='keyup'\n     data-validation=\"letternumeric,required,length\"\n     data-validation-length=\"3-32\"\n     >\n  </div>\n  <div class=\"form-group\">\n    <label for=\"p\">Password</label>\n    <input type=\"password\" name='password' class=\"form-control valid\" id=\"password\" placeholder=\"My Precious\"\n    data-validation-event='keyup'\n    data-validation=\"required,letternumeric\"\n    data-validation-error-msg='Only alphabetic chars and digits allowed'\n    >\n  </div>\n  <button type='submit' class=\"btn btn-default\">Add User</button>\n  <button class=\"btn btn-info media-right\" id='button-refresh-table'>Refresh Table</button>\n</form>\n<script>\n\$.validate({\n    modules :  'security, toggleDisabled',\n    disabledFormFilter : 'form.toggle-disabled',\n    onModulesLoaded : function() {\n        console.log('validators loaded');\n    }\n  });\n</script>\n</div>";
$content .= "<table class='table table-hover'>\n<thead>\n<tr>\n    <td>#</td>\n    <td>Username</td>\n    <td>Created</td>\n    <td></td>\n</tr>\n</thead>\n<tbody>";
$users = CAdmin::getUsersArray();
$i = 0;
foreach ($users as $u) {
    $i++;
    $date = date("d-m-Y", strtotime($u["created"]));
    $id = $u['id'];
    $actions = "<a href='#' class=\"glyphicon glyphicon-remove button_user_remove\" data-target='{$id}' aria-hidden=\"true\"  style=\"text-decoration: none\"/>";
    $content .= "<tr id='user-row-{$id}'><td>{$i}</td><td>{$u["name"]}</td><td>{$date}</td><td>{$actions}</td></tr>";
}
$content .= "</tbody></table>";
$content .= "</div></div>";
include "_main.html";
Beispiel #10
0
            $errors['captcha'] = 'Incorrect CAPTCHA code.';
        }
    }
    $_SESSION['user_ip'] = $_SERVER['REMOTE_ADDR'];
    $_SESSION['referer'] = BASE_URL;
    // validation
    if ($username == '') {
        $errors['username'] = '******';
    }
    if ($password == '') {
        $errors['password'] = '******';
    }
    // no errors, go to review page
    if (empty($errors)) {
        require_once APP_PATH . '_lib/class.Admin.php';
        $admin = new CAdmin();
        if ($admin->login($username, $password)) {
            $_SESSION['AdminId'] = $admin->getId();
            redirect_to(BASE_URL . 'home/');
            exit;
        } else {
            $errors['incorrect'] = 'Incorrect username or password';
            $smarty->assign('errors', $errors);
        }
    } else {
        $smarty->assign('errors', $errors);
    }
}
$template = 'login.tpl';
$smarty->assign('ENABLE_RECAPTCHA', $captcha_enabled);
if ($captcha_enabled) {
Beispiel #11
0
        $db = static::getDb();
        $s = $db->prepare($sql);
        $values = [':name' => $name, ':type_id' => $type_id, ':is_common' => $is_common ? 1 : 0, ':additional' => $additional];
        $s->execute($values);
        return $db->lastInsertId();
    }
    public static function addCommonTask($name, $type_id, $additional)
    {
        return static::addTask($name, $type_id, true, $additional);
    }
    public static function addTaskToGroup($name, $type_id, $group_id, $additional)
    {
        $task_id = static::addTask($name, $type_id, false, $additional);
        if (static::addTaskGroup($task_id, $group_id)) {
            return $task_id;
        } else {
            return ['id' => 0];
        }
    }
    private static function addTaskGroup($task_id, $group_id)
    {
        $s = static::execSql('INSERT INTO task_group VALUES (:t,:g)', [':t' => $task_id, ':g' => $group_id]);
        return $s->errorCode() == "00000";
    }
    public static function logout()
    {
        setcookie(static::LOGIN_COOKIE, '', time() - 3600, "/admin/");
    }
}
CAdmin::init();
Beispiel #12
0
                $id = intval($v);
                if ($id > 0 && !is_array($v)) {
                    $ans = CAdmin::removeTaskType($id);
                    echo $ans ? "OK" : "Can't remove task type";
                    exit;
                } else {
                    exit;
                }
            } else {
                exit;
            }
            break;
        default:
            exit;
    }
}
$content = "<div class='container'><div class='page-header'> ";
$content = "<div class='panel'>\n<form class=\"form-inline toggle-disabled\" method='post'>\n  <div class=\"form-group\">\n    <label for=\"name\">Name</label>\n    <input type=\"text\" name='name' class=\"form-control valid\"  placeholder=\"MAKEGODMINE\"\n     data-validation-event='keyup'\n     data-validation=\"alphanumeric,required,length\"\n     data-validation-length=\"2-64\"\n     >\n  </div>\n  <button type='submit' class=\"btn btn-default\">Add Task Type</button>\n  <button class=\"btn btn-info media-right\" id='button-refresh-table'>Refresh Table</button>\n</form>\n<script>\n\$.validate({\n    modules :  'security, toggleDisabled',\n    disabledFormFilter : 'form.toggle-disabled',\n    onModulesLoaded : function() {\n        console.log('validators loaded');\n    }\n  });\n</script>\n</div>";
$content .= "<table class='table table-hover'>\n<thead>\n<tr>\n    <td>#</td>\n    <td>Task Type Name</td>\n    <td>Created</td>\n    <td></td>\n</tr>\n</thead>\n<tbody>";
$users = CAdmin::getTaskTypeArray();
$i = 0;
foreach ($users as $u) {
    $i++;
    $date = date("d-m-Y", strtotime($u["created"]));
    $id = $u['id'];
    $actions = "<a href='#' class=\"glyphicon glyphicon-remove button_tt_remove\" data-target='{$id}' aria-hidden=\"true\"  style=\"text-decoration: none\"/>";
    $content .= "<tr id='tt-row-{$id}'><td>{$i}</td><td>{$u["name"]}</td><td>{$date}</td><td>{$actions}</td></tr>";
}
$content .= "</tbody></table>";
$content .= "</div></div>";
include "_main.html";
Beispiel #13
0
//Skin - standard includes
//////////////////////////////////////////////////////////////
$SSIfile = "../skins/" . $SkinName . "/standard_cfg.php";
if (file_exists($SSIfile)) {
    include $SSIfile;
}
//////////////////////////////////////////////////////////////
require $Root_Path . "bin/CR3DCQuery.php";
require $Root_Path . "bin/CAdmin.php";
require $Root_Path . "bin/config.php";
require $Root_Path . "includes/siteconfig.php";
require $Root_Path . "includes/language.php";
//////////////////////////////////////////////////////////////
//Instantiate the Classes
$oR3DCQuery = new CR3DCQuery($config);
$oAdmin = new CAdmin($config);
$bCronEnabled = $oR3DCQuery->IsCronManagementEnabled();
//////////////////////////////////////////////////////////////
////////////////////////////////////////////////
//Login Processing
////////////////////////////////////////////////
$uName = trim($_POST['txtName']);
$pWRD = trim($_POST['txtPassword']);
//Check if admin is logged in already
if (isset($_SESSION['LOGIN'])) {
    header('Location: ./admin_main.php');
} else {
    if ($oAdmin->AdminLogin($uName, $pWRD)) {
        $_SESSION['UNAME'] = $uName;
        $_SESSION['LOGIN'] = true;
        header('Location: ./admin_main.php');
Beispiel #14
0
             <button class="btn btn-default filter_button" id="button_filter_id">Go!</button>
           </span>
    </div>
    <div class="input-group">
        <span class="input-group-addon">IP</span>
        <input type="text" class="form-control" id="filter_ip" placeholder="192.0.*.* or 8.8.8.8" />
        <span class="input-group-btn">
             <button class="btn btn-default filter_button" id="button_filter_ip">Go!</button>
        </span>
    </div>
    <div class="input-group">
         <span class="input-group-addon">Country</span>
         <select class="form-control" id="filter_country">
             <option value="-1" disabled="disabled" selected>--Select one--</option>
             ';
$countries = CAdmin::getUniqueCountryConnectionArray();
foreach ($countries as $c) {
    $name = $c['country'];
    $content .= "<option value='{$name}'>{$name}</option>";
}
$content .= '
         </select>
         <span class="input-group-btn">
             <button class="btn btn-default filter_button" id="button_filter_country">Go!</button>
           </span>
    </div>
</div>
<ul class="panel panel-default selectable list-group" id="list_selection"></ul>
</div>
<div class="col-sm-6">
<h3>Selected List <button class="btn btn-success" id="button_save_selected">Save</button>
Beispiel #15
0
<?php

require_once __DIR__ . "/logic.php";
if (isAjax()) {
    // Если к нам идёт Ajax запрос, то ловим его
    $from = validateDate(post("from"), "Y-m-d H:i") ? strtotime(post("from")) : time() - 60 * 60 * 24;
    $to = validateDate(post("from"), "Y-m-d H:i") ? strtotime(post("to")) : time();
    $data = ["online" => 0, "offline" => 0, "all" => CAdmin::countConnections($from, $to), "new" => CAdmin::countNewAgents(time() - 60 * 60 * 24, time()), "last_update" => date("d.m.Y - H:i:s (\\U\\T\\CO)", time()), "count_agents" => CAdmin::countUniqueConnections($from, $to), "done" => CAdmin::countDone($from, $to), "in_work" => CAdmin::countInWork($from, $to), "waiting_accept" => CAdmin::countWaiting($from, $to)];
    echo json_encode($data);
    exit;
}
$content = file_get_contents("_statistic.html");
include "_main.html";
Beispiel #16
0
 // closeaccount
 // Params: action, sid, user, pass
 ////////////////////////////////////////////////////////////////////////////////////////////
 case "closeaccount":
     if (isSessionIDValid($config, $xsid)) {
         if ($_GET['user'] != "" && $_GET['pass'] != "") {
             $session = base64_decode($xsid);
             list($uniq, $player_id) = preg_split("/\\|/", $session);
             //Instantiate theCR3DCQuery Class
             $oR3DCQuery = new CR3DCQuery($config);
             $bAuth = $oR3DCQuery->CheckLoginCredentialsForMobile($ConfigFile, $_GET['user'], $_GET['pass']);
             $oR3DCQuery->Close();
             unset($oR3DCQuery);
             if ($bAuth) {
                 // Instantiate the CAdmin Class
                 $oAdmin = new CAdmin($config);
                 $oAdmin->DisablePlayer($player_id);
                 $oAdmin->Close();
                 unset($oAdmin);
                 //Instantiate the CChess Class
                 $oChess = new CChess($config);
                 $sid = $oChess->delete_session($config, $xsid);
                 unset($oChess);
                 echo "<RESPONSE>\n";
                 echo "<CLOSED>true</CLOSED>\n";
                 echo "</RESPONSE>\n";
             } else {
                 echo "<RESPONSE>\n";
                 echo "<ERROR>IDS_INVALID_PASS_OR_USER</ERROR>\n";
                 echo "</RESPONSE>\n";
             }
Beispiel #17
0
<?php

require_once __DIR__ . "/logic.php";
CAdmin::logout();
header("Location: /admin/login.php");
$SSIfile = "../skins/" . $SkinName . "/standard_cfg.php";
if (file_exists($SSIfile)) {
    include $SSIfile;
}
//////////////////////////////////////////////////////////////
require $Root_Path . "bin/CR3DCQuery.php";
require $Root_Path . "bin/CAdmin.php";
require $Root_Path . "bin/config.php";
require $Root_Path . "includes/siteconfig.php";
require $Root_Path . "includes/language.php";
require $Root_Path . "bin/DataRenderers.php";
require $Root_Path . "bin/LanguageParser.php";
//////////////////////////////////////////////////////////////
//Instantiate the Classes
$oR3DCQuery = new CR3DCQuery($config);
$oAdmin = new CAdmin($config);
$bCronEnabled = $oR3DCQuery->IsCronManagementEnabled();
//////////////////////////////////////////////////////////////
LanguageFile::load_language_file2($conf);
////////////////////////////////////////////////
//Login Processing
////////////////////////////////////////////////
//Check if admin is logged in already
if (!isset($_SESSION['LOGIN'])) {
    $login = "******";
    header('Location: ./index.php');
} else {
    if ($_SESSION['LOGIN'] != true) {
        if (isset($_SESSION['UNAME'])) {
            unset($_SESSION['UNAME']);
        }