예제 #1
0
 public function __construct($ID)
 {
     $query = db::prepare("SELECT * FROM passenger WHERE id=?");
     $query->bindValue(1, $ID);
     try {
         $query->execute();
     } catch (PDOException $e) {
         die($e->getMessage());
     }
     $passengerInfo = $query->fetchAll();
     $this->id = $passengerInfo[0][0];
     $this->prefix = $passengerInfo[0][1];
     $this->first_name = $passengerInfo[0][2];
     $this->last_name = $passengerInfo[0][3];
     $this->middle_name = $passengerInfo[0][4];
     $this->suffix = $passengerInfo[0][5];
     $this->date_of_birth = $passengerInfo[0][6];
     $this->gender = $passengerInfo[0][7];
     $this->emergency_contact_phone = $passengerInfo[0][8];
     $this->emergency_contact_country = $passengerInfo[0][9];
     $this->emergency_contact_first_name = $passengerInfo[0][10];
     $this->emergency_contact_last_name = $passengerInfo[0][11];
     $this->date_added = $userInfo[0][12];
     $this->date_updated = $userInfo[0][13];
 }
예제 #2
0
function OS_UpdateScoresTable($name = "")
{
    $db = new db("mysql:host=" . OSDB_SERVER . ";dbname=" . OSDB_DATABASE . "", OSDB_USERNAME, OSDB_PASSWORD);
    $name = safeEscape(trim($name));
    if (!empty($name)) {
        $sth = $db->prepare("SELECT * FROM scores WHERE (name) = ('" . $name . "')");
        $result = $sth->execute();
        if ($limit = $sth->rowCount() <= 0) {
            $sth = $db->prepare("INSERT INTO scores(category, name)VALUES('dota_elo','" . $name . "')");
            $result = $sth->execute();
        }
        //Get updated result
        $resultScore = $db->prepare("SELECT player,score FROM " . OSDB_STATS . " WHERE (player) = ('" . $name . "')");
        $result = $resultScore->execute();
        $rScore = $resultScore->fetch(PDO::FETCH_ASSOC);
        //update "scores" table
        $UpdateScoreTable = $db->prepare("UPDATE `scores` SET `score` = '" . $rScore["score"] . "' \n\tWHERE (name) = ('" . $rScore["player"] . "') ");
        $result = $UpdateScoreTable->execute();
    }
}
예제 #3
0
파일: orders.php 프로젝트: simonwoosh/cs290
 public static function delete($id)
 {
     $query = db::prepare("DELETE FROM order WHERE id=?");
     $query->bindValue(1, $id);
     try {
         $query->execute();
         return True;
     } catch (PDOException $e) {
         die($e->getMessage());
     }
 }
예제 #4
0
function UpdateCommentsByPostIds($PostIDS = '')
{
    $db = new db("mysql:host=" . OSDB_SERVER . ";dbname=" . OSDB_DATABASE . "", OSDB_USERNAME, OSDB_PASSWORD);
    $sth = $db->prepare("SET NAMES 'utf8'");
    $result = $sth->execute();
    //Prepare query and update total comments for each post
    $query = "SELECT * FROM " . OSDB_NEWS . " WHERE ";
    $PIDS = explode(",", $PostIDS);
    for ($i = 0; $i < count($PIDS); $i++) {
        $query .= " news_id = '" . $PIDS[$i] . "' OR";
    }
    $query = substr($query, 0, -3);
    $sth = $db->prepare($query);
    $result = $sth->execute();
    while ($row = $sth->fetch(PDO::FETCH_ASSOC)) {
        //echo $row["post_id"]. " | ";
        $get = $db->prepare("SELECT COUNT(*) FROM " . OSDB_COMMENTS . " WHERE post_id= '" . $row["news_id"] . "' LIMIT 1");
        $result = $get->execute();
        $r = $get->fetch(PDO::FETCH_NUM);
        $TotalComments = $r[0];
        $update = $db->prepare("UPDATE " . OSDB_NEWS . " SET comments = '" . $TotalComments . "' WHERE news_id = '" . $row["news_id"] . "' ");
        $result = $update->execute();
    }
}
예제 #5
0
파일: flight.php 프로젝트: simonwoosh/cs290
 public function __construct($ID)
 {
     $query = db::prepare("SELECT * FROM flight WHERE id=?");
     $query->bindValue(1, $ID);
     try {
         $query->execute();
     } catch (PDOException $e) {
         die($e->getMessage());
     }
     $flightInfo = $query->fetchAll();
     $this->id = $flightInfo[0][0];
     $this->start_location = $flightInfo[0][1];
     $this->end_location = $flightInfo[0][2];
     $this->date_added = $flightInfo[0][3];
     $this->date_updated = $flightInfo[0][4];
 }
 public function __construct($ID)
 {
     $query = db::prepare("SELECT * FROM flight_detail_passenger_order WHERE id=?");
     $query->bindValue(1, $ID);
     try {
         $query->execute();
     } catch (PDOException $e) {
         die($e->getMessage());
     }
     $flight_detail_passenger_orderInfo = $query->fetchAll();
     $this->id = $flight_detail_passenger_orderInfo[0][0];
     $this->fdp_id = $flight_detail_passenger_orderInfo[0][1];
     $this->o_id = $flight_detail_passenger_orderInfo[0][2];
     $this->date_added = $flight_detail_passenger_orderInfo[0][3];
     $this->date_updated = $flight_detail_passenger_orderInfo[0][4];
 }
예제 #7
0
 public function __construct($ID)
 {
     $query = db::prepare("SELECT * FROM airport WHERE id=?");
     $query->bindValue(1, $ID);
     try {
         $query->execute();
     } catch (PDOException $e) {
         die($e->getMessage());
     }
     $airportInfo = $query->fetchAll();
     $this->id = $airportInfo[0][0];
     $this->airport_name = $airportInfo[0][1];
     $this->airport_location = $airportInfo[0][2];
     $this->airport_code = $airportInfo[0][3];
     $this->timezone = $airportInfo[0][4];
     $this->date_added = $airportInfo[0][5];
     $this->date_updated = $airportInfo[0][6];
 }
예제 #8
0
파일: order.php 프로젝트: simonwoosh/cs290
 public function __construct($ID)
 {
     $query = db::prepare("SELECT * FROM order WHERE id=?");
     $query->bindValue(1, $ID);
     try {
         $query->execute();
     } catch (PDOException $e) {
         die($e->getMessage());
     }
     $orderInfo = $query->fetchAll();
     $this->id = $orderInfo[0][0];
     $this->user_id = $orderInfo[0][1];
     $this->booking_code = $orderInfo[0][2];
     $this->total_cost = $orderInfo[0][3];
     $this->payment_confirmed = $orderInfo[0][4];
     $this->date_added = $orderInfo[0][5];
     $this->date_updated = $orderInfo[0][6];
 }
예제 #9
0
파일: user.php 프로젝트: kemao/php
 /**
  * Summary of creatUserData 创建用户信息
  * @param mixed $uid
  */
 public function creatUserData($data)
 {
     if ($data['uid'] == '') {
         hb_log('用户id未获取到', '.user_error');
         throw new Exception("用户id未获取到", -1);
     }
     $db = new db();
     $sql = "INSERT INTO `hb_user` (`uid`, `uname`, `pic`)\n        VALUES\n\t(?, ?, ?) ON DUPLICATE KEY UPDATE `uname` = ?,\n\t`pic` = ?";
     $sth = $db->prepare($sql);
     hb_log($data, '.createUserDataDb');
     try {
         $sth->execute([$data['uid'], $data['name'], $data['pic'], $data['name'], $data['pic']]);
         hb_log($data, '.creatUserData');
         $db->commit();
     } catch (Exception $e) {
         hb_log($e, '.user_error');
         return false;
     }
     return true;
 }
