public function authenticate(User $user)
 {
     $searchforinput = "Username: "******" Password: "******"\n", $contentfile);
     if (!in_array($searchforinput, $contentfile)) {
         throw new Exception("Wrong name or password");
     }
     $this->userlogin();
 }
Example #2
0
$smarty->debugging = false;
//获取模板所在url并分配
$templateurl = TEMPLATEURL . str_replace(array("\\", "."), array(), $smarty->template_dir[0]);
$smarty->assign("templateurl", $templateurl);
//获取管理的动作
$action = $_GET["action"];
@($uid = $_GET["id"]);
if ($action == "del") {
    //当要求删除对应用户时:
    echo $uclass->deluser($uid);
    exit("<script>window.setTimeout(function(){window.history.go(-1);},2000);</script>");
} else {
    if ($action == "change") {
        //当要求为更改用户密码时
        if (!$_POST) {
            $tgusername = $uclass->getusername($uid);
            $smarty->assign("username", $tgusername);
            $smarty->display("user_mod.htm");
        } else {
            $password = $_POST["password"];
            $passwordag = $_POST["password_ag"];
            echo $uclass->changepasswd($uid, $password, $passwordag);
            exit("<script>window.setTimeout(function(){window.location.href='./user_list.php';},1500);</script>");
        }
    } else {
        if ($action == "add") {
            //当用户需要添加用户时
            if (!$_POST) {
                $smarty->display("user_add.htm");
            } else {
                $username = trim($_POST["uname"]);
<?php

session_start();
require_once "User.php";
// Calls user class
$user_object = new User();
$username = $user_object->getusername();
$password = $user_object->getpassword();
?>
	
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--[if lt IE 7 ]><html class="ie ie6" lang="en"> <![endif]-->
<!--[if IE 7 ]><html class="ie ie7" lang="en"> <![endif]-->
<!--[if IE 8 ]><html class="ie ie8" lang="en"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!-->
<html xmlns="http://www.w3.org/1999/xhtml">
<!--<![endif]-->

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>SmartDocument</title>

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<!-- Favicons -->
<link rel="shortcut icon" href="images/favicon.ico" />

<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]> <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> <![endif]-->