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


PHP USER::redirect方法代碼示例

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


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

示例1: USER

<?php

require_once 'session.php';
require_once 'class.user.php';
$user_logout = new USER();
if ($user_logout->is_loggedin() != "") {
    $user_logout->redirect('../home/index.php');
}
if (isset($_GET['logout']) && $_GET['logout'] == "true") {
    $user_logout->doLogout();
    $user_logout->redirect('../login/index.php');
}
開發者ID:walterleonardo,項目名稱:Php,代碼行數:12,代碼來源:logout.php

示例2: USER

<?php

include_once 'php/config.php';
define("PAGENAME", "Create New");
include_once 'include/header.php';
$user = new USER($conn);
if (!$user->loggedin()) {
    $user->redirect('login');
}
$userID = $_SESSION['user_session'];
$stmt = $conn->prepare("SELECT * FROM user WHERE userID=:userID");
$stmt->execute(array(":userID" => $userID));
$userRow = $stmt->fetch(PDO::FETCH_ASSOC);
if (isset($_POST['send_post'])) {
    $title = trim($_POST['title']);
    $subtitle = trim($_POST['subtitle']);
    $preview = trim($_POST['preview']);
    $main_text = trim($_POST['main_text']);
    //improving quality of the code, adding empty method to check for empty variables
    if (empty($title)) {
        $error[] = "Oh no! You need a title for your post!";
    } else {
        if (empty($subtitle)) {
            $error[] = "Oh no! You need a subtitle for your post!";
        } else {
            if (empty($preview)) {
                $error[] = "Oh no! What's your extract?";
            } else {
                if (empty($main_text)) {
                    $error[] = "Oh no! C'mon, you need to write your post! This is a blog, afterall!";
                } else {
開發者ID:IrinaTheNerd,項目名稱:bloggie,代碼行數:31,代碼來源:new_post.php

示例3: USER

<?php

session_start();
require_once 'class.user.php';
$session = new USER();
// if user session is not active(not loggedin) this page will help 'home.php and profile.php' to redirect to login page
// put this file within secured pages that users (users can't access without login)
if (!$session->is_loggedin()) {
    // session no set redirects to login page
    $session->redirect('../pages/login.php');
}
開發者ID:kangube,項目名稱:kangu-product,代碼行數:11,代碼來源:class.session.php

示例4: USER

<?php

include_once 'php/config.php';
define("PAGENAME", "Dashboard");
include_once 'include/header.php';
//creates an object
$user = new USER($conn);
require_once "php/session.php";
//checks whether the session has been started
if (!$user->loggedin()) {
    //if not, redirects to login.php
    $user->redirect('login.php');
}
//session == userID
$userID = $_SESSION['user_session'];
//will be used to implement proper user profiles in the future
$stmt = $conn->prepare("SELECT * FROM user WHERE userID=:userID");
$stmt->execute(array(":userID" => $userID));
$userRow = $stmt->fetch(PDO::FETCH_ASSOC);
?>

<header>
	<div class="feat">
		<h1 class="dashboard">Hello,
			<?php 
echo $userRow['email'];
?>
!</h1>

			<div class="dashboard">
				<h2>Create catching content with a press of a button, take advantage of our guides to help you write and plan your content, delivery and further strategy. Keep in touch with other writers, share your opinions and add to our knowledge base.</h2>
開發者ID:IrinaTheNerd,項目名稱:bloggie,代碼行數:31,代碼來源:dashboard.php

示例5: USER

session_start();
/**
 * On regarde si l'utilisateur est déja connecte.
 * S'il est, on le redirige au panel (pour l'administrateur dans ce cas là pour l'instant
 * 
 * Lors que l'on soumet le formulaire, on passe par la methode POST. 
 * On regarde si l'utilisateur existe.
 * Si c'est le cas, on le redirige vers home.php
 * Sinon, on met un message d'erreur 
 */
require_once '../librairies/user.php';
$user = new USER();
if ($user->isConnected() != "") {
    if ($_SESSION['admin'] === "1") {
        $user->redirect('panelAdmin.php');
    } else {
        $user->redirect('panelUser.php');
    }
}
if (isset($_POST['btn-login'])) {
    $uname = $_POST['ulogin'];
    $upass = $_POST['upassword'];
    if ($user->seLogger($uname, $upass)) {
        if ($_SESSION['admin'] === "1") {
            $user->redirect('panelAdmin.php');
        } else {
            $user->redirect('panelUser.php');
        }
    } else {
        $error = "Champs erronés !";
開發者ID:Mousticke,項目名稱:pinf,代碼行數:30,代碼來源:connexion.php

示例6: USER

include_once "../php-assets/class.advert.php";
require_once "../php-assets/class.session.php";
require_once "../php-assets/class.user.php";
// Gathering the logged user's personal information
$auth_user = new USER();
$user_id = $_SESSION['user_session'];
$stmt = $auth_user->runQuery("SELECT * FROM tbl_user WHERE user_id=:user_id");
$stmt->execute(array(":user_id" => $user_id));
$userRow = $stmt->fetch(PDO::FETCH_ASSOC);
// Creating a new advert
$advert = new Advert();
// Checking if the logged user has already created an advert
$check_user_has_advert = $auth_user->hasAdvert($userRow['user_id']);
if ($check_user_has_advert === true) {
    $auth_user->redirect('advert-overview.php');
}
if (isset($_POST['advert-create-button'])) {
    try {
        // Processing the given home and mobile telephone-numbers
        $mobile_phone_number = preg_replace('/\\s+/', '', $_POST['advert-mobile-number']);
        $home_phone_number = preg_replace('/\\s+/', '', $_POST['advert-home-number']);
        if (preg_match('/^(\\d{4})(\\d{3})(\\d{3})$/', $mobile_phone_number, $matches)) {
            $mobile_phone_number = $matches[1] . ' ' . $matches[2] . ' ' . $matches[3];
        }
        if (preg_match('/^(\\d{3})(\\d{2})(\\d{2})(\\d{2})$/', $home_phone_number, $matches)) {
            $home_phone_number = $matches[1] . ' ' . $matches[2] . ' ' . $matches[3] . ' ' . $matches[4];
        }
        $home_phone_number = "+32 " . $home_phone_number;
        $mobile_phone_number = "+32 " . $mobile_phone_number;
        // Splitting the given home adress into an street-adress and a city
開發者ID:kangube,項目名稱:kangu-product,代碼行數:30,代碼來源:advert-create.php

示例7: USER

<?php

session_start();
require_once 'class.user.php';
$user_home = new USER();
if (!$user_home->is_logged_in()) {
    $user_home->redirect('index.html');
}
$stmt = $user_home->runQuery("SELECT * FROM tbl_users WHERE userID=:uid");
$stmt->execute(array(":uid" => $_SESSION['userSession']));
$row = $stmt->fetch(PDO::FETCH_ASSOC);
?>

<!DOCTYPE html>
<html class="no-js">
    
    <head>
        <title><?php 
echo $row['userEmail'];
?>
</title>
        
		<!-- Load Roboto font -->
        <link href='http://fonts.googleapis.com/css?family=Roboto:400,300,700&amp;subset=latin,latin-ext' rel='stylesheet' type='text/css'>
        <!-- Load css styles -->
        <link rel="stylesheet" type="text/css" href="css/bootstrap.css" />
        <link rel="stylesheet" type="text/css" href="css/bootstrap-responsive.css" />
        <link rel="stylesheet" type="text/css" href="css/style.css" />
        <link rel="stylesheet" type="text/css" href="css/pluton.css" />
        <!--[if IE 7]>
            <link rel="stylesheet" type="text/css" href="css/pluton-ie7.css" />
開發者ID:karthikkrishnamurthi,項目名稱:event_management,代碼行數:31,代碼來源:home.php

示例8: USER

<?php

include_once 'php/config.php';
define("PAGENAME", "Update");
include_once 'include/header.php';
$user = new USER($conn);
if (!$user->loggedin()) {
    $user->redirect('login');
}
$userID = $_SESSION['user_session'];
$stmt = $conn->prepare("SELECT * FROM user WHERE userID=:userID");
$stmt->execute(array(":userID" => $userID));
$userRow = $stmt->fetch(PDO::FETCH_ASSOC);
//not tidied up
try {
    //runs a query depending on the id of the post
    $query = $conn->prepare("SELECT * FROM blogpost WHERE blogID = :blogID");
    $query->execute(array(':blogID' => $_GET['ID']));
    $row = $query->fetch();
    //echo ;
    if ($row == "") {
        echo "OH NO";
    } else {
        //sets variables for outputting them from the table
        $title = $row['title'];
        $subtitle = $row['subtitle'];
        $preview = $row['preview'];
        $main_text = $row['main_text'];
        $userIdent = $row['userID'];
    }
} catch (PDOException $e) {
開發者ID:IrinaTheNerd,項目名稱:bloggie,代碼行數:31,代碼來源:edit.php

示例9: erreur

 if (empty($post_content)) {
     $error = erreur('USER_NO_FIELDTEXT');
     setFlash($error, "danger");
 } else {
     if ($nb_lignes <= 20) {
         if (strlen($post_content) <= 700) {
             if ($result = $img->upload_img('fichierjoint', '/uploads/posts/', "off")) {
                 if ($result['status'] != 1) {
                     setFlash($result['err'], "danger");
                 } else {
                     /* Nom de l'image */
                     $nomImage = $result['nomimg'];
                     if ($post->addpost($_SESSION['username'], $post_content, $conf, '/uploads/posts/' . $nomImage)) {
                         $error = erreur('SUCCESS_POST');
                         setFlash($error, "success");
                         $user->redirect($_SERVER['REQUEST_URI']);
                     } else {
                         $error = erreur('FAIL_ON_POST');
                         setFlash($error, "danger");
                     }
                 }
             } else {
                 $error = erreur('FAIL_UPLOAD_FILE');
                 setFlash($error, "danger");
             }
         } else {
             $error = erreur('TOO_MANY_CARACT_POST');
             setFlash($error, "danger");
         }
     } else {
         $error = erreur('TOO_MANY_LINES');
開發者ID:Pyozer,項目名稱:Interminale,代碼行數:31,代碼來源:init.php

示例10: catch

                } else {
                    if (strlen($upass) < 6) {
                        $error[] = "Password must be atleast 6 characters";
                    } else {
                        try {
                            $stmt = $user->runQuery("SELECT username, email FROM admin WHERE username=:uname OR email=:umail");
                            $stmt->execute(array(':uname' => $uname, ':umail' => $umail));
                            $row = $stmt->fetch(PDO::FETCH_ASSOC);
                            if ($row['username'] == $uname) {
                                $error[] = "sorry username already taken !";
                            } else {
                                if ($row['email'] == $umail) {
                                    $error[] = "sorry email id already taken !";
                                } else {
                                    if ($user->register($uname, $umail, $upass, $firstname, $lastname)) {
                                        $user->redirect('signup.php?joined');
                                    }
                                }
                            }
                        } catch (PDOException $e) {
                            echo $e->getMessage();
                        }
                    }
                }
            }
        }
    }
}
?>
<!DOCTYPE html>
<html lang="en">
開發者ID:Esdras1995,項目名稱:Guardtour,代碼行數:31,代碼來源:signup.php

示例11: catch

    } else {
        if ($upass == "") {
            $error[] = "Il manque le mot de passe !";
        } else {
            if (strlen($upass) < 6) {
                $error[] = "Le mot de passe doit au moins contenir 6 caractères";
            } else {
                try {
                    $stmt = $user->runQuery("SELECT login FROM user WHERE login=:uname");
                    $stmt->execute(array(':uname' => $uname));
                    $row = $stmt->fetch(PDO::FETCH_ASSOC);
                    if ($row['login'] == $uname) {
                        $error[] = "Le nom d'utilisateur existe déjà !";
                    } else {
                        if ($user->enregistrerUser($uname, $upass, $ustatut)) {
                            $user->redirect('creerUser.php?joined');
                        }
                    }
                } catch (PDOException $e) {
                    echo $e->getMessage();
                }
            }
        }
    }
}
?>
<!DOCTYPE>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>Enregistrer un utilisateur</title>
開發者ID:Mousticke,項目名稱:pinf,代碼行數:31,代碼來源:creerUser.php

示例12: USER

<?php

include_once 'php/config.php';
define("PAGENAME", "Register");
include_once 'include/header.php';
$user = new USER($conn);
//creating object user
if ($user->loggedin() != "") {
    $user->redirect('dashboard.php');
    //redirect to dashboard
}
//once signup input is clicked ...
if (isset($_POST['signup'])) {
    //getting rid of whitespace around sqlite_unbuffered_query
    $email = trim($_POST['email']);
    $password = trim($_POST['password']);
    $confirmed_password = trim($_POST['confirm_password']);
    //checking whether the form is filled correctly
    if ($email == "") {
        $error[] = "Provide your email!";
    } else {
        if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
            $error[] = 'Please enter a valid email address!';
        } else {
            if ($password == "") {
                $error[] = "Provide a password!";
            } else {
                if (strlen($password) < 6) {
                    $error[] = "Password must be atleast 6 characters";
                } else {
                    if (strlen($confirmed_password) < 6) {
開發者ID:IrinaTheNerd,項目名稱:bloggie,代碼行數:31,代碼來源:register.php

示例13: USER

<?php

session_start();
require_once 'classes/class.user.php';
$user_home = new USER();
if (!empty($_GET["delete_id"])) {
    $uname = $_GET["delete_id"];
    for ($i = 0; $i < 4; $i++) {
        if (strlen($uname) != 4) {
            $uname = "0" . $uname;
        }
    }
    $s = $user_home->runQuery("DELETE FROM `today_supply` WHERE supplier_code= :uname");
    $s->execute(array(":uname" => $uname));
    $user_home->redirect('update.php');
}
開發者ID:TSMS,項目名稱:UCSC-groupProject-Tsms,代碼行數:16,代碼來源:delete.php

示例14: USER

<?php

session_start();
require_once 'class.user.php';
$user = new USER();
if ($user->is_loggedin() != "") {
    $user->redirect('home.php');
}
if (isset($_POST['btn-signup'])) {
    $uname = strip_tags($_POST['txt_uname']);
    $umail = strip_tags($_POST['txt_umail']);
    $upass = strip_tags($_POST['txt_upass']);
    $ubirth = strip_tags($_POST['txt_ubirth']);
    if ($uname == "") {
        $error[] = "Enter username!";
    } else {
        if ($umail == "") {
            $error[] = "Enter email!";
        } else {
            if (!filter_var($umail, FILTER_VALIDATE_EMAIL)) {
                $error[] = 'Enter valid email!';
            } else {
                if ($upass == "") {
                    $error[] = "Enter password!";
                } else {
                    if ($ubirth == "") {
                        $error[] = "Enter your birthday!";
                    } else {
                        if (strlen($upass) < 6) {
                            $error[] = "Enter password at least 6 letters!";
                        } else {
開發者ID:kawa314,項目名稱:EmblemDemo,代碼行數:31,代碼來源:sign-up.php

示例15: USER

<?php

session_start();
require_once '../php-assets/class.user.php';
$user = new USER();
if ($user->is_loggedin() != "") {
    $user->redirect('advert-overview.php');
}
if (isset($_POST['register-button'])) {
    $user_first_name = strip_tags(htmlentities($_POST['user-first-name'], ENT_COMPAT, 'UTF-8'));
    $user_last_name = strip_tags(htmlentities($_POST['user-last-name'], ENT_COMPAT, 'UTF-8'));
    $user_email = strip_tags($_POST['user-email']);
    $user_password = strip_tags($_POST['user-password']);
    try {
        $stmt = $user->runQuery("SELECT user_firstname, user_email FROM tbl_user WHERE user_firstname=:user_first_name OR user_email=:user_email");
        $stmt->execute(array(':user_first_name' => $user_first_name, ':user_email' => $user_email));
        $row = $stmt->fetch(PDO::FETCH_ASSOC);
        if ($row['user_email'] == $user_email) {
            $error[] = "Er is al een account aangemaakt met dit e-mail adres.";
        } else {
            if ($user->register($user_first_name, $user_last_name, $user_email, $user_password)) {
                $user->doLogin($user_email, $user_password);
                $user->redirect('advert-overview.php');
            }
        }
    } catch (PDOException $e) {
        echo $e->getMessage();
    }
}
?>
<!doctype html>
開發者ID:kangube,項目名稱:kangu-product,代碼行數:31,代碼來源:register.php


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