예제 #10
0
파일: user.php 프로젝트: simonwoosh/cs290
 public function __construct($ID)
 {
     $query = db::prepare("SELECT * FROM user WHERE id=?");
     $query->bindValue(1, $ID);
     try {
         $query->execute();
     } catch (PDOException $e) {
         die($e->getMessage());
     }
     $userInfo = $query->fetchAll();
     $this->id = $userInfo[0][0];
     $this->first_name = $userInfo[0][1];
     $this->last_name = $userInfo[0][2];
     $this->username = $userInfo[0][3];
     $this->password = $userInfo[0][4];
     $this->email = $userInfo[0][5];
     $this->confirmed = $userInfo[0][6];
     $this->confirm_code = $userInfo[0][7];
     $this->date_added = $userInfo[0][8];
     $this->date_updated = $userInfo[0][9];
 }
예제 #11
0
 public function __construct($ID)
 {
     $query = db::prepare("SELECT * FROM flight_detail WHERE id=?");
     $query->bindValue(1, $ID);
     try {
         $query->execute();
     } catch (PDOException $e) {
         die($e->getMessage());
     }
     $flight_detailInfo = $query->fetchAll();
     $this->id = $flight_detailInfo[0][0];
     $this->flight_id = $flight_detailInfo[0][1];
     $this->model_id = $flight_detailInfo[0][2];
     $this->capacity = $flight_detailInfo[0][3];
     $this->flight_status = $flight_detailInfo[0][4];
     $this->delayed_time = $flight_detailInfo[0][5];
     $this->estimated_duration = $flight_detailInfo[0][6];
     $this->departure_time = $flight_detailInfo[0][7];
     $this->unit_price = $flight_detailInfo[0][8];
     $this->date_added = $flight_detailInfo[0][9];
     $this->date_updated = $flight_detailInfo[0][10];
 }
