本文整理汇总了PHP中Connect函数的典型用法代码示例。如果您正苦于以下问题:PHP Connect函数的具体用法?PHP Connect怎么用?PHP Connect使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Connect函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_pages
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;
}
示例2: UpdateUser
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;
}
示例3: insertion_Genre
function insertion_Genre($Genre)
{
$pdo = Connect();
foreach ($Genre as $val) {
$sql_search = "SELECT `genres` FROM 'name' WHERE `genres`.'name'=" . $val;
}
}
示例4: Query
function Query($query)
{
global $connected;
if (!$connected) {
Connect();
}
$result = mysql_query($query) or die(mysql_error());
return $result;
}
示例5: dumpDB
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;
}
示例6: jobList
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();
}
示例7: premierepage
function premierepage()
{
$dbh = Connect();
$sql = "SELECT nom\n\t\t\tfrom utilisateur";
$query = $dbh->query($sql);
if ($query) {
return $query->fetchAll();
} else {
return false;
}
}
示例8: SyncServers
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);
}
}
示例9: InsertUser
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;
}
示例10: saveSeats
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();
}
}
示例11: DeleteUser
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;
}
示例12: GetUsers
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;
}
示例13: DeleteUser
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;
}
示例14: GetUsers
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;
}
示例15: GetUser
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;
}
}