本文整理匯總了PHP中Main::openConnection方法的典型用法代碼示例。如果您正苦於以下問題:PHP Main::openConnection方法的具體用法?PHP Main::openConnection怎麽用?PHP Main::openConnection使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Main
的用法示例。
在下文中一共展示了Main::openConnection方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: handle
function handle()
{
if (isset($_POST['action'])) {
$login = $_POST['user'];
$pass = $_POST['pass'];
//echo $login;
//echo $pass;
//echo $login;
//echo $pass;
$query = "SELECT * FROM `at_admin` WHERE `user`='{$login}' AND `pass`='{$pass}'";
if (Main::$con === FALSE) {
Main::openConnection();
}
//echo $query;
$result = mysql_query($query) or die('Query Failed' . mysql_error());
if ($result) {
if (mysql_num_rows($result) > 0) {
if (!isset($_SESSION)) {
session_start();
}
$_SESSION['admin'] = $login;
//echo $login;
//echo "LOGGED IN";
//exit();
echo header("Location: " . Settings::SITEURL . "admin/");
exit;
} else {
$this->loggedIn = FALSE;
}
}
} else {
$this->loggedIn = 'FALSE';
}
}
示例2: __construct
function __construct()
{
if (Main::$con == FALSE) {
Main::openConnection();
}
$this->doInstall();
}
示例3: __construct
function __construct($data, $table, $cond)
{
if (Main::$con == FALSE) {
Main::openConnection();
$this->newCon = TRUE;
}
$data = Main::escape($data);
$query = Main::generateQuery('UPDATE', $data, $table, $cond);
mysql_query($query) or Main::throwException('Internal Error Occured', 0, 'Query Failed' . mysql_error());
//Main::displaySuccess('DataBase Updated Successfully');
}
示例4: getDetailsContains
function getDetailsContains($table, $data = '*', $cond)
{
if (Main::$con == FALSE) {
Main::openConnection();
$this->newCon = TRUE;
}
$data = Main::escape($data);
$query = "SELECT ";
if (is_array($data)) {
$i = 0;
foreach ($data as $value) {
if ($i < 1) {
$query .= "`{$value}`";
} else {
$query .= ",`{$value}`";
}
$i++;
}
} else {
if ($query == '*') {
$query .= '*';
} else {
$query .= "`{$data}`";
}
}
$query .= " FROM `{$table}`";
$query .= " WHERE ";
$i = 0;
foreach ($cond as $key => $value) {
if ($i < 1) {
$query .= "`{$key}` LIKE '%{$value}%'";
} else {
$query .= "AND `{$key}` LIKE '%{$value}%'";
}
$i++;
}
$result = mysql_query($query) or die('Query Failed' . mysql_error());
if (mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_assoc($result)) {
$data[] = $row;
}
return $data;
} else {
return array();
}
}