示例#1
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();
}
示例#2
0
 public static function get($variable, $default)
 {
     $s = database::select("variables", array("variable_value"), "variable_name='%var'", array("%var" => $variable));
     if (($b = database::fetch($s, PDO::FETCH_COLUMN)) != null) {
         return json_decode($b, true);
     } else {
         return $default;
     }
 }
示例#3
0
 public static function challenge_login($user, $pass)
 {
     $result = false;
     $query = database::select('id, password')->tables('user')->where('username', '=', ':username')->where('status', '=', 1, 'and')->param(':username', $user)->limit(1)->execute();
     $query_result = $query->fetch();
     if ($query_result && bcrypt::verify(user::config()->get('salt') . $query_result->uid . $pass, $query_result->pass)) {
         $result = (int) $query_result->id;
     }
     return $result;
 }
示例#4
0
 public static function get_message_count($game_id)
 {
     if (safe_input::is_number($game_id)) {
         $db = new database();
         $db->select("message", "*", "gameID= {$game_id} ");
         return $db->number_of_rows();
     } else {
         return -1;
         //invalid game_id
     }
 }
示例#5
0
 public function __construct($argv)
 {
     self::$network_time = time();
     // network time, sets to self::$network_time until we recieve some info from a main server.
     $parser = new parser(CONFPATH . 'services.conf');
     // get the config values.
     self::$debug = $argv[1] == 'debug' ? true : false;
     // is debug mode running? y/n
     if (isset(self::$config->nickserv)) {
         self::$service_bots[] = 'nickserv';
     }
     if (isset(self::$config->chanserv)) {
         self::$service_bots[] = 'chanserv';
     }
     if (isset(self::$config->operserv)) {
         self::$service_bots[] = 'operserv';
     }
     // setup our $config->service_bots dir
     $this->timer = new timer();
     $this->mode = new mode();
     $this->services = new services();
     $this->commands = new commands();
     $this->modules = new modules();
     // setup all the subclasses.
     database::factory(self::$config->database->driver);
     // setup the db.
     self::$socket = self::connect();
     // connect to the socket
     self::protocol_init();
     // load the protocol class
     $select = database::select('core', array('max_users'), array('id', '=', '1'));
     $max_users = database::row($select);
     // get the max users
     self::$max_users = $max_users[0];
     // set a global variable
     timer::add(array('core', 'reset_flood_cache', array()), 120, 0);
     // add a timer to reset the flood cache every
     // 120 seconds, indefinatly
     if (self::$config->settings->loglevel != 'off' || !isset(self::$config->settings->loglevel)) {
         timer::add(array('core', 'save_logs', array()), 300, 0);
     }
     // add another timer to save logs every 5 mins
     timer::add(array('core', 'check_unused_chans', array()), 5, 0);
     // and another one to check for unused channels every 5 seconds XD
     if (is_resource(self::$socket)) {
         $this->main_loop();
     } else {
         exit;
     }
     // execute the main program loop
 }
示例#6
0
 public static function getGameById($game_id)
 {
     if (safe_input::is_number($game_id)) {
         $db = new database();
         $db->select("game", "*", "id= {$game_id} ");
         if ($db->number_of_rows() > 0) {
             return $db->fetch_row();
         } else {
             return FALSE;
         }
     } else {
         return false;
     }
 }
示例#7
0
 public static function _find_match($term, $mode, $limit)
 {
     $new_term = str_replace('*', '%', $term);
     // search for a nickname
     // allow the ability to search with "*"'s
     $limit = database::quote($limit);
     $s_limit = explode('-', $limit);
     $offset = $s_limit[0];
     $max = $s_limit[1];
     // split up the limit and stuff ^_^
     if ($mode == 'suspended') {
         $results = database::select('users', array('id', 'display', 'last_hostmask', 'suspended', 'suspend_reason'), array('suspended', '=', '1', 'AND', 'display', 'LIKE', $new_term), '', array($offset => $max));
     } else {
         $results = database::select('users', array('id', 'display', 'last_hostmask', 'suspended', 'suspend_reason'), array('suspended', '=', '0', 'AND', 'display', 'LIKE', $new_term), '', array($offset => $max));
     }
     return $results;
 }
示例#8
0
<?php

session_start();
$pid = '';
if (isset($_GET['pid'])) {
    $pid = $_GET['pid'];
}
require_once "../../lib/server-config.php";
require_once "../../lib/connect.class.php";
$db = new database();
$db->connect2(trim($u), trim($p), trim($dbn));
$strSQL = sprintf("SELECT * FROM " . substr(strtolower($tbf), 0, -2) . "%s WHERE record_id = '%s'", mysql_real_escape_string("registerrecord"), mysql_real_escape_string($pid));
$resultRegister = $db->select($strSQL, false, true);
if (!$resultRegister) {
}
?>
<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="Introducing Lollipop, a sweet new take on Android.">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>SIMANH South Africa</title>

    <!-- Page styles -->
    <link href="https://fonts.googleapis.com/css?family=Roboto:regular,bold,italic,thin,light,bolditalic,black,medium&amp;lang=en" rel="stylesheet">
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
    <link rel="stylesheet" href="./css/material.min.css">
    <link rel="stylesheet" href="styles.css">
    <link rel="stylesheet"  type="text/css" href="css/style.css" />
示例#9
0
<?php

$userdata = $this->_userData;
$has_ads_pin = $userdata['ads_pin'];
if ($has_ads_pin != NULL) {
    $ads_pin = $has_ads_pin;
    $selectPin = "disabled";
} else {
    $ads_pin = "";
    $selectPin = NULL;
}
$db = new database(DBTYPE, DBHOST, DBNAME, DBUSER, DBPASS);
$checkPin = $db->select("user_accounts", "acc_type", "agent_id = '{$has_ads_pin}'", "fetch");
if ($checkPin['acc_type'] == 'admin') {
    $selectPin = NULL;
}
$accType = $this->accType;
$bankList = $this->bankList;
$paymentMethodList = $this->paymentMethodList;
$accCode = $userdata['acc_type'];
$colSize = $accCode != "pb" ? "col-md-6" : "col-md-12";
$notPB = $accCode != "pb" ? TRUE : FALSE;
?>

<div class="col-xs-12">
    <h2 class="page-header">Account Setup</h2>
    <?php 
include 'menu.php';
?>
    <div>
        <div class="account-setup tab-content">
示例#10
0
<?php

session_start();
include "./server-config.php";
$strUsername = trim($_POST["data1"]);
$strPassword = trim($_POST["data2"]);
$strPassword = md5($strPassword);
require "connect.class.php";
$db = new database();
$db->connect2(trim($u), trim($p), trim($dbn));
$strSQL = sprintf("SELECT * FROM " . substr(strtolower($tbf), 0, -2) . "useraccount WHERE username = '******' and password = '******' and status = '1'", mysql_real_escape_string($strUsername), mysql_real_escape_string($strPassword));
$resultaccount = $db->select($strSQL, false, true);
if ($resultaccount) {
    print "Y";
    $_SESSION['userSIMANHsession'] = session_id();
    $_SESSION['userSIMANHusername'] = $resultaccount[0]['username'];
    session_write_close();
} else {
    //print $strSQL;
    print "N";
}
$db->disconnect();
示例#11
0
 public static function get_all_roles()
 {
     return database::fetchAll(database::select("groups"));
 }
示例#12
0
<?php

