function getToken()
{
    require_once 'comm.php';
    $currnet = time();
    $Token_result = new connect();
    $sql = "SELECT * FROM options where type='token'";
    $result = $Token_result->query($sql);
    $arr = mysql_fetch_array($result);
    $time_token = $arr['value'];
    if ($currnet >= $time_token) {
        $appid = "wxa2986e7d8863b2ab";
        $secret = "08d000097799e646d11b57e0acd71a9f";
        $access_token = file_get_contents("https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid={$appid}&secret={$secret}");
        $access_token = json_decode($access_token);
        $access_token = $access_token->{'access_token'};
        //修改新的token信息
        $time = $currnet + 7200;
        $sql = "UPDATE options SET title='" . $access_token . "',value='" . $time . "' where type='token'";
        $Token_result->query($sql);
    } else {
        $access_token = $arr['title'];
        //$access_token ="48QToD2xXqQSwSNF8uqn6iF3o3P4yDEqvrrxaDDO0nxqcZFgg95IwA_xAafzwhsVxcM4Hh0tQTtwIcTqFxEa_B1IUpXE67cVUmpBnq_09rE";
    }
    return $access_token;
}
Beispiel #2
0
function state($ch)
{
    $con = new connect();
    $rs = $con->Query(" select * from admin,client where email='{$ch}' and admin.id=client.id_client ");
    $data = $rs->fetch_array();
    return $data["state"];
}
Beispiel #3
0
 function edit_privilege_one($table, $id)
 {
     if ($_SESSION['user_type'] == 1) {
         return "1";
     }
     $ob1 = new connect();
     if ($table == "users") {
         $sql = mysqli_query($ob1->dbcon(), "SELECT * FROM `{$table}` WHERE  `user_id` = '{$id}'");
     } else {
         $sql = mysqli_query($ob1->dbcon(), "SELECT * FROM `{$table}` WHERE  `id` = '{$id}'");
     }
     if ($row = mysqli_fetch_array($sql)) {
         if ($table != "accounts") {
             //check if this assigned to this user
             if ($row['assignedto'] == $_SESSION['user_id']) {
                 return "1";
             }
         }
         if ($_SESSION['_' . $row['group']][$table] == 2 || $_SESSION['_' . $row['group']][$table] == 3 || $_SESSION['_' . $row['group']][$table] == 6 || $_SESSION['_' . $row['group']][$table] == 7) {
             return "1";
         } else {
             return "0";
         }
     }
 }
Beispiel #4
0
 function __construct()
 {
     require_once "include/connect.php";
     $db = new connect();
     //instance of the class connect
     $this->conn = $db->db_connect();
     //connecting to the databse using $conn
 }
Beispiel #5
0
 function inscrire($nom, $prenom, $email, $pwd, $state)
 {
     $con = new connect();
     if ($con->Query(" insert into admin (email,password) values ('{$email}','{$pwd}') ")) {
         $a = $con->Query("select * from admin where email='{$email}' ");
         $data = $a->fetch_array();
         $this->id_client = $data["id"];
         $RIB = $this->generateID();
         $con->Query(" insert into client (nom,prenom,id_client,state,RIB,solde) values ('{$nom}','{$prenom}','{$this->id_client}','{$state}','{$RIB}','0') ");
         echo "registered with success";
     } else {
         echo "fail to insert";
     }
 }
Beispiel #6
0
 /**
  * почти конструктор
  * @param null|int|string $type
  * @param null|string $host
  * @param null|string $base
  * @param null|string $user
  * @param null|string $pwd
  * @return connect|null
  */
 public static function start($type = NULL, $host = NULL, $base = NULL, $user = NULL, $pwd = NULL)
 {
     if (self::$inst == null) {
         self::$inst = new connect($type, $host, $base, $user, $pwd);
     }
     return self::$inst;
 }
Beispiel #7
0
 private function setConexion()
 {
     $conf = connect::getInstance();
     $this->servidor = $conf->getHostDB();
     $this->base_datos = $conf->getDB();
     $this->usuario = $conf->getUserDB();
     $this->password = $conf->getPassDB();
 }
Beispiel #8
0
 /**
  * builder constructor.
  * @param string $tbuild
  * @param string $lang
  * @param int $server
  * @param string $mwcedb
  */
 public function __construct($tbuild, $lang, $server, $mwcedb = "mwce_settings")
 {
     $this->DB = connect::start();
     $this->build = $tbuild;
     $this->lang = $lang;
     $this->server = $server;
     $this->mwcedb = $mwcedb;
     $this->checkBase();
 }
