コード例 #1
0
ファイル: db_core.php プロジェクト: BGCX067/ezbids-svn-to-git
 public function setInstance($o)
 {
     self::$instance = $o;
 }
コード例 #2
0
ファイル: login.php プロジェクト: BGCX067/ezbids-svn-to-git
<?php

include "../config/config.php";
session_start();
$error = "";
if (isset($_SESSION["uid"])) {
    header('Location: index.php');
}
if (isset($_POST["btnSubmit"])) {
    $username = $_POST["txtUsername"];
    $password = $_POST["txtPassword"];
    $db = DB_Core::getInstance();
    $result = $db->executeQuery('SELECT * FROM user WHERE username="******";');
    if (!$result) {
        $error = "Ban nhap tai khoan hoac mat khau sai.";
    } else {
        $result = mysql_fetch_assoc($result);
        if (crypt($password, $result["salt"]) === $result["password"]) {
            session_register("uid");
            $_SESSION["uid"] = $result["id"];
            header('Location: success.php');
        } else {
            $error = "Ban nhap tai khoan hoac mat khau sai.";
        }
    }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><!-- InstanceBegin template="/Templates/masterPage.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />