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