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


PHP Connect::counterResult方法代碼示例

本文整理匯總了PHP中Connect::counterResult方法的典型用法代碼示例。如果您正苦於以下問題:PHP Connect::counterResult方法的具體用法?PHP Connect::counterResult怎麽用?PHP Connect::counterResult使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Connect的用法示例。


在下文中一共展示了Connect::counterResult方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: Variables

 function __construct()
 {
     $variables = new Variables();
     $connect = new Connect($variables->dbHost, $variables->dbUser, $variables->dbPassword, $variables->dbName);
     $result;
     //receinving and striping the variables
     $this->userMatricula = $connect->antiInjection(isset($_POST["tfMatricula"]) ? $_POST["tfMatricula"] : NULL);
     $this->password = $connect->antiInjection(isset($_POST["tfPassword"]) ? $_POST["tfPassword"] : NULL);
     $this->select = $connect->antiInjection(isset($_POST["slSelect"]) ? $_POST["slSelect"] : NULL);
     if (!$connect->start()) {
         echo "Impossible to start connection in Sigin.";
     }
     //encoding to md5 hash
     $this->password = base64_encode($this->password);
     if (!($result = $connect->execute("SELECT * FROM Cadastros c INNER JOIN Folhas f ON c.codigo_fol = f.codigo_fol WHERE c.matricula = '{$this->userMatricula}' AND c.senha = '{$this->password}' AND f.codigo_fol = '{$this->select}'"))) {
         echo "Impossible to execute MySQL query.";
     }
     if ($connect->counterResult($result) > 0) {
         $result = $connect->execute("SELECT * FROM Pessoal WHERE matricula = '{$this->userMatricula}'");
         $row = mysql_fetch_assoc($result);
         $_SESSION["user"] = $this->userMatricula;
         $_SESSION["userPass"] = $this->password;
         $_SESSION["nome"] = $row["nome"];
         $connect->close();
         header("Location: ../index.php?ok=true");
         die;
     }
     $connect->close();
     header("Location: ../index.php?ok=false");
     die;
 }
開發者ID:GolfinhoPvP,項目名稱:lokorez,代碼行數:31,代碼來源:UserLogin.class.php

示例2: Variables

 function __construct()
 {
     $variables = new Variables();
     $connect = new Connect($variables->dbHost, $variables->dbUser, $variables->dbPassword, $variables->dbName);
     $result;
     //receinving and striping the variables
     $this->userName = $connect->antiInjection(isset($_POST["tfUserName"]) ? $_POST["tfUserName"] : NULL);
     $this->password = $connect->antiInjection(isset($_POST["tfPassword"]) ? $_POST["tfPassword"] : NULL);
     if (!$connect->start()) {
         echo "Impossible to star connection in Sigin.";
     }
     //encoding to md5 hash
     $this->password = md5($this->password);
     if (!($result = $connect->execute("SELECT * FROM Administradores WHERE usuario = '{$this->userName}' and senha = '{$this->password}'"))) {
         echo "Impossible to execute MySQL query.";
     }
     if ($connect->counterResult($result) > 0) {
         $_SESSION["usuario"] = $this->userName;
         $_SESSION["senha"] = $this->password;
         $row = mysql_fetch_assoc($result);
         $_SESSION["nivel"] = $row["id_nivel"];
         //$connect->close();
         switch ($_SESSION["nivel"]) {
             case 1:
                 header("Location: ../importDocuments.php");
                 break;
             case 2:
                 header("Location: ../makeRegister.php");
                 break;
         }
         die;
     }
     //$connect->close();
     header("Location: ../admin.php?login=false");
     die;
 }
開發者ID:GolfinhoPvP,項目名稱:lokorez,代碼行數:36,代碼來源:Login.class.php

示例3: Variables

include_once "../beans/Variables.class.php";
require_once "../utils/Connect.class.php";
$variables = new Variables();
$connect = new Connect($variables->dbHost, $variables->dbUser, $variables->dbPassword, $variables->dbName);
$oldPass = $connect->antiInjection(isset($_POST["tfOldPass"]) ? $_POST["tfOldPass"] : NULL);
$newPass1 = $connect->antiInjection(isset($_POST["tfNewPass1"]) ? $_POST["tfNewPass1"] : NULL);
$newPass2 = $connect->antiInjection(isset($_POST["tfNewPass2"]) ? $_POST["tfNewPass2"] : NULL);
if (strcmp($newPass1, $newPass2) == 0) {
    $newPass1 = base64_encode($newPass1);
    $oldPass = base64_encode($oldPass);
} else {
    $connect->close();
    header("Location: ../index.php?pass=false");
    die;
}
if (!$connect->start()) {
    echo "Impossible to star connection in Sigin.";
}
if (!($result = $connect->execute("SELECT * FROM Cadastros WHERE matricula = '" . $_SESSION["user"] . "' AND senha = '" . $oldPass . "'"))) {
    echo "Impossible to execute MySQL query.";
}
if ($connect->counterResult($result) > 0) {
    $connect->execute("UPDATE Cadastros SET senha='" . $newPass1 . "' WHERE matricula = '" . $_SESSION["user"] . "'");
    $_SESSION["userPass"] = $newPass1;
    $connect->close();
    header("Location: ../index.php?pass=true");
    die;
}
$connect->close();
header("Location: ../index.php?pass=false");
die;
開發者ID:GolfinhoPvP,項目名稱:lokorez,代碼行數:31,代碼來源:changePassword.php


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