當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Main::openConnection方法代碼示例

本文整理匯總了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';
     }
 }
開發者ID:amigozgovi,項目名稱:agrotech,代碼行數:34,代碼來源:LoginHandler.php

示例2: __construct

 function __construct()
 {
     if (Main::$con == FALSE) {
         Main::openConnection();
     }
     $this->doInstall();
 }
開發者ID:amigozgovi,項目名稱:agrotech,代碼行數:7,代碼來源:Copy+of+Install.php

示例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');
 }
開發者ID:amigozgovi,項目名稱:agrotech,代碼行數:11,代碼來源:Update.php

示例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();
     }
 }
開發者ID:amigozgovi,項目名稱:agrotech,代碼行數:46,代碼來源:Details.php


注:本文中的Main::openConnection方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。