Пример #1
0
 public function __construct()
 {
     parent::__construct();
     parent::connect();
     // debug
     //parent::dump();
 }
Пример #2
0
 public function __construct()
 {
     //connect to the database if not connected
     if (!$this->db) {
         require_once "resources/classes/database.php";
         $database = new database();
         $database->connect();
         $this->db = $database->db;
     }
     //add multi-lingual support
     $language = new text();
     $text = $language->get();
     //get the ringback types
     $sql = "select * from v_vars ";
     $sql .= "where var_cat = 'Defaults' ";
     $sql .= "and var_name LIKE '%-ring' ";
     $sql .= "order by var_name asc ";
     $prep_statement = $this->db->prepare(check_sql($sql));
     $prep_statement->execute();
     $ringbacks = $prep_statement->fetchAll(PDO::FETCH_NAMED);
     unset($prep_statement, $sql);
     foreach ($ringbacks as $ringback) {
         $ringback = $ringback['var_name'];
         $label = $text['label-' . $ringback];
         if ($label == "") {
             $label = $ringback;
         }
         $ringback_list[$ringback] = $label;
     }
     $this->ringbacks = $ringback_list;
     unset($ringback_list);
     //get the default_ringback label
     /*
     $sql = "select * from v_vars where var_name = 'ringback' ";
     $prep_statement = $this->db->prepare(check_sql($sql));
     $prep_statement->execute();
     $result = $prep_statement->fetch();
     unset ($prep_statement, $sql);
     $default_ringback = (string) $result['var_value'];
     $default_ringback = preg_replace('/\A\$\${/',"",$default_ringback);
     $default_ringback = preg_replace('/}\z/',"",$default_ringback);
     #$label = $text['label-'.$default_ringback];
     #if($label == "") {
     	$label = $default_ringback;
     #}
     $this->default_ringback_label = $label;
     unset($results, $default_ringback, $label);
     */
     //get music on hold	and recordings
     if (is_dir($_SERVER["PROJECT_ROOT"] . '/app/music_on_hold')) {
         require_once "app/music_on_hold/resources/classes/switch_music_on_hold.php";
         $music = new switch_music_on_hold();
         $this->music_list = $music->get();
     }
     if (is_dir($_SERVER["PROJECT_ROOT"] . '/app/recordings')) {
         require_once "app/recordings/resources/classes/switch_recordings.php";
         $recordings = new switch_recordings();
         $this->recordings_list = $recordings->list_recordings();
     }
 }
Пример #3
0
 public function __construct()
 {
     //connect to the database if not connected
     if (!$this->db) {
         require_once "resources/classes/database.php";
         $database = new database();
         $database->connect();
         $this->db = $database->db;
     }
     //set the application specific uuid
     $this->app_uuid = 'b523c2d2-64cd-46f1-9520-ca4b4098e044';
     //set the domain_uuid if not provided
     if (strlen($this->domain_uuid) == 0) {
         $this->domain_uuid = $_SESSION['domain_uuid'];
     }
     //get the voicemail_id
     if (!isset($this->voicemail_id)) {
         $sql = "select voicemail_id from v_voicemails ";
         $sql .= "where domain_uuid = '" . $this->domain_uuid . "' ";
         $sql .= "and voicemail_uuid = '" . $this->voicemail_uuid . "' ";
         $prep_statement = $this->db->prepare(check_sql($sql));
         $prep_statement->execute();
         $result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
         if (is_array($result)) {
             foreach ($result as &$row) {
                 $this->voicemail_id = $row["voicemail_id"];
             }
         }
         unset($prep_statement);
     }
 }
