当前位置: 首页>>代码示例>>PHP>>正文


PHP Dao::redirect方法代码示例

本文整理汇总了PHP中Dao::redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP Dao::redirect方法的具体用法?PHP Dao::redirect怎么用?PHP Dao::redirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Dao的用法示例。


在下文中一共展示了Dao::redirect方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Dao

<?php

if (!isset($_SESSION)) {
    session_start();
}
require_once "classes/dao.php";
if (isset($_POST["username"]) && isset($_POST["password"]) && isset($_POST["email"])) {
    $username = $_POST["username"];
    $password = $_POST["password"];
    $email = $_POST["email"];
    try {
        $dao = new Dao();
        if ($dao->newUser($username, $password, $email)) {
            $_SESSION["name"] = $username;
            if (isset($_POST['rememberme']) && $_POST['rememberme']) {
                $expireTime = time() + 60 * 60 * 24 * 180;
                # 180 days from now
                setcookie("username", $_SESSION["name"], $expireTime);
            }
            $dao->redirect("../index.php", "Welcome to idleg, {$username}!");
        } else {
            $dao->redirect("../index.php", "User setup failed.");
        }
    } catch (Exception $e) {
        var_dump($e);
        die;
    }
}
开发者ID:paleomedia,项目名称:idleg_flask,代码行数:28,代码来源:newuser.php

示例2: Dao

<?php

if (!isset($_SESSION)) {
    session_start();
}
require_once "classes/dao.php";
if (isset($_POST["username"]) && isset($_POST["password"])) {
    $name = $_POST["username"];
    $password = $_POST["password"];
    try {
        $dao = new Dao();
        if ($dao->check_login($name, $password)) {
            $_SESSION["name"] = $name;
            if ($_POST['rememberme'] = 1) {
                $expireTime = time() + 60 * 60 * 24 * 180;
                # 180 days from now
                setcookie("username", $_SESSION["name"], $expireTime);
            }
            $dao->redirect("../index.php", "Login successful! Welcome back, {$name}.");
        } else {
            $dao->redirect("../index.php", "Incorrect user name and/or password.");
        }
    } catch (Exception $e) {
        var_dump($e);
        die;
    }
}
开发者ID:paleomedia,项目名称:idleg_flask,代码行数:27,代码来源:login.php

示例3: Dao

<?php

// handler.php
// handle comment posts, saving to MySQL and redirecting back to the list
if (!isset($_SESSION)) {
    session_start();
}
require_once "classes/dao.php";
if (isset($_SESSION["name"]) && isset($_POST["commentButton"])) {
    $comment = $_POST["comment"];
    $comment_type = $_POST["vote"];
    $bill = $_POST["bill"];
    $username = $_SESSION["name"];
    try {
        $dao = new Dao();
        $dao->saveComment($username, $comment, $bill, $comment_type);
    } catch (Exception $e) {
        var_dump($e);
        die;
    }
} else {
    $dao = new Dao();
    $dao->redirect("../index.php", "Please log in to comment.");
}
header("Location:../index.php");
开发者ID:paleomedia,项目名称:idleg_flask,代码行数:25,代码来源:handler.php


注:本文中的Dao::redirect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。