本文整理汇总了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();
}
}