Пример #4
0
 public function login()
 {
     $database = new database();
     if ($database->get_type() == 'mysql') {
         $db_arr = $database->connect();
         if ($db_arr[0] == 1) {
             return array(1, $db_arr[1]);
         }
         $this->db = $db_arr[1];
         // continue implementing login check
         $this->username = $this->db->escape_string(stripslashes($this->username));
         $this->password = $this->db->escape_string(stripslashes($this->password));
         $getuserquery = "SELECT * FROM user WHERE user_name='" . $this->username . "' AND user_password='******'";
         $getuserresult = $this->db->query($getuserquery);
         $getuserresult_count = $getuserresult->num_rows;
         if ($getuserresult_count == 0) {
             $this->authstatus = false;
             return array(2, 'Username and password incorrect.');
         } elseif ($getuserresult_count == 1) {
             $this->authstatus = true;
             return array(0, $this->authstatus);
         } else {
             return array(2, 'MySQL returning weird things.');
         }
     } elseif ($database->get_type() == 'sqlite') {
         $db_arr = $database->connect_sqlite();
         $this->db = $db_arr;
         // do things that have yet to be decided
     }
 }
Пример #5
0
function upload($file_name, $file_type, $file_path, $file_title)
{
    if (!empty($_FILES["fileUpload"]) && !empty($_POST["imgTitle"])) {
        $file_type = $_FILES['fileUpload']['type'];
        $file_title = $_POST["imgTitle"];
        if ($file_type == "image/gif") {
            $file_path = $_FILES['fileUpload']['tmp_name'];
            $file_name = $_FILES['fileUpload']['name'];
            $new_path = "upload/img/" . $file_name;
            $file_error = $_FILES["fileUpload"]["error"];
            if ($file_error == 0 && move_uploaded_file($file_path, $new_path)) {
                $sql = "INSERT INTO gif.images (`title_img`, `name_img`, `id_user`) VALUES ('{$file_title}','{$file_name}', '0');";
                $upload = new database();
                $upload->connect();
                $query = $upload->query($sql);
                if (!empty($query)) {
                    $success = "Upload file và ghi dư liệu thành công.";
                    return $success;
                } else {
                    $success = "Upload file thành công.";
                    return $success;
                }
            }
            return $file_error;
        } else {
            $error = "File không đúng định dạng GIF";
            return $error;
        }
    }
}
Пример #6
0
 function __construct()
 {
     include_once 'class.database.php';
     $conn = new database();
     $this->link = $conn->connect();
     return $this->link;
 }