예제 #12
0
$default_language = 'english';
$DateFormat = '';
$MinDuration = '';
$DefaultMap = 'dota';
$TopPage = 1;
$HeroesPage = '';
$OnlineOfflineOnTopPage = '';
// end
require_once "../../inc/default-constants.php";
require_once "../../inc/common-queries.php";
if (!empty($TimeZone)) {
    date_default_timezone_set($TimeZone);
}
$CronTempFile = '_working.txt';
$db = new db("mysql:host=" . $server . ";dbname=" . $database . "", $username, $password);
$sth = $db->prepare("SET NAMES 'utf8'");
$result = $sth->execute();
//require_once('../../inc/db_connect.php');
$interval = $CronUpdate;
// do every X sec (loaded from config)...
if (isset($_GET["clear"])) {
    $sth = $db->prepare("TRUNCATE TABLE `cron_logs` ");
    $result = $sth->execute();
    header('location: ?' . $CronPasswordLink);
    die;
}
//This is just call from ajax
if (isset($_GET["status"])) {
    if (file_exists($CronTempFile)) {
        $time = filemtime($CronTempFile);
        $next = $time + $interval;
예제 #13
0
파일: gift.php 프로젝트: kemao/php
 /**
  * 配置礼品库存
  */
 public function setGiftItem($id, $data)
 {
     $sql = "UPDATE `hb_gift` SET `total`=?,`rate`=? WHERE `id` = ?";
     $db = new db();
     $sth = $db->prepare($sql);
     $sth->execute([$data['total'], $data['rate'], $id]);
     $db->commit();
 }
예제 #14
0
파일: start.php 프로젝트: vinod-co/centa
/**
 * Get keyword question
 *
 * @param array $questions - temp array of questions
 * @param array $random_q_data - a question
 * @param int $q_no - question index in array
 * @param array $used_questions - previsouly used questions
 * @param db $mysqli
 */
function keywordQOverwrite(&$questions, $random_q_data, $q_no, &$used_questions, $mysqli)
{
    // Generate a random question ID from keywords.
    $question_ids = array();
    $question_data = $mysqli->prepare("SELECT DISTINCT k.q_id FROM keywords_question k, questions q WHERE k.q_id = q.q_id AND" . " k.keywordID = ? AND q.deleted is NULL");
    $question_data->bind_param('i', $random_q_data['options'][0]['option_text']);
    $question_data->execute();
    $question_data->bind_result($q_id);
    while ($question_data->fetch()) {
        $question_ids[] = $q_id;
    }
    $question_data->close();
    shuffle($question_ids);
    $try = 0;
    $unique = false;
    while ($unique == false and $try < count($question_ids)) {
        $selected_q_id = $question_ids[$try];
        if (!isset($used_questions[$selected_q_id])) {
            $unique = true;
        }
        $try++;
    }
    $used_questions[$selected_q_id] = 1;
    if ($unique) {
        // Look up selected question and overwrite data.
        $question_data = $mysqli->prepare("SELECT q_type, q_id, score_method, display_method, settings, marks_correct, marks_incorrect," . " marks_partial, theme, scenario, leadin, correct, REPLACE(option_text,'\t','') AS option_text, q_media, q_media_width," . " q_media_height, o_media, o_media_width, o_media_height, notes, q_option_order FROM questions, options WHERE q_id=? AND" . " questions.q_id=options.o_id ORDER BY id_num");
        $question_data->bind_param('i', $selected_q_id);
        $question_data->execute();
        $question_data->store_result();
        $question_data->bind_result($q_type, $q_id, $score_method, $display_method, $settings, $marks_correct, $marks_incorrect, $marks_partial, $theme, $scenario, $leadin, $correct, $option_text, $q_media, $q_media_width, $q_media_height, $o_media, $o_media_width, $o_media_height, $notes, $q_option_order);
        while ($question_data->fetch()) {
            if (!isset($question['q_id']) or $question['q_id'] != $q_id) {
                $question['theme'] = $theme;
                $question['scenario'] = $scenario;
                $question['leadin'] = $leadin;
                $question['notes'] = $notes;
                $question['q_type'] = $q_type;
                $question['q_id'] = $q_id;
                $question['display_pos'] = $q_no;
                $question['score_method'] = $score_method;
                $question['display_method'] = $display_method;
                $question['settings'] = $settings;
                $question['q_media'] = $q_media;
                $question['q_media_width'] = $q_media_width;
                $question['q_media_height'] = $q_media_height;
                $question['q_option_order'] = $q_option_order;
                $question['dismiss'] = '';
            }
            $question['options'][] = array('correct' => $correct, 'option_text' => $option_text, 'o_media' => $o_media, 'o_media_width' => $o_media_width, 'o_media_height' => $o_media_height, 'marks_correct' => $marks_correct, 'marks_incorrect' => $marks_incorrect, 'marks_partial' => $marks_partial);
        }
        echo "\n<input type=\"hidden\" name=\"q" . $q_no . "_randomID\" value=\"" . $question['q_id'] . "\" />\n";
    } else {
        $question['leadin'] = '<span style="color: #f00;">' . $string['error_keywords'] . '</span>';
        $question['q_type'] = 'keyword_based';
        $question['q_id'] = -1;
        $question['display_pos'] = $q_no;
        $question['theme'] = $question['scenario'] = $question['notes'] = $question['score_method'] = $question['q_media'] = '';
        $question['q_media_width'] = $question['q_media_height'] = $question['q_option_order'] = $question['dismiss'] = '';
        $question['options'][] = array();
    }
    $questions[] = $question;
}
예제 #15
0
$pass = "******";
// super secret password for db
$db = "igorrxbi_SD";
// table name for senior design
$mysqli = new db($host, $user, $pass, $db);
/* stablish and check connection */
if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit;
}
/* write up query and parameters */
$sql = "SELECT * FROM users WHERE id = ?";
/* WHICH USER DO YOU WANT: */
$user_id = rand(1, 6);
/* prepare statement( $stmt ) */
if ($stmt = $mysqli->prepare($sql)) {
    // objective:
    $stmt->mbind_param('d', $user_id);
    $stmt->execute();
    $stmt->store_result();
    /* bind variables to prepared statement */
    $stmt->bind_result($col1, $col2, $col3, $col4, $col5);
    /* fetch values */
    printf("<table>");
    printf("<tr>");
    printf("<th>id</th>");
    printf("<th>username</th>");
    printf("<th>password</th>");
    printf("<th>email</th>");
    printf("<th>xtra</th>");
    while ($stmt->fetch()) {
예제 #16
0
// greeting:
$greet = "Please, enter your name below...";
//connect to db:
$mysqli = new db($_db_host, $_db_user, $_db_pass, $_db_database);
/* stablish and check connection */
if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    exit;
}
/* see if anything was submited */
if (isset($_POST['submit_username'])) {
    $view_button_user = "******";
    $userval = $_POST["user"];
    /* look for username in db */
    $sql = "SELECT id FROM users WHERE username = ?";
    $stmt = $mysqli->prepare($sql);
    $stmt->bind_param('s', $userval);
    $stmt->execute();
    $stmt->store_result();
    $in_db = $stmt->num_rows >= 1;
    /***************************/
    if ($in_db) {
        $view_button_login = "******";
        $text_pass = "******";
        $greet = "your password, " . $_POST["user"] . "...";
    } else {
        $view_button_signup = "block";
        $text_email = "block";
        $text_pass = "******";
        $text_chck = "block";
        $greet = "please signup before you continue.";
예제 #17
0
파일: news.php 프로젝트: robchett/uknxcl
<?php

function __autoload($classname)
{
    if (is_readable($filename = $_SERVER['DOCUMENT_ROOT'] . "/inc/object/" . $classname . ".php")) {
    } else {
        if (is_readable($filename = $_SERVER['DOCUMENT_ROOT'] . "/inc/static/" . $classname . ".php")) {
        } else {
            if (is_readable($filename = $_SERVER['DOCUMENT_ROOT'] . "/inc/form/" . $classname . ".php")) {
            } else {
                echo '<pre><p>Class not found ' . $classname . '</p><p>' . print_r(debug_backtrace(), 1) . '</p></pre>';
            }
        }
    }
    include_once $filename;
}
\db::connect();
\db::connect();
$res = \db::query('SELECT DISTINCT ID,Name FROM forum_subsection');
$update_statement = \db::prepare('UPDATE news SET title =:title WHERE title = :old_title');
while ($row = \db::fetch($res)) {
    $update_statement->execute(array('title' => $row->Name, 'old_title' => $row->ID));
}
예제 #18
0
*
*    DOTA OPEN STATS is distributed in the hope that it will be useful,
*    but WITHOUT ANY WARRANTY; without even the implied warranty of
*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*    GNU General Public License for more details.
*
*    You should have received a copy of the GNU General Public License
*    along with DOTA OPEN STATS.  If not, see <http://www.gnu.org/licenses/>
*
-->
**********************************************/
if (strstr($_SERVER['REQUEST_URI'], basename(__FILE__))) {
    header('HTTP/1.1 404 Not Found');
    die;
}
if (isset($_debug) and $_debug == 1) {
    ini_set("display_errors", "1");
    error_reporting(E_ALL);
} else {
    ini_set("display_errors", "0");
    error_reporting(NULL);
}
if (isset($DBDriver) and $DBDriver == "mysql") {
    $db = new database($server, $username, $password, $database);
    $db->connect(database);
    $sth = $db->query("SET NAMES 'utf8'");
} else {
    $db = new db("mysql:host=" . OSDB_SERVER . ";dbname=" . OSDB_DATABASE . "", OSDB_USERNAME, OSDB_PASSWORD);
    $sth = $db->prepare("SET NAMES 'utf8'");
    $result = $sth->execute();
}
예제 #19
0
파일: login.php 프로젝트: moahmed/ezcms
}
// Get the POST data
$userid = $_POST["userid"];
$passwd = $_POST["passwd"];
// Form variables must have something in them...
if (empty($userid) || empty($passwd)) {
    header("Location: ../?flg=failed&userid={$userid}");
    exit;
}
// **************** DATABASE ****************
require_once "../../config.php";
// PDO Class for database access
$dbh = new db();
// database handle
// Prepare SQL to fetch user's record from dataabse
$stmt = $dbh->prepare('SELECT * FROM `users` WHERE `email` = ? AND `passwd` = SHA2( ? , 512 ) LIMIT 1');
$stmt->execute(array($userid, $passwd));
// Check if User Record is present and returned from the database
if ($stmt->rowCount()) {
    // Fetch the user record from database
    $user = $stmt->fetch(PDO::FETCH_ASSOC);
    // User must be ACTIVE to login
    if (!$user['active']) {
        header("Location: ../?flg=inactive&userid={$userid}");
        exit;
    }
    //login the user
    $_SESSION['LOGGEDIN'] = true;
    // login flag to TRUE
    $_SESSION['USERID'] = $user['id'];
    // User's ID
예제 #20
0
파일: manu.php 프로젝트: robchett/uknxcl
<?php

function __autoload($classname)
{
    if (is_readable($filename = $_SERVER['DOCUMENT_ROOT'] . "/inc/object/" . $classname . ".php")) {
    } else {
        if (is_readable($filename = $_SERVER['DOCUMENT_ROOT'] . "/inc/static/" . $classname . ".php")) {
        } else {
            if (is_readable($filename = $_SERVER['DOCUMENT_ROOT'] . "/inc/form/" . $classname . ".php")) {
            } else {
                echo '<pre><p>Class not found ' . $classname . '</p><p>' . print_r(debug_backtrace(), 1) . '</p></pre>';
            }
        }
    }
    include_once $filename;
}
\db::connect();
$res = \db::query('SELECT DISTINCT(mid) FROM glider');
$insert_statement = \db::prepare('INSERT INTO manufacturer SET title=:title');
$update_statement = \db::prepare('UPDATE glider SET manufacturer =:mid WHERE manufacturer = :title');
while ($row = \db::fetch($res)) {
    $insert_statement->execute(array('title' => $row->manufacturer));
    $id = \db::insert_id();
    $update_statement->execute(array('title' => $row->manufacturer, 'mid' => $id));
}
예제 #21
0
function OS_GetUserStatsByID($userID = '')
{
    $db = new db("mysql:host=" . OSDB_SERVER . ";dbname=" . OSDB_DATABASE . "", OSDB_USERNAME, OSDB_PASSWORD);
    if (is_numeric($userID)) {
        $sth = $db->prepare("SELECT s.id, s.player, s.score, s.games, s.wins, s.losses, s.draw, s.kills, s.deaths, s.assists, s.creeps, s.denies, s.neutrals, s.towers, s.rax, s.banned, s.ip \n\t  FROM " . OSDB_STATS . " as s \n\t  WHERE s.id=:userID LIMIT 1");
        $sth->bindValue(':userID', (int) $userID, PDO::PARAM_INT);
        $result = $sth->execute();
        $c = 0;
        $Data = array();
        $row = $sth->fetch(PDO::FETCH_ASSOC);
        $Data[$c]["id"] = $row["id"];
        $Data[$c]["player"] = $row["player"];
        $Data[$c]["score"] = $row["score"];
        $Data[$c]["games"] = $row["games"];
        $Data[$c]["wins"] = $row["wins"];
        $Data[$c]["losses"] = $row["losses"];
        $Data[$c]["draw"] = $row["draw"];
        $Data[$c]["kills"] = $row["kills"];
        $Data[$c]["deaths"] = $row["deaths"];
        $Data[$c]["assists"] = $row["assists"];
        $Data[$c]["creeps"] = $row["creeps"];
        $Data[$c]["denies"] = $row["denies"];
        $Data[$c]["neutrals"] = $row["neutrals"];
        $Data[$c]["towers"] = $row["towers"];
        $Data[$c]["neutrals"] = $row["neutrals"];
        $Data[$c]["rax"] = $row["rax"];
        $Data[$c]["banned"] = $row["banned"];
        $Data[$c]["ip"] = $row["ip"];
        return $Data;
    }
}
예제 #22
0
 $phpbb_path = $phpbb_forum;
 $phpbb_avatar = $phpbb_forum_url . "images/avatars/gallery/" . $user->data['user_avatar'];
 if (!file_exists($phpbb_forum . "images/avatars/gallery/" . $user->data['user_avatar'])) {
     $phpbb_avatar = $phpbb_forum_url . "download/file.php?avatar=" . $user->data['user_avatar'];
 }
 $phpbb_userID = $user->data['user_id'];
 $phpbb_userType = $user->data['user_type'];
 $phpbb_userEmail = $user->data['user_email'];
 $phpbb_logoutURL = $phpbb_forum_url . "ucp.php?mode=logout&sid=" . $phpbb_sid;
 $phpbb_user = trim($user->data['username']);
 if ($phpbb_userID >= 1 and $phpbb_userType != 2) {
     require_once 'inc/common.php';
     require_once 'inc/class.db.PDO.php';
     //require_once('inc/db_connect.php');
     $OSDB = new db("mysql:host=" . OSDB_SERVER . ";dbname=" . OSDB_DATABASE . "", OSDB_USERNAME, OSDB_PASSWORD);
     $sth = $OSDB->prepare("SELECT * FROM " . OSDB_USERS . " \n\tWHERE user_email = :phpbb_userEmail AND phpbb_id = :phpbb_userID");
     $sth->bindValue(':phpbb_userEmail', $phpbb_userEmail, PDO::PARAM_STR);
     $sth->bindValue(':phpbb_userID', $phpbb_userID, PDO::PARAM_INT);
     $result = $sth->execute();
     if ($sth->rowCount() <= 0) {
         //CREATE NEW USER (from phpbb database)
         $sth = $OSDB->prepare("SELECT * FROM " . OSDB_USERS . " WHERE LOWER(user_name) = :mybb_username ");
         $sth->bindValue(':mybb_username', strtolower($mybb_username), PDO::PARAM_STR);
         $result = $sth->execute();
         if ($sth->rowCount() >= 1) {
             $phpbb_user = $phpbb_user . "_" . $phpbb_userID;
         }
         $pass = generate_hash(5);
         $hash = generate_hash(12);
         $password_db = generate_password($pass, $hash);
         $OSDB->insert(OSDB_USERS, array("user_name" => $phpbb_user, "user_email" => $phpbb_userEmail, "user_password" => $password_db, "password_hash" => $hash, "user_joined" => (int) time(), "user_level" => 0, "user_last_login" => (int) time(), "user_ip" => $_SERVER["REMOTE_ADDR"], "user_avatar" => $phpbb_avatar, "phpbb_id" => $phpbb_userID));
예제 #23
0
<?php

if ($_POST) {
    $id_segs = array_values($_POST['id_seg']);
    //print_r($id_segs);
    require_once '../db/dbclass.php';
    $dbh = new db();
    $sql = "SELECT s.nur, s.a_oficina,s.nombre_receptor,cargo_receptor,s.fecha_emision,s.oficial,d.cite_original, d.referencia,s.proveido FROM seguimiento s \n    INNER JOIN nurs_documentos n ON s.nur=n.nur\n    INNER JOIN documentos d ON n.id_documento=d.id\n    WHERE d.original='1'\n    AND  s.id IN (";
    foreach ($_POST['id_seg'] as $k => $v) {
        $sql .= $v . ", ";
    }
    $sql = substr($sql, 0, -2);
    $sql .= ")";
    $stmt = $dbh->prepare($sql);
    $data = array();
    $i = 1;
    $stmt->execute();
    $oficial = array(0 => 'Copia', 1 => 'Oficial');
    while ($rs = $stmt->fetch(PDO::FETCH_OBJ)) {
        // Display this code source is asked.
        //if (isset($_GET['source'])) exit('<!DOCTYPE HTML><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><title>OpenTBS plug-in for TinyButStrong - demo source</title></head><body>'.highlight_file(__FILE__,true).'</body></html>');
        $data[] = array('i' => $i, 'nur' => $rs->nur, 'oficina' => $rs->a_oficina, 'nombre' => $rs->nombre_receptor, 'cargo' => $rs->cargo_receptor, 'cite' => $rs->cite_original, 'proveido' => $rs->proveido, 'oficial' => $oficial[$rs->oficial], 'fecha' => date('d/m/Y', strtotime($rs->fecha_emision)));
        $i++;
    }
    // load the TinyButStrong libraries
    include_once 'tbs_class_php5.php';
    // TinyButStrong template engine
    // load the OpenTBS plugin
    include_once 'tbs_plugin_opentbs.php';
    $TBS = new clsTinyButStrong();
    // new instance of TBS
예제 #24
0
파일: index.php 프로젝트: brownell/get311
    }
    $people = mit_search($search_terms);
    $people = html_escape_people($people);
    $total = count($people);
    if ($total == 0) {
        $failed_search = True;
        require "templates/{$prefix}/sms/index.html";
    } elseif ($total == 1) {
        $person = $people[0];
        require "templates/{$prefix}/sms/detail.html";
    } else {
        if ($selected == true) {
            $person = $people[(int) $select];
            require "templates/{$prefix}/sms/detail.html";
        } else {
            $stmt_1 = $db->prepare("INSERT INTO SMSDirState (searchterm,timestamp,uid) VALUES (?,?,?)");
            if (db::$use_sqlite) {
                $stmt_1->execute(array($search_terms, $rightNow, $uid));
            } else {
                $stmt_1->bind_param('sss', $search_terms, $rightNow, $uid);
                $stmt_1->execute();
            }
            require "templates/{$prefix}/sms/results.html";
        }
    }
} else {
    $page->cache();
    require "templates/{$prefix}/sms/index.html";
}
function detail_url($person)
{
예제 #25
0
 public function deleteIPBlock($start_ip, $type = 'block')
 {
     list($start_ip, $type) = db::prepare(func_get_args());
     $ip_type = self::getIPType($start_ip);
     $start_ip = self::ipToLong($start_ip);
     switch ($type) {
         case 'block':
             $table = 'ip_blocks';
             break;
         case 'allocation':
             $table = 'allocations';
             break;
         default:
             $table = 'ip_blocks';
             break;
     }
     $sql = "DELETE FROM {$table} WHERE `starting_ip` = '{$start_ip}'";
     try {
         if (!($q = db::query($sql, 1, 1))) {
             throw new exception("Unable to delete IPv{$ip_type} block '" . self::longToIP($start_ip) . "'. MySQL reports: " . db::getError());
         } else {
             return true;
         }
     } catch (exception $e) {
         error::fullHalt($e->getMessage(), __FUNCTION__, __LINE__);
     }
     return false;
 }
예제 #26
0
파일: index.php 프로젝트: moahmed/ezcms
	die();
}
*/
// **************** DATABASE ****************
require_once "config.php";
// PDO Class for database access
$dbh = new db();
// database handle available in layouts
// **************** SITE DETAILS ****************
$site = $dbh->query('SELECT * FROM `site` ORDER BY `id` DESC LIMIT 1')->fetch(PDO::FETCH_ASSOC);
// get the site details
// **************** REQUESTED URI ****************
$uri = strtok($_SERVER["REQUEST_URI"], '?');
// get the requested URI
// **************** PAGE DETAILS ****************
$stmt = $dbh->prepare('SELECT * FROM `pages` WHERE `url` = ? ORDER BY `id` DESC LIMIT 1');
$stmt->execute(array($uri));
// Check if page is found in database.
if ($stmt->rowCount()) {
    // Page is found in Database
    $page = $stmt->fetch(PDO::FETCH_ASSOC);
    // Check if page is published or not.
    if (!$page["published"]) {
        // Start session if not started to check ADMIN login status
        if (session_status() !== PHP_SESSION_ACTIVE) {
            session_start();
        }
        // Set SESSION ADMIN Login Flag to false if not set
        if (!isset($_SESSION['LOGGEDIN'])) {
            $_SESSION['LOGGEDIN'] = false;
        }