Beispiel #9
0
 public static function connectToRealmDB($realmid)
 {
     self::selectDB('webdb');
     if ($GLOBALS['realms'][$realmid]['mysql_host'] != $GLOBALS['connection']['host'] || $GLOBALS['realms'][$realmid]['mysql_user'] != $GLOBALS['connection']['user'] || $GLOBALS['realms'][$realmid]['mysql_pass'] != $GLOBALS['connection']['password']) {
         mysql_connect($GLOBALS['realms'][$realmid]['mysql_host'], $GLOBALS['realms'][$realmid]['mysql_user'], $GLOBALS['realms'][$realmid]['mysql_pass']) or buildError("<b>Database Connection error:</b> A connection could not be established to Realm. Error: " . mysql_error(), NULL);
     } else {
         self::connectToDB();
     }
     mysql_select_db($GLOBALS['realms'][$realmid]['chardb']) or buildError("<b>Database Selection error:</b> The realm database could not be selected. Error: " . mysql_error(), NULL);
     self::$connectedTo = 'chardb';
 }
Beispiel #10
0
 function countrows1($tablename, $field, $value)
 {
     $ob1 = new connect();
     $ids = join(',', $_SESSION['user_groups']);
     $sql = mysqli_query($ob1->dbcon(), "SELECT COUNT(id) AS `count` FROM `{$tablename}` WHERE `deleted` = '0' AND `{$field}`='{$value}' AND `group` IN ({$ids})");
     //  this use for users
     if ($_SESSION['user_type'] == '1') {
         $sql = mysqli_query($ob1->dbcon(), "SELECT COUNT(id) AS `count` FROM `{$tablename}` WHERE `deleted` = '0' AND `{$field}`='{$value}' ");
         // this use for admin
     }
     $row = mysqli_fetch_assoc($sql);
     return $row['count'];
 }
Beispiel #11
0
 public static function init($type)
 {
     if ($GLOBALS['enablePlugins'] == true) {
         if ($_SESSION['loaded_plugins'] != NULL) {
             $bad = array('.', '..', 'index.html');
             $loaded = array();
             foreach ($_SESSION['loaded_plugins'] as $folderName) {
                 connect::selectDB('webdb');
                 $chk = mysql_query("SELECT COUNT(*) FROM disabled_plugins WHERE foldername='" . mysql_real_escape_string($folderName) . "'");
                 if (mysql_result($chk, 0) == 0 && file_exists('plugins/' . $folderName . '/' . $type . '/')) {
                     $folder = scandir('plugins/' . $folderName . '/' . $type . '/');
                     foreach ($folder as $fileName) {
                         if (!in_array($fileName, $bad)) {
                             $loaded[] = 'plugins/' . $folderName . '/' . $type . '/' . $fileName;
                         }
                     }
                     $_SESSION['loaded_plugins_' . $type] = $loaded;
                 }
             }
         }
     }
 }
Beispiel #12
0
 function user_can_delete_groups($table)
 {
     $loguser = $_SESSION['user_id'];
     $ob1 = new connect();
     // $sql=" SELECT * FROM `user_group` WHERE `user_id` = '$loguser' AND ($table > '2' OR $table > '3' OR $table > '6' OR $table > '7' )";
     if ($_SESSION['user_type'] == '1') {
         $sql = "SELECT * FROM groups WHERE deleted = '0' ";
     } else {
         $sql = "SELECT user_group.*,groups.group_name FROM user_group\n                           LEFT OUTER JOIN groups ON user_group.group_id = groups.group_id\n                           WHERE user_group.user_id = '{$loguser}' AND (user_group.{$table} ='1' OR user_group.{$table} = '3' OR user_group.{$table} = '5' OR user_group.{$table} = '7' )";
     }
     // echo $sql;
     return mysqli_query($ob1->dbcon(), $sql);
 }
Beispiel #13
0
.link{
background-color:#DAA520;
color:#484848;
}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body bgcolor="#A9A9A9">
<center>
<h1>COURSE RERGISTRATION</h1>
<form method="post" action="#">
<?php 
if (isset($_POST['submit'])) {
    require_once "reg.php";
    $x = new connect();
    if ($x->course()) {
        header('Location: home.php');
    } else {
        echo "error";
    }
}
?>
<pre>

GRADUATION:	<input type="radio" name="graduation" value="UG" />UG	<input type="radio" name="graduation" value="PG" />PG