Пример #7
0
function adlib($id, $type)
{
    // create adlib xml basic structure
    $XML = new simpleXmlElement("<?xml version='1.0' encoding='utf-8'?><adlibXML xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:noNamespaceSchemaLocation='http://www.adlibsoft.com/adlibXML.xsd' />");
    echoall("Start Adlib XML export");
    echoall("Connect database");
    $daba = new database();
    $daba->connect("localhost", "iggmp", "1s87J37r0");
    if ($daba->select("thesaurus")) {
        echoall("Database connected");
    } else {
        die("***ERROR - Database connection failed");
    }
    $termType = thesaurus::get_name($id);
    echoall("Starte bei <b>'" . thesaurus::get_name($id) . "'</b>");
    //------------------------------------------------------------------------------
    // create recordList
    xml_insert($XML, new simpleXmlElement("<recordList />"));
    // insert records in recordList
    $subXml = _subtree($id, $termType);
    if ($subXml) {
        xml_insert($XML->recordList, $subXml);
    }
    echoall("XML export completed<hr>");
    echoall($XML);
    return $XML->asXML();
}
function connect_2_db($cfg)
{
    if (!defined('NO_DSN')) {
        define('NO_DSN', FALSE);
    }
    if (strlen(trim($cfg['db_name'])) == 0) {
        echo '<span class="notok">Failed!</span><p />Database Name is empty';
        $db = null;
    } else {
        $db = new database($cfg['db_type']);
        @($conn_result = $db->connect(NO_DSN, $cfg['db_server'], $cfg['db_admin_name'], $cfg['db_admin_pass'], $cfg['db_name']));
        if ($conn_result['status'] == 0) {
            echo '<span class="notok">Failed!</span><p />Please check the database login details and try again.';
            echo '<br>Database Error Message: ' . $db->error_msg() . "<br>";
            $db = null;
        } else {
            if (!isset($cfg['db_type']) || strtolower($cfg['db_type']) == 'mysql') {
                // 20071103 - BUGID 771 eagleas
                $db->exec_query("SET CHARACTER SET utf8;");
                $db->exec_query("SET collation_connection = 'utf8_general_ci';");
            }
            echo "<span class='ok'>OK!</span><p />";
        }
    }
    return $db;
}
Пример #9
0
 public function get_db()
 {
     $database = new database();
     $dbtype = $database->get_type();
     if ($dbtype == 'mysql') {
         $db_arr = $database->connect();
         if ($db_arr[0] == 1) {
             return array(1, $db_arr[1]);
         }
         $this->db = $db_arr[1];
         $get_query = "SELECT * FROM user WHERE user_name='" . $this->username . "'";
         $get_result = $this->db->query($get_query);
         $get_result_arr = $get_result->fetch_assoc();
         $get_result_count = $get_result->num_rows;
         if ($get_result_count != 1) {
             return array(2, 'Name not found');
         }
     } elseif ($dbtype == 'sqlite') {
         $db_arr = $database->connect_sqlite();
         $this->db = $db_arr;
         // to be implemented
     }
     $this->id = $get_result_arr['user_id'];
     $this->username = $get_result_arr['user_name'];
     $this->email = $get_result_arr['user_email'];
     $this->groupname = $this->group_id_to_name($get_result_arr['user_group']);
     $this->firstname = $get_result_arr['first_name'];
     $this->middlename = $get_result_arr['middle_name'];
     $this->lastname = $get_result_arr['last_name'];
 }
 function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
 {
     if (PHP_VERSION < 6) {
         $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
     }
     //$theValue = function_exists("mysqli_real_escape_string") ? mysqli_real_escape_string($conexion , $theValue) : mysqli_escape_string( $conexion , $theValue);
     if (function_exist) {
         $obj = new database();
         $link = $obj->connect();
         $theValue = mysqli_real_escape_string($link, $theValue);
     }
     switch ($theType) {
         case "text":
             $theValue = $theValue != "" ? "'" . $theValue . "'" : "NULL";
             break;
         case "long":
         case "int":
             $theValue = $theValue != "" ? intval($theValue) : "NULL";
             break;
         case "double":
             $theValue = $theValue != "" ? doubleval($theValue) : "NULL";
             break;
         case "date":
             $theValue = $theValue != "" ? "'" . $theValue . "'" : "NULL";
             break;
         case "defined":
             $theValue = $theValue != "" ? $theDefinedValue : $theNotDefinedValue;
             break;
     }
     return $theValue;
 }
Пример #11
0
 public function database_connect()
 {
     $database = new database();
     $db_arr = $database->connect();
     if ($db_arr[0] == 1) {
         return array(1, $db_arr[1]);
     }
     $this->db = $db_arr[1];
 }
Пример #12
0
 public function __construct()
 {
     if (!$this->db) {
         require_once "resources/classes/database.php";
         $database = new database();
         $database->connect();
         $this->db = $database->db;
     }
     $this->domain_uuid = $_SESSION['domain_uuid'];
 }
Пример #13
0
 /**
  * Called when the object is created
  */
 public function __construct()
 {
     //connect to the database if not connected
     if (!$this->db) {
         require_once "resources/classes/database.php";
         $database = new database();
         $database->connect();
         $this->db = $database->db;
     }
 }
Пример #14
0
 public function __construct()
 {
     //connect to the database if not connected
     if (!$this->db) {
         require_once "resources/classes/database.php";
         $database = new database();
         $database->connect();
         $this->db = $database->db;
     }
     //set the default value
     $this->dialplan_global = false;
 }
Пример #15
0
function validateConnexion($user, $pass)
{
    $result = false;
    $db = new database();
    if ($db->connect()) {
        echo 'db connected <br>';
        if ($db->validateUser($user, $pass)) {
            $result = true;
        }
    }
    $db->disconnect();
    return $result;
}
Пример #16
0
 /**
  * Called when the object is created
  */
 public function __construct()
 {
     //connect to the database if not connected
     require_once "resources/classes/database.php";
     $database = new database();
     $database->connect();
     $this->db = $database->db;
     $this->db_type = $database->type;
     $this->db_name = $database->db_name;
     $this->db_host = $database->host;
     $this->db_port = $database->port;
     $this->db_path = $database->path;
     $this->db_username = $database->username;
     $this->db_password = $database->password;
 }