session_start();
include "./../lib/server-config.php";
require "./../lib/connect.class.php";
$db = new database();
$db->connect2(trim($u), trim($p), trim($dbn));
//Check user priviledge
$strSQL = sprintf("SELECT * FROM " . substr(strtolower($tbf), 0, -2) . "%s WHERE username = '******' and status = 1 and user_type_id = '%s'", mysql_real_escape_string("useraccount"), mysql_real_escape_string($_SESSION['userSIMANHusername']), mysql_real_escape_string(3));
$resultUser = $db->select($strSQL, false, true);
//If privilegde available
if ($resultUser) {
    $strSQL = sprintf("SELECT * FROM " . substr(strtolower($tbf), 0, -2) . "%s \n\t\t\t\tWHERE record_id = '%s'", mysql_real_escape_string("outcome"), mysql_real_escape_string($_SESSION['userSIMANHmother_record']));
    $resultSelectOutcome = $db->select($strSQL, false, true);
    $no = 1;
    if ($resultSelectOutcome) {
        $no = sizeof($resultSelectOutcome);
    }
    $strSQL = sprintf("INSERT INTO " . substr(strtolower($tbf), 0, -2) . "%s \n\t\t\t\tVALUE ('','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s','%s'\n\t\t\t\t,'%s','%s','%s')", mysql_real_escape_string("outcome"), mysql_real_escape_string($_POST['gender']), mysql_real_escape_string($_POST['alive']), mysql_real_escape_string($_POST['stillbirth']), mysql_real_escape_string($_POST['ag5']), mysql_real_escape_string($_POST['ag10']), mysql_real_escape_string($_POST['rbm']), mysql_real_escape_string($_POST['birth_wieght']), mysql_real_escape_string($_POST['hc']), mysql_real_escape_string($_POST['fetal_length']), mysql_real_escape_string($_POST['bdf']), mysql_real_escape_string($_POST['bdf_identify']), mysql_real_escape_string($_POST['bdn']), mysql_real_escape_string($_POST['ebf']), mysql_real_escape_string($_POST['bf']), mysql_real_escape_string($_POST['ff']), mysql_real_escape_string($_POST['skin2skin']), mysql_real_escape_string($_POST['pmctv_lb']), mysql_real_escape_string($_POST['nb_adm']), mysql_real_escape_string($_POST['nb_date_adm']), mysql_real_escape_string($_POST['nb_time_adm']), mysql_real_escape_string($_POST['nb_neonatal']), mysql_real_escape_string($_POST['nb_refer']), mysql_real_escape_string($_POST['nb_refer_facility']), mysql_real_escape_string("nb." . $_SESSION['userSIMANHmother_record'] . "-" . $no), mysql_real_escape_string($_SESSION['userSIMANHmother_record']));
    $resultInsert = $db->insert($strSQL, false, true);
    if ($resultInsert) {
        $strSQL = sprintf("SELECT record_id FROM " . substr(strtolower($tbf), 0, -2) . "%s WHERE record_id = '%s' ", mysql_real_escape_string("outcome"), mysql_real_escape_string($_SESSION['userSIMANHmother_record']));
        $resultCheck = $db->select($strSQL, false, true);
        if ($resultCheck) {
            $db->disconnect();
            ?>
			<script>
					alert('Delivery information complete!');
					window.location = '../enter/main.php?id=4';
			</script>
			<?php 
示例#13
0
文件: user.php 项目: kronxblue/1stg
 public static function getMessages($cond = NULL, $fetch = "fetchAll")
 {
     if ($cond != NULL) {
         $where = $cond;
     } else {
         $where = NULL;
     }
     $db = new database(DBTYPE, DBHOST, DBNAME, DBUSER, DBPASS);
     $data = $db->select("user_messages", "*", $where, $fetch);
     return $data;
 }
示例#14
0
文件: setup.php 项目: kronxblue/1stg
 function complete()
 {
     $userdata = $this->user;
     $agent_id = $userdata['agent_id'];
     $paymentComplete = TRUE;
     $db = new database(DBTYPE, DBHOST, DBNAME, DBUSER, DBPASS);
     $hasPayment = user::checkExist("user_payment", "agent_id = '{$agent_id}'");
     $paymentDetails = $db->select("user_payment", "payment_date, payment_time, from_acc, to_acc, payment_type", "agent_id = '{$agent_id}'", "fetch");
     if ($paymentDetails != FALSE) {
         foreach ($paymentDetails as $key => $value) {
             if (empty($value)) {
                 $paymentComplete = FALSE;
             }
         }
     } else {
         $paymentComplete = FALSE;
     }
     if (!$hasPayment or !$paymentComplete) {
         redirect::to("setup/payment");
     }
     $this->breadcrumb->add("Complete", "setup/complete");
     $this->view->breadcrumbs = $this->breadcrumb->get();
     $this->view->js = array('setup/js/setup.js');
     $this->view->render('setup/complete', 'backoffice');
 }
示例#15
0
<?php

session_start();
include "./../lib/server-config.php";
require "./../lib/connect.class.php";
$db = new database();
$db->connect2(trim($u), trim($p), trim($dbn));
$key = $_POST["key"];
//Check user priviledge
$strSQL = sprintf("SELECT * FROM " . substr(strtolower($tbf), 0, -2) . "%s WHERE username = '******' and status = 1 and user_type_id = '%s'", mysql_real_escape_string("useraccount"), mysql_real_escape_string($_SESSION['userSIMANHusername']), mysql_real_escape_string(3));
$resultUser = $db->select($strSQL, false, true);
if ($resultUser) {
    $strSQL = "SELECT * FROM " . substr(strtolower($tbf), 0, -2) . "registerrecord\n\t\t\t\tWHERE (pid like '" . $key . "%' or p_fname like '%" . $key . "%'  or p_lname like '%" . $key . "%'  or point_no = '%" . $key . "%'\n\t\t\t\t or folder_no = '%" . $key . "%') and confirm_status = '0' and username in (SELECT username FROM " . substr(strtolower($tbf), 0, -2) . "userdescription WHERE institute_id in (SELECT institute_id FROM " . substr(strtolower($tbf), 0, -2) . "userdescription WHERE username = '******'userSIMANHusername'] . "'))";
    $resultSearch = $db->select($strSQL, false, true);
    if ($resultSearch) {
        ?>
		<table width="100%" border="0" cellspacing="0" cellpadding="0" >
          <tr>
            <td height="25" width="40" align="left"  style="padding-left:5px; color:#FFF; font-size:0.8em;" bgcolor="#669999"><strong>No
            </th>
            </strong>
            <td  align="left"  style="padding-left:5px; color:#FFF; font-size:0.8em;" bgcolor="#669999"><strong>Full name
            </th>
            </strong>
            <td  align="left" width="120"   style="padding-left:5px; color:#FFF; font-size:0.8em;" bgcolor="#669999"><strong>Admission date
            </th>
            </strong>
            <td  align="left" width="80"   style="padding-left:5px; color:#FFF; font-size:0.8em;" bgcolor="#669999"><strong>Status                         
            </strong>
            <td  align="left" width="150"   style="padding-left:5px; color:#FFF; font-size:0.8em;" bgcolor="#669999"><strong>Labour</strong>            </tr>
		<?php 
示例#16
0
文件: index.php 项目: rooterA/ex01
<?php

/*
 * php code///////////**********************************************************
 */
$title = 'ระบบจัดการร้านค้า';
$db = new database();
$option_user = array("table" => "users");
$query_user = $db->select($option_user);
/*
 * php code///////////**********************************************************
 */
/*
 * header***********************************************************************
 */
require 'template/back/header.php';
/*
 * header***********************************************************************
 */
?>

<div id="page-warpper">
    <div class="row">
        <div class="col-lg-12">
            <h1 class="page-header">ยินดีต้อนรับ!</h1>
        </div>
    </div>
    <div class="row">
        <div class="col-lg-12">
            <div class="alert alert-info" role="alert">ยินดีต้อนรับสู่ระบบ ecProduct by itOffside.com</div>
        </div>
示例#17
0
<?php

session_start();
$pid = '';
if (isset($_GET['pid'])) {
    $pid = $_GET['pid'];
}
require_once "../../lib/server-config.php";
require_once "../../lib/connect.class.php";
$db = new database();
$db->connect2(trim($u), trim($p), trim($dbn));
$strSQL = sprintf("SELECT * FROM " . substr(strtolower($tbf), 0, -2) . "%s WHERE record_id = '%s'", mysql_real_escape_string("outcome"), mysql_real_escape_string($pid));
$resultOutcome = $db->select($strSQL, false, true);
if (!$resultOutcome) {
}
?>
<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="Introducing Lollipop, a sweet new take on Android.">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>SIMANH South Africa</title>

    <!-- Page styles -->
    <link href="https://fonts.googleapis.com/css?family=Roboto:regular,bold,italic,thin,light,bolditalic,black,medium&amp;lang=en" rel="stylesheet">
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
    <link rel="stylesheet" href="./css/material.min.css">
    <link rel="stylesheet" href="styles.css">
    <link rel="stylesheet"  type="text/css" href="css/style.css" />
示例#18
0
<?php

session_start();
include "./../lib/server-config.php";
require "./../lib/connect.class.php";
$db = new database();
$db->connect2(trim($u), trim($p), trim($dbn));
//Check user priviledge
$strSQL = sprintf("SELECT * FROM " . substr(strtolower($tbf), 0, -2) . "%s WHERE username = '******' and status = 1 and user_type_id = '%s'", mysql_real_escape_string("useraccount"), mysql_real_escape_string($_SESSION['userSIMANHusername']), mysql_real_escape_string(3));
$resultUser = $db->select($strSQL, false, true);
if ($resultUser) {
    $strSQL = sprintf("SELECT * FROM " . substr(strtolower($tbf), 0, -2) . "%s WHERE record_id = '%s'", mysql_real_escape_string("registerrecord"), mysql_real_escape_string($_GET['id']));
    $resultRecord = $db->select($strSQL, false, true);
    if ($resultRecord) {
        $strSQL = sprintf("DELETE FROM " . substr(strtolower($tbf), 0, -2) . "%s WHERE record_id = '%s'", mysql_real_escape_string("delivery"), mysql_real_escape_string($resultRecord[0]['record_id']));
        $resultDelete = $db->delete($strSQL);
        $strSQL = sprintf("DELETE FROM " . substr(strtolower($tbf), 0, -2) . "%s WHERE record_id = '%s'", mysql_real_escape_string("obstetric"), mysql_real_escape_string($resultRecord[0]['record_id']));
        $resultDelete = $db->delete($strSQL);
        $strSQL = sprintf("DELETE FROM " . substr(strtolower($tbf), 0, -2) . "%s WHERE record_id = '%s'", mysql_real_escape_string("other_postnatal"), mysql_real_escape_string($resultRecord[0]['record_id']));
        $resultDelete = $db->delete($strSQL);
        $strSQL = sprintf("DELETE FROM " . substr(strtolower($tbf), 0, -2) . "%s WHERE record_id = '%s'", mysql_real_escape_string("outcome"), mysql_real_escape_string($resultRecord[0]['record_id']));
        $resultDelete = $db->delete($strSQL);
        $strSQL = sprintf("DELETE FROM " . substr(strtolower($tbf), 0, -2) . "%s WHERE record_id = '%s'", mysql_real_escape_string("postnatal"), mysql_real_escape_string($resultRecord[0]['record_id']));
        $resultDelete = $db->delete($strSQL);
        $strSQL = sprintf("DELETE FROM " . substr(strtolower($tbf), 0, -2) . "%s WHERE record_id = '%s'", mysql_real_escape_string("registerrecord"), mysql_real_escape_string($resultRecord[0]['record_id']));
        $resultDelete = $db->delete($strSQL);
        $strSQL = sprintf("SELECT * FROM " . substr(strtolower($tbf), 0, -2) . "%s WHERE record_id = '%s'", mysql_real_escape_string("registerrecord"), mysql_real_escape_string($_GET['id']));
        $resultRecord = $db->select($strSQL, false, true);
        if ($resultRecord) {
            // Delete fail
            $db->disconnect();
示例#19
0
<?php

session_start();
$pid = '';
if (isset($_GET['pid'])) {
    $pid = $_GET['pid'];
}
require_once "../../lib/server-config.php";
require_once "../../lib/connect.class.php";
$db = new database();
$db->connect2(trim($u), trim($p), trim($dbn));
$strSQL = sprintf("SELECT * FROM " . substr(strtolower($tbf), 0, -2) . "%s WHERE record_id = '%s'", mysql_real_escape_string("complication_delivery"), mysql_real_escape_string($pid));
$resultCom = $db->select($strSQL, false, true);
if (!$resultCom) {
}
?>
<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="Introducing Lollipop, a sweet new take on Android.">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>SIMANH South Africa</title>

    <!-- Page styles -->
    <link href="https://fonts.googleapis.com/css?family=Roboto:regular,bold,italic,thin,light,bolditalic,black,medium&amp;lang=en" rel="stylesheet">
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
    <link rel="stylesheet" href="./css/material.min.css">
    <link rel="stylesheet" href="styles.css">
    <link rel="stylesheet"  type="text/css" href="css/style.css" />
示例#20
0
 public static function confirm_command($nick, $ircdata = array())
 {
     $code = $ircdata[0];
     if (trim($code) == '') {
         services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INVALID_SYNTAX_RE, array('help' => 'CONFIRM'));
         return false;
     }
     // wrong syntax
     if (!($user = services::user_exists($nick, false, array('display', 'id')))) {
         services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_UNREGISTERED);
         return false;
     }
     // unregistered
     $code_array = database::select('validation_codes', array('nick', 'code'), array('nick', '=', $nick, 'AND', 'code', '=', $code));
     if (database::num_rows($code_array) == 0) {
         services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_INVALID_PASSCODE);
     } else {
         services::communicate(core::$config->nickserv->nick, $nick, &nickserv::$help->NS_VALIDATED);
         // let them know.
         database::update('users', array('validated' => 1), array('id', '=', $user->id));
         // user is now validated.
         database::delete('validation_codes', array('nick', '=', $nick, 'AND', 'code', '=', $code));
         // delete the code now that we've validated them
         core::alog(core::$config->nickserv->nick . ': ' . $nick . ' activated');
         // logchan
     }
     // no passcode found
 }
示例#21
0
         $errors_string = ERROR_GLOBAL_ADMIN_WRITE_MAIN_CONFIG;
         redirect($_SERVER['SCRIPT_NAME'] . '?action=database&error_string=' . $error_string);
     }
     if (!write_contents(DIR_FS_CATALOG . 'admin/' . DIR_WS_INCLUDES . 'configure_site.php', $buffer3)) {
         $errors_string = ERROR_GLOBAL_ADMIN_WRITE_SITE_CONFIG;
         redirect($_SERVER['SCRIPT_NAME'] . '?action=database&error_string=' . $error_string);
     }
     require DIR_FS_CLASSES . 'database.php';
     chdir($current_dir);
     $g_db = new database();
     $result = $g_db->connect();
     if (!$result) {
         $error_string = ERROR_GLOBAL_DBASE_CONNECT;
         redirect($_SERVER['SCRIPT_NAME'] . '?action=database&error_string=' . $error_string);
     }
     $result = $g_db->select(DB_DATABASE);
     if (!$result) {
         $g_db->query("create database " . $g_db->input(DB_DATABASE) . " DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci");
         $result = $g_db->select(DB_DATABASE);
         if (!$result) {
             $error_string = ERROR_GLOBAL_DBASE_CREATE;
             redirect($_SERVER['SCRIPT_NAME'] . '?action=database&error_string=' . $error_string);
         }
     }
     $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);
示例#22
0
$db = new database();
$db->connect2(trim($u), $p, trim($dbn));
if (!isset($_GET['group_id'])) {
    ?>
	<script>
    	alert('Parameter error!');
		window.location = './main.php?id=1&group_id=<?php 
    print $_GET['group_id'];
    ?>
&tab_id=4';
    </script>
	<?php 
    exit;
}
$strSQL = "SELECT * FROM " . substr(strtolower($tbf), 0, -2) . "parameter_subgroup WHERE sg_name = '" . $_POST['var_subgroup'] . "'";
$resultParametor = $db->select($strSQL, false, true);
$order = 1;
//No any duplicate
if (!$resultParametor) {
    $strSQL = "INSERT INTO `db_simanh`.`" . substr(strtolower($tbf), 0, -2) . "parameter_subgroup` VALUES ('NULL','" . $_POST['var_subgroup'] . "','1','" . $_GET['group_id'] . "')";
    $resultInsert = $db->insert($strSQL, false, true);
    $strSQL = "SELECT * FROM " . substr(strtolower($tbf), 0, -2) . "parameter_subgroup WHERE sg_name = '" . $_POST['var_subgroup'] . "'";
    $resultselect = $db->select($strSQL, false, true);
    if ($resultselect) {
        ?>
	<script>
    	alert('Add parameter success!');
		window.location = './main.php?id=1&group_id=<?php 
        print $_GET['group_id'];
        ?>
&tab_id=4';
示例#23
0
<?php

class database
{
    protected static $c;
    protected $s;
    public function __construct()
    {
        static::$c = new PDO('mysql:host=localhost;dbname=leaderboard', 'root', '');
        static::$c->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    }
    public function p($query)
    {
        $this->s = static::$c->prepare($query);
        $this->s->setFetchMode(PDO::FETCH_ASSOC);
    }
    public function e($data = array())
    {
        $this->s->execute($data);
    }
    public function select($query)
    {
        $this->p($query);
        $this->e();
        return $this->s->fetchAll();
    }
}
$db = new database();
echo json_encode($db->select("SELECT * FROM `tmp` ORDER BY score DESC"));
示例#24
0
$config = array();
$mods = array();
$garde = array();
//$garde=array("a" => "",    "b" => "",    "c" => "","d" => "",    "e" => "","f" => "",	"g" => "",    "h" => "",    "i" => "",	"j" => "",    "k" => "",    "l" => "",	"m" => "",    "n" => "",    "o" => "","p" => "",	"q" => "",	"r" => "",	"s" => "",	"t" => "",	"u" => "",	"v" => "",	"w" => "",	"x" => "",	"y" => "",	"z" => "",);
//$is_grade=grade_s($s_joueur);
include 'config.php';
if (!defined("PHPTOURNOIS_INSTALLED")) {
    header("Location: install.php");
    die;
}
/*** ouverture de la base de donnees ***/
$db = new database();
$db->debug($dbdebug);
$db->connect($dbhost, $dbuser, $dbpass, $dbname);
/*** chargement de la configuration dynamique***/
$db->select("*");
$db->from("{$dbprefix}config");
$db->exec();
$config = array_merge($config, $db->fetch_array());
if (isset($m4url)) {
    $config['m4url'] = $m4url;
} else {
    $config['m4url'] = '';
}
if (isset($aburl)) {
    $config['aburl'] = $aburl;
} else {
    $config['aburl'] = '';
}
/*** chargement de la configuration des mods***/
$db->select("*");
示例#25
0
/********* Setting up hospital list ***********/
$hos = array();
$hoslist = "(";
//Splite hospital
if (isset($_GET['hospital'])) {
    $hos = explode('|', $_GET['hospital']);
    foreach ($hos as $h) {
        if ($h != '') {
            $hoslist .= "'" . $h . "',";
        } else {
            $hoslist .= "'0000')";
        }
    }
} else {
    $strSQL = "SELECT institute_id FROM fmn1_institute WHERE 1";
    $resultInst = $db->select($strSQL, false, true);
    if ($resultInst) {
        foreach ($resultInst as $h) {
            if ($h != '') {
                $hoslist .= "'" . $h[0] . "',";
                $hos[] = $h[0];
            } else {
                $hoslist .= "'0000')";
            }
        }
        $hoslist .= "'0000')";
    }
}
foreach ($hos as $v) {
    //print $v."<br>";
}
示例#26
0
<?php

session_start();
$pid = '';
if (isset($_GET['pid'])) {
    $pid = $_GET['pid'];
}
require_once "../../lib/server-config.php";
require_once "../../lib/connect.class.php";
$db = new database();
$db->connect2(trim($u), trim($p), trim($dbn));
$strSQL = sprintf("SELECT * FROM " . substr(strtolower($tbf), 0, -2) . "%s WHERE record_id = '%s'", mysql_real_escape_string("obstetric"), mysql_real_escape_string($pid));
$resultObstetric = $db->select($strSQL, false, true);
?>
<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="Introducing Lollipop, a sweet new take on Android.">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>SIMANH South Africa</title>

    <!-- Page styles -->
    <link href="https://fonts.googleapis.com/css?family=Roboto:regular,bold,italic,thin,light,bolditalic,black,medium&amp;lang=en" rel="stylesheet">
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
    <link rel="stylesheet" href="./css/material.min.css">
    <link rel="stylesheet" href="styles.css">
    <link rel="stylesheet"  type="text/css" href="css/style.css" />
    <style>
    #view-source {
示例#27
0
<html>
<head><TITLE></TITLE></head>

<body>

<h1>Transfer Parents to new table</h1>
<?php 
include "liboutput.php";
include "libdatabase.php";
// connect database
$daba = new database();
$daba->connect("localhost", "iggmp", "1s87J37r0");
$daba->select("thesaurus");
$res = mysql_query("SELECT * FROM entry where descriptor='0'");
$tempArray = fetch_to_array($res, "");
echo "Anzahl: " . count($tempArray) . "<hr>";
foreach ($tempArray as $entry) {
    echoall($entry);
    database::query("UPDATE entry SET status='1' WHERE ID='" . $entry[ID] . "'");
    echo "<hr>";
}
?>


</body></html>
示例#28
0
<?php

include 'classDatabase.php';
if (isset($_GET['lat']) && isset($_GET['rad'])) {
    $myDb = new database();
    $var = str_replace(["(", ")"], "", $_GET['lat']);
    $lat = explode(", ", $var)[0];
    $long = explode(", ", $var)[1];
    $radius = $_GET['rad'] / 1000;
    $sql = "SELECT DISTINCT `ADDRESS`,lat, `long`, ( 6371 * ACOS( COS( RADIANS({$lat}) ) * COS( RADIANS( lat ) ) * COS( RADIANS( `LONG` ) - RADIANS({$long}) ) + SIN( RADIANS({$lat}) ) * SIN( RADIANS( lat ) ) ) ) AS distance FROM `address_lat_long` HAVING distance < {$radius} ORDER BY distance;";
    //$sql="SELECT DISTINCT `ADDRESS`,lat, `long`, ( 3959 * ACOS( COS( RADIANS(-6.323258) ) * COS( RADIANS( lat ) ) * COS( RADIANS( `LONG` ) - RADIANS(106.669443) ) + SIN( RADIANS(-6.323258) ) * SIN( RADIANS( lat ) ) ) ) AS distance FROM `address_lat_long` HAVING distance < 1 ORDER BY distance LIMIT 0 , 20;";
    $results = [];
    $res = $myDb->select($sql);
    while ($row = mysqli_fetch_array($res)) {
        $results[] = array('description' => $row[0], 'lat' => $row[1], 'lng' => $row[2]);
    }
    header('Content-Type: application/json');
    $json = json_encode($results);
    echo $json;
}
示例#29
0
<?php

session_start();
$pid = '';
if (isset($_GET['pid'])) {
    $pid = $_GET['pid'];
}
require_once "../../lib/server-config.php";
require_once "../../lib/connect.class.php";
$db = new database();
$db->connect2(trim($u), trim($p), trim($dbn));
$strSQL = sprintf("SELECT * FROM " . substr(strtolower($tbf), 0, -2) . "%s WHERE record_id = '%s'", mysql_real_escape_string("delivery"), mysql_real_escape_string($pid));
$resultDelivery = $db->select($strSQL, false, true);
if (!$resultDelivery) {
}
?>
<!doctype html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="Introducing Lollipop, a sweet new take on Android.">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>SIMANH South Africa</title>

    <!-- Page styles -->
    <link href="https://fonts.googleapis.com/css?family=Roboto:regular,bold,italic,thin,light,bolditalic,black,medium&amp;lang=en" rel="stylesheet">
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
    <link rel="stylesheet" href="./css/material.min.css">
    <link rel="stylesheet" href="styles.css">
    <link rel="stylesheet"  type="text/css" href="css/style.css" />
示例#30
0
<?php

session_start();
include "../lib/server-config.php";
require "../lib/connect.class.php";
$db = new database();
$db->connect2(trim($u), trim($p), trim($dbn));
//Query institute's name for check duplicate
$strSQL = sprintf("SELECT * FROM " . substr(strtolower($tbf), 0, -2) . "%s WHERE institute_name = '%s'", mysql_real_escape_string("institute"), mysql_real_escape_string($_POST['inst_name']));
$resultInstitute = $db->select($strSQL, false, true);
$order = 1;
if (!$resultInstitute) {
    if (sizeof($resultInstitute) > 0) {
        //Duplication institute's name
        $db->disconnect();
        ?>
			<script>
				alert('Duplication institute\'s name!');
				window.location = './main.php?id=3&group_id=<?php 
        print $_POST['inst_type'];
        ?>
&tab_id=1';
			</script>
			<?php 
        exit;
    }
    //Insert new institute
    $strSQL = sprintf("INSERT INTO " . substr(strtolower($tbf), 0, -2) . "%s \n\t\t\t\t\t   VALUES ('NULL','%s','%s','%s','%s','%s','%s','%s')", mysql_real_escape_string("institute"), mysql_real_escape_string($_POST['inst_name']), mysql_real_escape_string($_POST['inst_desc']), mysql_real_escape_string($_POST['inst_phone']), mysql_real_escape_string($_POST['lat_value']), mysql_real_escape_string($_POST['lon_value']), mysql_real_escape_string($_POST['inst_type']), mysql_real_escape_string(0));
    $resultInsert = $db->insert($strSQL, false, true);
    $strSQL = sprintf("SELECT * FROM " . substr(strtolower($tbf), 0, -2) . "%s WHERE institute_name = '%s'", mysql_real_escape_string("institute"), mysql_real_escape_string($_POST['inst_name']));
    $resultInstitute2 = $db->select($strSQL, false, true);