Degree:		<select name="degree">
<option value="select option" selected> Select category</option>
<option value="B.Tech">B.Tech</option>
<option value="M.Tech">M.Tech</option>
 public function DeleteData($users, $passwords, $dbName, $table, $id)
 {
     $con_user = $users;
     $con_pass = $passwords;
     $con_name = $dbName;
     $connection_object = new connect();
     if (!empty($con_user) && !empty($con_pass)) {
         $dbcon = $connection_object->connection('localhost', $con_user, $con_pass, $con_name);
     } else {
         $dbcon = $connection_object->connection('localhost', 'root', '', $con_name);
     }
     $sql = "delete from {$table} where `id`={$id}";
     //$query=mysql_query($sql);
     $deleteStatement = $dbcon->prepare($sql);
     $deleteStatement->execute(array(':id' => $id));
 }
    var $pass;
    var $db;
    public $connect;
    public function connection($hostname, $username, $passwoard, $database)
    {
        $this->host = $hostname;
        $this->user = $username;
        $this->pass = $passwoard;
        $this->db = $database;
        $connect = new PDO("mysql:host={$this->host};dbname={$this->db}", $this->user, $this->pass, array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
        $connect->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
        $connect->setAttribute(PDO::ATTR_PERSISTENT, true);
        return $connect;
    }
}
$connection_object = new connect();
include 'database_config.php';
$db_user = $database_user;
$db_pass = $databse_pass;
$dbcon = $connection_object->connection('localhost', $db_user, $db_pass, 'student_kpi');
//start from here
$batch = $_POST['b_id'];
$group = $_POST['g_id'];
$student_id = $_POST['s_id'];
$std_names = $_POST['name'];
$att = $_POST['attendance'];
$en_date = $_POST['entry_date'];
$preparedStatement = $dbcon->prepare('INSERT INTO student_attendance (s_id, name, b_id, g_id, attendance, entry_date)
	VALUES (:sid, :sname, :bid, :gid, :atten, :ent_date)');
$arrlength = count($student_id);
for ($x = 0; $x < $arrlength; $x++) {
Beispiel #16
0
<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
include "connect.php";
$name = $_POST["name"];
$pass = $_POST["pass"];
$query = "Select * from login where Name=\"" . $name . "\" and Password=\"" . $pass . "\";";
$q = "Select * from customer where name=\"" . $name . "\";";
$c = new connect();
$conn = $c->con();
$result = $c->execute($conn, $query);
if ($result->num_rows > 0) {
    $row = $result->fetch_assoc();
    if ($row["Class"] == 1) {
        $r = $c->execute($conn, $q);
        $val = $r->fetch_assoc();
        session_start();
        $_SESSION["id"] = $val["id"];
        //  echo $val["id"];
        header('Location: CustomerProfile.html');
    } else {
        if ($row["Class"] == 2) {
            header('Location: Admin_Interface.html');
        }
    }
} else {
    echo "0 results\n";
Beispiel #17
0
<?php 
    if ($GLOBALS['service'][$service]['currency'] == "vp") {
        echo "<span class='currency'>Vote Points: " . account::loadVP($_SESSION['cw_user']) . "</span>";
    } elseif ($GLOBALS['service'][$service]['currency'] == "dp") {
        echo "<span class='currency'>" . $GLOBALS['donation']['coins_name'] . ": " . account::loadDP($_SESSION['cw_user']) . "</span>";
    }
}
account::isNotLoggedIn();
connect::selectDB('webdb');
$num = 0;
$result = mysql_query('SELECT char_db,name FROM realms ORDER BY id ASC');
while ($row = mysql_fetch_assoc($result)) {
    $acct_id = account::getAccountID($_SESSION['cw_user']);
    $realm = $row['name'];
    $char_db = $row['char_db'];
    connect::selectDB($char_db);
    $result = mysql_query('SELECT name,guid,gender,class,race,level,online FROM characters WHERE account=' . $acct_id);
    while ($row = mysql_fetch_assoc($result)) {
        ?>
<div class='charBox'>
    <table width="100%">
	        <tr>
                <td width="73">
                <?php 
        if (!file_exists('styles/global/images/portraits/' . $row['gender'] . '-' . $row['race'] . '-' . $row['class'] . '.gif')) {
            echo '<img src="styles/' . $GLOBALS['template']['path'] . '/images/unknown.png" />';
        } else {
            ?>
                <img src="styles/global/images/portraits/
					<?php 
            echo $row['gender'] . '-' . $row['race'] . '-' . $row['class'];
Beispiel #18
0
}
// language selection by settings
if (SETTINGS_SITE_LANGUAGE && file_exists(ROOT . 'languages/' . SETTINGS_SITE_LANGUAGE . '.php')) {
    include_once ROOT . 'languages/' . SETTINGS_SITE_LANGUAGE . '.php';
}
include_once ROOT . 'languages/default.php';
if (defined('SETTINGS_SITE_TIMEZONE')) {
    ini_set('date.timezone', SETTINGS_SITE_TIMEZONE);
}
$session = new session("prj");
set_time_limit(0);
$socket_connected = 0;
$latest_urls_time = 0;
while (1) {
    include_once DIR_MODULES . 'connect/connect.class.php';
    $connect = new connect();
    $connect->getConfig();
    if (!$connect->config['CONNECT_SYNC']) {
        echo "Connect sync turned off.";
        exit;
    } else {
        /*
        $connect->sendMenu(1);
        */
        $sqlQuery = "SELECT *\n                     FROM commands";
        $commands = SQLSelect($sqlQuery);
        $total = count($commands);
        for ($i = 0; $i < $total; $i++) {
            $cmd_values[$commands[$i]['ID']] = $commands[$i]['CUR_VALUE'];
            $cmd_titles[$commands[$i]['ID']] = $commands[$i]['RENDER_TITLE'];
            $cmd_data[$commands[$i]['ID']] = $commands[$i]['RENDER_DATA'];
Beispiel #19
0
<?php

include 'lib/connect.php';
$obj = new connect();
$modelid = $_POST['modelid'];
$qnty = $_POST['qnty'];
$n = $obj->save_cart($modelid, $qnty);
header('Location:cart.php');
Beispiel #20
0
 public static function logThis($desc, $service, $realmid)
 {
     $desc = mysql_real_escape_string($desc);
     $realmid = (int) $realmid;
     $service = mysql_real_escape_string($service);
     $account = (int) $_SESSION['cw_user_id'];
     connect::selectDB('webdb');
     mysql_query("INSERT INTO user_log VALUES(NULL,'" . $account . "','" . $service . "','" . time() . "','" . $_SERVER['REMOTE_ADDR'] . "','" . $realmid . "','" . $desc . "')");
 }
 public function DeleteData($users, $passwords, $dbName, $table, $id)
 {
     $con_user = $users;
     $con_pass = $passwords;
     $con_name = $dbName;
     $connection_object = new connect();
     if (!empty($con_user) && !empty($con_pass)) {
         $dbcon = $connection_object->connection('localhost', $con_user, $con_pass, $con_name);
     } else {
         $dbcon = $connection_object->connection('localhost', 'firoz', 'firoz', $con_name);
     }
     $sql = "delete from {$table} where `id`={$id}";
     //$query=mysql_query($sql);
     $deleteStatement = $dbcon->prepare($sql);
     if ($deleteStatement->execute(array(':id' => $id))) {
         echo "<script> alert('তথ্যটি ডিলিট করা হয়েছে ।')</script>";
         echo "<script>location.href='enter.php'</script>";
     } else {
         echo "<script> alert('আপনার ডিলিট করা সম্ভব হয়নি ।')</script>";
         echo "<script>location.href='enter.php'</script>";
     }
 }
Beispiel #22
0
}
$account = new account();
$account->getRemember();
//Remember thingy.
//This is to prevent the error "Undefined index: p"
if (!isset($_GET['p'])) {
    $_GET['p'] = 'home';
}
###VOTING SYSTEM####
if (isset($_SESSION['votingUrlID']) && $_SESSION['votingUrlID'] != 0 && $GLOBALS['vote']['type'] == 'confirm') {
    if (website::checkIfVoted((int) $_SESSION['votingUrlID'], $GLOBALS['connection']['webdb']) == TRUE) {
        die("?p=vote");
    }
    $acct_id = account::getAccountID($_SESSION['cw_user']);
    $next_vote = time() + $GLOBALS['vote']['timer'];
    connect::selectDB('webdb');
    mysql_query("INSERT INTO votelog VALUES('','" . (int) $_SESSION['votingUrlID'] . "',\n\t'" . $acct_id . "','" . time() . "','" . $next_vote . "','" . $_SERVER['REMOTE_ADDR'] . "')");
    $getSiteData = mysql_query("SELECT points,url FROM votingsites WHERE id='" . (int) $_SESSION['votingUrlID'] . "'");
    $row = mysql_fetch_assoc($getSiteData);
    if (mysql_num_rows($getSiteData) == 0) {
        header('Location: index.php');
        unset($_SESSION['votingUrlID']);
        exit;
    }
    //Update the points table.
    $add = $row['points'] * $GLOBALS['vote']['multiplier'];
    mysql_query("UPDATE account_data SET vp=vp + " . $add . " WHERE id=" . $acct_id);
    unset($_SESSION['votingUrlID']);
    header("Location: ?p=vote");
    exit;
}
Beispiel #23
0
                $datauser = new stdClass();
                if ($querydata = $DB->get_records_sql($sqlfilteruser, array($USER->id))) {
                    foreach ($querydata as $data) {
                        $datauser->facebookid = $data->facebookid;
                        $datauser->link = "https://www.facebook.com/app_scoped_user_id/" . $data->facebookid . "/";
                        $datauser->firstname = $data->firstname;
                        $datauser->middlename = "";
                        $datauser->lastname = $data->lastname;
                    }
                }
            } else {
                $datauser = $DB->get_record("facebook_user", array("moodleid" => $USER->id));
            }
            //Tesis Roberto Jaunez
            if ($USER->id == 10644 || $USER->id == 2 || $USER->id == 40214 || $USER->id == 381 || $USER->id == 60246 || $USER->id == 32806 || $USER->id == 28988) {
                $toprow = array();
                $toprow[] = new tabobject("Tu cuenta", new moodle_url('/local/facebook/connect.php'), "Tu cuenta");
                $toprow[] = new tabobject("Facebook Analysis", new moodle_url('/local/facebook/facebookalgorithm.php'), "Facebook Analysis");
                echo $OUTPUT->tabtree($toprow, "Tu cuenta");
            }
            $table = facebook_connect_table_generator($datauser->facebookid, $datauser->link, $datauser->firstname, $datauser->middlename, $datauser->lastname);
            // Look if the account was already linked
            $duplicate = $DB->get_record("facebook_user", array("facebookid" => $facebook_id, "status" => FACEBOOK_STATUS_LINKED));
            // if it isn't linked it will return false, if the status is 0 someone already linked it but it is not active.
            $button = new connect(null, array("duplicate" => $duplicate));
            $button->display();
        }
    }
}
// if the user has the account linkd it will show his information and some other actions the user can perform.
echo $OUTPUT->footer();
Beispiel #24
0
<?php

include 'lib/connect.php';
$obj = new connect();
session_start();
$obj->remove_session_details();
session_destroy();
$msg = md5('logout');
header('Location:index.php?logout=' . $msg);
Beispiel #25
0
 private function __construct()
 {
     /**
      * если не установлен билд, то сначала грузим главный конфиг. в нем читаем билд,
      * устанавливаем и далее вычитываем конфиг конкретного билда.
      */
     $mainpath = "configs" . DIRECTORY_SEPARATOR . "configs.php";
     if (file_exists($mainpath)) {
         require_once $mainpath;
     } else {
         die("main cfg error!");
     }
     if (empty($_SESSION["mwcbuild"])) {
         $_SESSION["mwcbuild"] = $cfg["defaultbuild"];
     }
     define("tbuild", $_SESSION["mwcbuild"]);
     $globalcfg = Configs::readCfg("main", $_SESSION["mwcbuild"]);
     if (empty($_SESSION["mwcserver"])) {
         //сервер
         $_SESSION["mwcserver"] = 0;
     }
     if (empty($_SESSION["mwcbuild"])) {
         //сервер
         $_SESSION["mwcbuild"] = $globalcfg["tbuild"];
     }
     if (empty($_SESSION["mwclang"])) {
         //язык
         $_SESSION["mwclang"] = $globalcfg["dlang"];
     }
     if (empty($_SESSION["mwcpoints"])) {
         //группа
         $_SESSION["mwcpoints"] = $globalcfg["defgrp"];
     }
     $adres = $globalcfg["address"];
     try {
         $content = new content($adres, $globalcfg["theme"], $_SESSION["mwclang"]);
     } catch (Exception $e) {
         echo $e->getMessage();
         die;
     }
     $isBackground = isset($_GET["bg"]) ? 1 : NULL;
     //если идет обращение к серверу
     try {
         $db = connect::start();
         if (empty($_SESSION["mwcuid"])) {
             $uid = 0;
         } else {
             $uid = $_SESSION["mwcuid"];
         }
         $builder = new builder(tbuild, $_SESSION["mwclang"], $_SESSION["mwcserver"]);
         // проверяем наличие списка модулей и плагинов
         //region плагины
         $plugin = "";
         require_once "build" . DIRECTORY_SEPARATOR . tbuild . DIRECTORY_SEPARATOR . "_dat" . DIRECTORY_SEPARATOR . $_SESSION["mwcserver"] . "_" . $_SESSION["mwclang"] . "_plugins.php";
         if (is_array($plugin) && is_null($isBackground)) {
             foreach ($plugin as $name => $param) {
                 if ($param["pstate"] == 1) {
                     $contoller_path = "build" . DIRECTORY_SEPARATOR . tbuild . DIRECTORY_SEPARATOR . "plugins" . DIRECTORY_SEPARATOR . "controller" . DIRECTORY_SEPARATOR . $name . ".php";
                     //region проверка на пользователя (если есть)
                     $ccfg = Configs::readCfg("plugin_" . $name, $_SESSION["mwcbuild"]);
                     if (!empty($ccfg["allowedUsrs"])) {
                         $usrs = explode(",", $ccfg["allowedUsrs"]);
                         if (!in_array($uid, $usrs)) {
                             $err = 2;
                         } else {
                             $err = 0;
                         }
                     } else {
                         $err = 2;
                     }
                     //endregion
                     if (file_exists($contoller_path) && (!empty($param["groups"]) || $err == 0)) {
                         if (empty($param["groups"])) {
                             $paccess = array();
                         } else {
                             $paccess = explode(",", $param["groups"]);
                         }
                         try {
                             if (!empty($param["mname"])) {
                                 $model_path = "build" . DIRECTORY_SEPARATOR . tbuild . DIRECTORY_SEPARATOR . "plugins" . DIRECTORY_SEPARATOR . "model" . DIRECTORY_SEPARATOR . $param["mname"] . ".php";
                                 if (file_exists($model_path)) {
                                     require $model_path;
                                 }
                                 require $contoller_path;
                                 if ((in_array($_SESSION["mwcpoints"], $paccess) || in_array(4, $paccess) || $err == 0) && class_exists($param["mname"])) {
                                     $tmp = $param["mname"];
                                     $model = new $tmp();
                                     $pcontoller = new $name($model, $content, $plugin, $_SESSION["mwcserver"]);
                                     if (method_exists($name, "action_index")) {
                                         $pcontoller->init();
                                         $pcontoller->action_index();
                                         $pcontoller->parentOut();
                                     }
                                 }
                             } else {
                                 if (in_array($_SESSION["mwcpoints"], $paccess) || in_array(4, $paccess)) {
                                     $model = new $globalcfg["defModel"]();
                                     $pcontoller = new PController($model, $content, $plugin, $_SESSION["mwcserver"]);
                                     $pcontoller->genNonMVC($contoller_path);
                                     $pcontoller->parentOut($name);
                                 }
                             }
                         } catch (Exception $e) {
                             $content->error(1);
                             $content->setFContainer("plugin_{$name}", true);
                         }
                     }
                 }
             }
         }
         //endregion
         //region страницы
         //region получение контроллера и экшена
         $action_name = "action_index";
         if (!isset($_GET["p"])) {
             $controller = $globalcfg["defpage"];
         } else {
             $controller = htmlspecialchars($_GET["p"], ENT_QUOTES);
             if ($controller == "index") {
                 $controller = $globalcfg["defpage"];
             }
         }
         if (isset($_GET["a"])) {
             $action_name = "action_" . $_GET["a"];
         }
         //endregion
         require_once "build" . DIRECTORY_SEPARATOR . tbuild . DIRECTORY_SEPARATOR . "_dat" . DIRECTORY_SEPARATOR . $_SESSION["mwcserver"] . "_" . $_SESSION["mwclang"] . "_pages.php";
         if (isset($page[$controller])) {
             $path = "build" . DIRECTORY_SEPARATOR . tbuild . DIRECTORY_SEPARATOR . $page[$controller]["ppath"] . DIRECTORY_SEPARATOR . $controller . ".php";
             if (file_exists($path)) {
                 $access = explode(",", $page[$controller]["groups"]);
                 //region проверка на пользователя (если есть)
                 $ccfg = Configs::readCfg($controller, $_SESSION["mwcbuild"]);
                 if (!empty($ccfg["allowedUsrs"])) {
                     $usrs = explode(",", $ccfg["allowedUsrs"]);
                     if (!in_array($uid, $usrs)) {
                         $err = 2;
                     } else {
                         $err = 0;
                     }
                 } else {
                     $err = 2;
                 }
                 //endregion
                 try {
                     if (in_array($_SESSION["mwcpoints"], $access) || in_array(4, $access) || $err == 0) {
                         if (!empty($page[$controller]["mname"]) && !empty($page[$controller]["mpath"])) {
                             $modelpath = "build" . DIRECTORY_SEPARATOR . tbuild . DIRECTORY_SEPARATOR . $page[$controller]["mpath"] . DIRECTORY_SEPARATOR . $page[$controller]["mname"] . ".php";
                             require_once $path;
                             if (file_exists($modelpath)) {
                                 require_once $modelpath;
                                 $modelname = $page[$controller]["mname"];
                             } else {
                                 $modelname = "Model";
                                 $action_name = "showError";
                                 $db->SQLog("model {$modelpath} wasn't found", "router", 2);
                             }
                             $model = new $modelname($db);
                             $contolinst = new $controller($model, $content, $page, $_SESSION["mwcserver"]);
                             $contolinst->init();
                             if (method_exists($controller, $action_name)) {
                                 $contolinst->{$action_name}();
                             } else {
                                 $contolinst->action_index();
                                 $db->SQLog("{$controller} hasn't action {$action_name}", "router", 3);
                             }
                             $contolinst->parentOut($isBackground);
                         } else {
                             $model = new $globalcfg["defModel"]();
                             $contolinst = new $globalcfg["defController"]($model, $content, $page, $_SESSION["mwcserver"]);
                             $contolinst->genNonMVC($path);
                             $contolinst->parentOut($isBackground);
                         }
                     } else {
                         $model = new Model($db);
                         $contolinst = new Controller($model, $content, $page, $_SESSION["mwcserver"]);
                         $contolinst->init();
                         $contolinst->showError(2);
                         $contolinst->parentOut($isBackground);
                         if (!empty($_SESSION["mwcuid"])) {
                             $theGuy = $_SESSION["mwcuid"];
                         } else {
                             $theGuy = "?";
                         }
                         $db->SQLog("user({$theGuy}) try access to {$controller} but he hasn't access", "router", 6);
                     }
                 } catch (Exception $e) {
                     $model = new Model($db);
                     $contolinst = new Controller($model, $content, $page, $_SESSION["mwcserver"]);
                     $contolinst->init();
                     $contolinst->showErrorText($e->getMessage());
                     $contolinst->parentOut($isBackground);
                 }
             } else {
                 $model = new Model($db);
                 $contolinst = new Controller($model, $content, $page, $_SESSION["mwcserver"]);
                 $contolinst->init();
                 $contolinst->showError(3);
                 $contolinst->parentOut($isBackground);
                 $db->SQLog("controller {$path} ({$controller}) wasn't found", "router", 1, true);
             }
         } else {
             $model = new Model($db);
             $contolinst = new Controller($model, $content, $page, $_SESSION["mwcserver"]);
             $contolinst->init();
             $contolinst->showError(3);
             $contolinst->parentOut($isBackground);
             $db->SQLog("controller {$controller} wasn't register", "router", 1);
         }
         //endregion
     } catch (Exception $ex) {
         $stack = $ex->getTrace();
         $msg = $ex->getMessage() . " in file: " . basename($stack[3]["file"]) . " line: " . $stack[3]["line"];
         self::addlog(tbuild . "_error", $msg, "log");
         content::showError("Something went wrong", "please, check logs.");
     }
 }
Beispiel #26
0
</table>
</form>
<?php 
}
if (isset($_POST['ir_step3'])) {
    $guid = (int) $_POST['ir_char'];
    $instance = (int) $_POST['ir_instance'];
    if ($GLOBALS['service'][$service]['currency'] == "vp") {
        if (account::hasVP($_SESSION['cw_user'], $GLOBALS['service'][$service]['price']) == FALSE) {
            echo '<span class="alert">You do not have enough Vote Points!';
        } else {
            connect::selectDB($_POST['ir_realm']);
            mysql_query("DELETE FROM instance WHERE id='" . $instance . "'");
            account::deductVP(account::getAccountID($_SESSION['cw_user']), $GLOBALS['service'][$service]['price']);
            echo '<span class="approved">The instance lock was removed!</span>';
        }
    } elseif ($GLOBALS['service'][$service]['currency'] == "dp") {
        if (account::hasDP($_SESSION['cw_user'], $GLOBALS['service'][$service]['price']) == FALSE) {
            echo '<span class="alert">You do not have enough ' . $GLOBALS['donation']['coins_name'];
        } else {
            connect::selectDB($_POST['ir_realm']);
            mysql_query("DELETE FROM instance WHERE id='" . $instance . "'");
            account::deductDP(account::getAccountID($_SESSION['cw_user']), $GLOBALS['service'][$service]['price']);
            echo '<span class="approved">The instance lock was removed!</span>';
            account::logThis("Performed an Instance reset on " . character::getCharName($guid, server::getRealmId($_POST['ir_realm'])), "instancereset", server::getRealmId($_POST['ir_realm']));
        }
    }
}
?>
<br/>
<a href="?p=instancereset">Start over</a>
Beispiel #27
0
        $result = mysql_query("SELECT guid, name, totalKills, level, race, class, gender, account FROM characters WHERE name!='' \r\n\t\t\t\t\t\t\t\t  AND online=1");
    }
    while ($row = mysql_fetch_assoc($result)) {
        connect::connectToRealmDB($rid);
        $getGuild = mysql_query("SELECT guildid FROM guild_member WHERE guid='" . $row['guid'] . "'");
        if (mysql_num_rows($getGuild) == 0) {
            $guild = "None";
        } else {
            $g = mysql_fetch_assoc($getGuild);
            $getGName = mysql_query("SELECT name FROM guild WHERE guildid='" . $g['guildid'] . "'");
            $x = mysql_fetch_assoc($getGName);
            $guild = '&lt; ' . $x['name'] . ' &gt;';
        }
        if ($GLOBALS['playersOnline']['display_GMS'] == false) {
            //Check if GM.
            connect::selectDB('logondb');
            $checkGM = mysql_query("SELECT COUNT(*) FROM account_access WHERE id='" . $row['account'] . "' AND gmlevel >0");
            if (mysql_result($checkGM, 0) == 0) {
                echo '<tr style="text-align: center;">
						<td>' . $row['name'] . '</td>
						<td>' . $guild . '</td>
						<td>' . $row['totalKills'] . '</td>
						<td>' . $row['level'] . '</td>
					</tr>';
            }
        } else {
            echo '<tr style="text-align: center;">
					<td>' . $row['name'] . '</td>
					<td>' . $guild . '</td>
					<td>' . $row['totalKills'] . '</td>
					<td>' . $row['level'] . '</td>
Beispiel #28
0
                    continue;
                }
                $perm = unserialize($row['formulaperm']);
                if (is_array($perm)) {
                    if ($perm[0] || $perm[1] || $perm['users']) {
                        $userGroups[$gid]['forbidForumIds'][] = $row['fid'];
                        continue;
                    }
                }
                if (!$allowViewGroupIds) {
                    $userGroups[$gid]['allowForumIds'][] = $row['fid'];
                } elseif (!in_array($gid, $allowViewGroupIds)) {
                    $userGroups[$gid]['forbidForumIds'][] = $row['fid'];
                } elseif (in_array($gid, $allowViewGroupIds)) {
                    $userGroups[$gid]['allowForumIds'][] = $row['fid'];
                    $userGroups[$gid]['specifyAllowForumIds'][] = $row['fid'];
                }
                if (!$allowViewAttachGroupIds) {
                    $userGroups[$gid]['allowViewAttachForumIds'][] = $row['fid'];
                } elseif (!in_array($gid, $allowViewAttachGroupIds)) {
                    $userGroups[$gid]['forbidViewAttachForumIds'][] = $row['fid'];
                } elseif (in_array($gid, $allowViewGroupIds)) {
                    $userGroups[$gid]['allowViewAttachForumIds'][] = $row['fid'];
                }
            }
        }
        return $userGroups;
    }
}
$connect = new connect($_G['setting']['connectsiteid'], $_G['setting']['connectsitekey'], $_G['setting']['timeoffset'], $_G['setting']['version'], $_G['config']['db'][1]['dbcharset'], X_LANGUAGE);
$connect->run();
Beispiel #29
0
 function user_privilage($pri)
 {
     // to check peivilages using privilage id
     $ob1 = new connect();
     $sql = "SELECT * FROM user_group WHERE id='{$pri}' ";
     return mysqli_query($ob1->dbcon(), $sql);
 }
Beispiel #30
0
<?php

include 'lib/connect.php';
$obj = new connect();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>E-shop</title>
<link href="css/style.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
table{
		border:1px solid #000000;
		margin: 0px;
		width: 100%;
	}
body{
		background-image: url(images/img01.gif);
	}
.margin{
			margin: 0px;
			padding: 0px;
	}
.style4 {color: #99FF00}
.style5 {
			font-size: 36px;
			font-weight: bold;
		}
.style6 {color: #FF0000}