Пример #17
0
 public function __construct()
 {
     //connect to the database if not connected
     if (!$this->db) {
         require_once "resources/classes/database.php";
         $database = new database();
         $database->connect();
         $this->db = $database->db;
     }
     //get the list of installed apps from the core and mod directories
     $config_list = glob($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH . "/*/*/app_config.php");
     $x = 0;
     foreach ($config_list as &$config_path) {
         include $config_path;
         $x++;
     }
     $this->apps = $apps;
 }
Пример #18
0
 function comment()
 {
     $db = new database();
     $db->connect();
     $this->id = $db->selectData("SELECT max(comid) as maximum from comment");
     while ($this->row = mysqli_fetch_array($this->id)) {
         if (empty($this->row['maximum'])) {
             $this->id_no = "COM00001";
         } else {
             if (intval(substr($this->row['maximum'], 8)) == 99999) {
                 $str = substr($this->row['maximum'], 0, 8);
                 ++$str;
                 $this->id_no = $str . '00001';
             } else {
                 $this->id_no = ++$this->row['maximum'];
             }
         }
     }
     return $this->id_no;
 }
Пример #19
0
 function video()
 {
     $db = new database();
     $db->connect();
     $this->id = $db->execute("SELECT max(video_id) as maximum from video");
     while ($this->row = mysqli_fetch_array($this->id)) {
         if (empty($this->row['maximum'])) {
             $this->id_no = "VID00001";
         } else {
             if (intval(substr($this->row['maximum'], 8)) == 99999) {
                 $str = substr($this->row['maximum'], 0, 8);
                 ++$str;
                 $this->id_no = $str . '00001';
             } else {
                 $this->id_no = ++$this->row['maximum'];
             }
         }
     }
     return $this->id_no;
 }
Пример #20
0
 /**
  * Called when the object is created
  * Creates the database connection object
  */
 public function __construct()
 {
     //create the database connection
     include "root.php";
     require_once "resources/classes/database.php";
     $database = new database();
     $database->connect();
     $this->db = $database->db;
     return $this->db = $database->db;
     //load the plugins
     $this->load_plugins();
     //add values to the required array
     $this->required['headers'][] = "content-type";
     $this->required['headers'][] = "date";
     $this->required['headers'][] = "host";
     $this->required['headers'][] = "status";
     $this->required['headers'][] = "app_name";
     $this->required['headers'][] = "app_uuid";
     $this->required['headers'][] = "domain_uuid";
     $this->required['headers'][] = "user_uuid";
 }
Пример #21
0
<?php

$sitelink = 'http://cardguys.com/Archive/';
$db_host = 'localhost';
$db_username = '******';
$db_password = '******';
$db_name = 'oscar497_cguys_main';
define(SONVT, '');
// connect database
include_once 'includes/class_database.php';
$db = new database();
$db->connect($db_host, $db_username, $db_password, $db_name);
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
include_once 'includes/functions.php';
include_once 'includes/class_security.php';
$security = new security();
$security->logout();
include_once 'class/class_config.php';
$config = new config();
include_once 'class/class_cards_bank.php';
$cards_bank = new cards_bank();
////////////////////////////////////////////////////////
$view = 'list';
include_once 'seosearch.php';
if ($_GET['module']) {
    $module = clear($_GET['module']);
}
$oldmod = $module;
$id = 0;
$type = "";
Пример #22
0
<?php

include "../include/misc.php";
session_start();
if (isset($_GET['email'])) {
    database::connect();
    $_SESSION['email_addr'] = $_GET['email'];
    mysql_query("insert into emails values(null,'" . $_GET['email'] . "')");
    database::disconnect();
}
Пример #23
0
<?php

require_once "../classes/database.php";
$db = new database();
$db->connect();
$postid = $_REQUEST['postid'];
//echo $postid;
if (isset($_REQUEST['postid'])) {
    $query = "SELECT * from post where postid='{$postid}'";
    $result = $db->selectData($query);
    while ($row = mysqli_fetch_array($result)) {
        $upvote = $row['upvote'];
        $downvote = $row['downvote'];
        //echo $upvote." ".$downvote;
    }
    if ($_REQUEST['vote'] == "up") {
        $GLOBALS['upvote']++;
        echo $GLOBALS['upvote'];
        $query = "UPDATE post set upvote='" . $GLOBALS['upvote'] . "' where postid='{$postid}'";
        $db->update($query);
    } else {
        if ($_REQUEST['vote'] == "down") {
            ++$GLOBALS['downvote'];
            //echo $GLOBALS['downvote'];
            $query = "UPDATE post set downvote='{$downvote}' where postid='{$postid}'";
            $db->update($query);
        }
    }
}
Пример #24
0
<?php

require_once "../../class/user.class.php";
require_once "../../class/database.class.php";
session_start();
$db = new database();
$link = $db->connect();
require_once "functionsAdmin.php";
if ($_POST) {
    $email = trim(strip_tags($_POST['email']));
    delete_email($email, $link);
} else {
    header('Location : login.php');
}
Пример #25
0
 }
 /*** changement du status du tournois ***/
 if ($type_tournois == 'E') {
     $new_status = 'H';
 } else {
     $new_status = 'G';
 }
 $db->update("{$dbprefix}tournois");
 $db->set("status = '{$new_status}'");
 $db->where("id = {$s_tournois}");
 $db->exec();
 /*** inscription des teams dans m4 ***/
 if ($modescore_tournois == 'M4') {
     $dbm4 = new database();
     $dbm4->debug($m4dbdebug);
     $dbm4->connect($m4dbhost, $m4dbuser, $m4dbpass, $m4dbname);
     $db->select("id, tag");
     $db->from("{$dbprefix}equipes, {$dbprefix}participe");
     $db->where("{$dbprefix}equipes.id = {$dbprefix}participe.equipe");
     $db->where("tournois = {$s_tournois}");
     $db->order_by("id");
     $res = $db->exec();
     while ($equipes = $db->fetch($res)) {
         /*** suppression de l'equipe dans m4 (eviter les conflits d'id) ***/
         $dbm4->delete("m4_clan");
         $dbm4->where("numero = {$equipes->id}");
         $dbm4->exec();
         /*** insertion de l'equipe inscrites dans m4 ***/
         $dbm4->insert("m4_clan (numero,nom)");
         $dbm4->values("{$equipes->id},'{$equipes->tag}'");
         $dbm4->exec();
Пример #26
0
$db_accounts = "accounts";
$db_register_accounts = "accounts";
$db_previousage_accounts = "accountsold";
$mailheaders = "From: CQ2\n" . "Reply-To: " . $PhantomMail . "\nErrors-To: " . $PhantomMail . "\n";
$cq2version = "1.0";
// Account id's of 'owners'. These have full access to the admin page and can modify the creature database.
// All owner's should also be in the $admins and $moderators array.
$owners = array(1, 2);
// Game admins can do everything owners can do, except for giving golden shards. Game admins should also be placed in the $moderators array.
$admins = array(1, 2, 3);
// Pub moderators. They can only moderate the pub.
$moderators = array(1, 2, 3, 4, 5, 6);
// People who can view the SQL queries of the current page.
$viewqueries = array(1, 2);
// If you can't change the php settings of the server, you can simulate them here.
// simulate register_globals on
/*extract($_GET);
extract($_POST);*/
// simulate magic_quotes_gpc on
/*if (get_magic_quotes_gpc() == 0) {
    foreach ($_GET as $magickey => $magicvalue) {
        $$magickey = addslashes($magicvalue);
    }
    foreach ($_POST as $magickey => $magicvalue) {
        $$magickey = addslashes($magicvalue);
    }
}*/
include_once "db.php";
$db = new database();
$db->connect($db_server, $db_login, $db_password);
$db->select_db($db_database);
Пример #27
0
     }
     $errors_array[] = ERROR_GLOBAL_UPLOADING_DATABASE;
     break;
 case 'finish':
     read_contents(FILE_TMP_FRONT_SERVER, $contents);
     eval($contents);
     read_contents(FILE_TMP_DBASE, $contents);
     eval($contents);
     read_contents(FILE_TMP_CONFIG, $contents);
     eval($contents);
     chdir(DIR_FS_CATALOG);
     require DIR_FS_CLASSES . 'database.php';
     tep_define_vars(DIR_FS_INCLUDES . 'database_tables.php');
     //require(DIR_FS_INCLUDES . 'database_tables.php');
     $g_db = new database();
     $g_db->connect();
     pre_configure_site();
     if (INSTALL_SEO_URLS == 1) {
         $contents = '#-MS- SEO-G Added' . "\n" . 'Options +FollowSymLinks' . "\n" . 'RewriteEngine On' . "\n" . 'RewriteBase ' . DIR_WS_HTTP_CATALOG . "\n\n" . '# Note whatever extension you use it should match the SEO-G configuration -> extension on the admin end even if its blank' . "\n" . '# Also the separators defined in the SEO-G for the various entities should be included in the rule here.' . "\n\n" . '# Rules for extensionless URLs' . "\n" . '# 1. Using a trailing slash' . "\n" . '#RewriteRule ^(.*)/$ root.php?$1&%{QUERY_STRING}' . "\n\n" . '# 2. Not using a trailing slash links with alphanumeric characters and hyphens' . "\n" . '#RewriteRule ^([a-z0-9_-]+)$ root.php?$1&%{QUERY_STRING}' . "\n\n" . '# Rules for URLs with extensions' . "\n" . '#RewriteRule ^(.*).asp$ root.php?$1.asp&%{QUERY_STRING}' . "\n" . '#RewriteRule ^(.*).(htm|html|asp|jsp|aspx)$ root.php?$1.*&%{QUERY_STRING}' . "\n\n" . '# Current Rules to support multiple extensions' . "\n" . '#RewriteRule ^([a-z0-9_-]+)$ root.php?$1&%{QUERY_STRING}' . "\n" . 'RewriteRule ^([/a-z0-9_-]+)$ root.php?$1&%{QUERY_STRING}' . "\n" . 'RewriteRule ^(.*)/$ root.php?$1&%{QUERY_STRING}' . "\n" . 'RewriteRule ^(.*).(htm|html|asp|jsp|aspx)$ root.php?$1.*&%{QUERY_STRING}' . "\n" . '#-MS- SEO-G Added EOM' . "\n";
         $result = write_contents('.htaccess', $contents);
         if (!$result) {
             $errors_array[] = ERROR_GLOBAL_WRITE_HTACCESS;
         }
         $contents = '#-MS- Disable SEO-G on admin folder' . "\n" . 'Options +FollowSymLinks' . "\n" . 'RewriteEngine On' . "\n" . 'RewriteBase ' . DIR_WS_HTTP_CATALOG . 'admin/' . "\n" . 'RewriteRule ^(.*)$ $1 [L]' . "\n" . '#-MS- SEO-G Added EOM' . "\n";
         chdir(DIR_FS_CATALOG . 'admin/');
         $result = write_contents('.htaccess', $contents);
         if (!$result) {
             $errors_array[] = ERROR_GLOBAL_WRITE_HTACCESS;
         }
     }
     chdir($current_dir);
Пример #28
0
            $dbm4->debug($m4dbdebug);
            $dbm4->connect($m4dbhost, $m4dbuser, $m4dbpass, $m4dbname);
            /*** delete du serveur dans m4 ***/
            $dbm4->delete("m4_serveur");
            $dbm4->where("numero = {$id}");
            $dbm4->exec();
            /*** insertion du serveur dans m4 ***/
            $dbm4->insert("m4_serveur (numero,adresse,port,hostname)");
            $dbm4->values("{$id},'{$adresse}','{$port}','{$nom}'");
            $dbm4->exec();
            $dbm4->close();
        }
        if ($insert_ab) {
            $dbab = new database();
            $dbab->debug($abdbdebug);
            $dbab->connect($abdbhost, $abdbuser, $abdbpass, $abdbname);
            /*** delete du serveur dans adminbot ***/
            $dbab->delete("gameserver");
            $dbab->where("ServerId = {$id}");
            $dbab->exec();
            /*** insertion du serveur dans adminbot ***/
            $dbab->insert("gameserver (ServerId,GameId,GameGroupId,ServerAddress,ServerPort,ServerIsUp,ServerType,ServerRcon,ServerHostName)");
            $dbab->values("'{$id}','','','{$adresse}','{$port}','','cs','{$rcon}','{$nom}'");
            $dbab->exec();
            $dbab->close();
        }
        /*** redirection ***/
        js_goto("?page=serveurs&op=modify&id={$id}");
    }
} elseif ($op == "delete") {
    /*** verification securite ***/
Пример #29
0
<?php

// open the config file
$cfg = new config("config.ini");
// open the database connection
$db = new database();
$con = $db->connect($cfg["server"], $cfg["database"], $cfg["username"], $cfg["password"]);
if (!$con) {
    // could not connect to the database
    header("Location: problem.php?code=1");
}
Пример #30
0
    function startheaders()
    {
        global $ir, $set;
        global $_CONFIG;
        define("MONO_ON", 1);
        $db = new database();
        $db->configure($_CONFIG['hostname'], $_CONFIG['username'], $_CONFIG['password'], $_CONFIG['database'], $_CONFIG['persistent']);
        $db->connect();
        $c = $db->connection_id;
        $set = array();
        $settq = $db->query("SELECT * FROM settings");
        while ($r = $db->fetch_row($settq)) {
            $set[$r['conf_name']] = $r['conf_value'];
        }
        $q = $db->query("SELECT userid FROM users");
        $membs = $db->num_rows($q);
        $q = $db->query("SELECT userid FROM users WHERE bankmoney>-1");
        $banks = $db->num_rows($q);
        $q = $db->query("SELECT userid FROM users WHERE gender='Male'");
        $male = $db->num_rows($q);
        $q = $db->query("SELECT userid FROM users WHERE gender='Female'");
        $fem = $db->num_rows($q);
        $money = money_formatter($ir['money']);
        $crystals = money_formatter($ir['crystals'], '');
        $cn = 0;
        // Users Online , Counts Users Online In Last 15 minutes
        $q = $db->query("SELECT * FROM users WHERE laston>unix_timestamp()-15*60 ORDER BY laston DESC");
        $online = $db->num_rows($q);
        $ec = $ir['new_events'];
        $mc = $ir['new_mail'];
        $ids_checkpost = urldecode($_SERVER['QUERY_STRING']);
        if (eregi("[\\'|'/'\\''<'>'*'~'`']", $ids_checkpost) || strstr($ids_checkpost, 'union') || strstr($ids_checkpost, 'java') || strstr($ids_checkpost, 'script') || strstr($ids_checkpost, 'substring(') || strstr($ids_checkpost, 'ord()')) {
            $passed = 0;
            echo "<center> <font color=red> Hack attempt <br/>!!! WARNING !!! <br/>\n\nMalicious Code Detected! The staff has been notified.</font></center>";
            event_add(1, "  <a href='viewuser.php?u={$ir['userid']}'>  <font color=red> " . $ir['username'] . "</font> </a>  <b> Tried to use [" . $_SERVER['SCRIPT_NAME'] . "{$ids_checkpost}].. ", $c);
            $h->endpage();
            exit;
        }
        echo <<<EOF
<!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>{$set['game_name']} - Massive Multiplayer Online Role Playing Game </title>
<meta name="keywords" content="RPG, Online Games, Online Mafia Game" />
<meta name="description" content=" {$set['game_name']} - Online Mafia Game " />
<meta name="author" content="Mafia Game Scripts " />
<meta name="copyright" content="Copyright {$_SERVER['HTTP_HOST']} " />
<link rel="SHORTCUT ICON" href="favicon.ico" />
<script src="js/jquery-1.js" type="text/javascript"></script>
<link rel="stylesheet" href="css/styleold.css" type="text/css" />
<link rel="stylesheet" href="css/stylenew.css" type="text/css" />

<script type="text/javascript" src="js/header.js"></script>
<style type="text/css">
.boston a{
background:url(images/boston.jpg) no-repeat;
}

.boston a:hover{
background:url(images/boston_hover.jpg) no-repeat;
}
</style>
<!--<script type="text/javascript">
\$(document).ready(function(){
\$.get("userstatajax.php",function(res){
if(res)
{
var resarray = res.split('||||||');
\$('.profile_mid').html(resarray[0]);
\$('#points_money').html(resarray[1]);
}
});
});
</script>-->
</head>
<body id="sub" class="yui-skin-sam">

<div id="pagecontainer">
<!-- Header Part Starts -->
<div class="headerpart">

<div class="onlinegame"></div>
<div class="toplist">

</div>
</div>



<!-- //Header Part End -->  

<!-- Inner Page Top Starts -->

<div class="innertopbg">
<div class="toprow1">
<div class="toprow1_col1">
<div class="logo"><a href="index.php"><img src="images/logo.jpg" alt="Logo"/></a></div>
<div class="needbtn"></div>        
<div class="top_leftbtn">
<div class="leftbtn1"> 



</div>
<div class="leftbtn2"> 

</div>

</div>
</div>
<div class="toprow1_col2">
<div class="tot_txt">Total Mobsters:&nbsp;&nbsp;<span>{$membs}</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Online Now: <span>{$online}</span></div>
<div class="messagepart">
<div class="message_txt"><a href="mailbox.php" style="color:#fff;"><span>({$mc})</span> Messages</a></div>

<div class="event_txt"><a href="events.php" style="color:#fff;"><span>({$ec})</span> Events</a></div> </div>  <br/>
<div class="messagepart" id="points_money">
<div class="point_txt">Crystals:&nbsp;<span> {$crystals} </span><br/></div>
<div class="gold_txt">Money:&nbsp;<span>{$money}</span></div>

</div>              
</div>
</div>
<!-- Menu Part Starts -->
<div class="toprow2">
<div><img src="images/menu_left.jpg" alt="" /></div>
<div class="menu_md">
<ul>
<li class="ihome_active"><a href="index.php"></a></li>

<li class="gym"><a href="gym.php">&nbsp;</a></li>
<li class="news"><a href="newspaper.php">&nbsp;</a></li>
<li class="forum"><a href="forums.php">&nbsp;</a></li>
<li class="boston"><a href="explore.php">&nbsp;</a></li>
<li class="protect"><a href="bodyguard.php">&nbsp;</a></li>
<li class="logout"><a href="logout.php">&nbsp;</a></li>                            
</ul>                        
</div>
<div><img src="images/menu_right.jpg" alt="" /></div>
</div>            
<!-- //Menu Part End -->

</div>  

<!-- //Inner Page Top End -->


<div class="toprow2">
<div><img src="images/menu_left.jpg" alt="" /></div>
<div class="menu_md">


<br/>


<h2 class="headerpart1a"><span class='text2 title4'>Support {$set['game_name']} <a href='voting.php'>Vote</a> | <a href='donator.php'>Donate</a> | <a href='willpotion.php'>Will Potion</a></span></h2>



</div><div><img src="images/menu_right.jpg" alt="" /></div>
</div>  </div><br/> 
<br/> <br/><br/>    

<div class="gymbg">
<div id="centercontainer">

<div id="centermaincontainer">

<!-- Center Part Starts -->
                    <div class="icenterpart"><div class="icolumn1">



EOF;
    }