本文整理汇总了PHP中WebPage::redirectTo方法的典型用法代码示例。如果您正苦于以下问题:PHP WebPage::redirectTo方法的具体用法?PHP WebPage::redirectTo怎么用?PHP WebPage::redirectTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WebPage
的用法示例。
在下文中一共展示了WebPage::redirectTo方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: WebPage
session_start();
define("CONST_FILE_PATH", "includes/constants.php");
define("CURRENT_PAGE", "search");
require 'classes/WebPage.php';
//Set up page as a web page
$thisPage = new WebPage();
//Create new instance of webPage class
$dbObj = new Database();
//Instantiate database
$thisPage->dbObj = $dbObj;
$courseObj = new Course($dbObj);
$categoryObj = new CourseCategory($dbObj);
$quoteObj = new Quote($dbObj);
$memberObj = new Tutor($dbObj);
$searchParam = filter_input(INPUT_GET, 's') ? filter_input(INPUT_GET, 's') : $thisPage->redirectTo(SITE_URL . '404');
include 'includes/other-settings.php';
require 'includes/page-properties.php';
?>
<!DOCTYPE html>
<html lang="en-US">
<head>
<?php
include 'includes/meta-tags.php';
?>
<style type="text/css">img.wp-smiley,img.emoji {display: inline !important;border: none !important;box-shadow: none !important;height: 1em !important;width: 1em !important;margin: 0 .07em !important;vertical-align: -0.1em !important;background: none !important;padding: 0 !important; }</style>
<link rel='stylesheet' id='rs-plugin-settings-css' href='<?php
echo SITE_URL;
?>
plugins/revslider/rs-plugin/css/settings1dc6.css?ver=4.6.5' type='text/css' media='all' />
<link rel='stylesheet' id='themerex-prettyphoto-style-css' href='<?php
示例2: WebPage
<?php
session_start();
include '../classes/WebPage.php';
$thisPage = new WebPage('../includes/constants.php');
if ($_SESSION['LoggedIn'] == true) {
session_destroy();
$thisPage->redirectTo('./?' . base64_encode('loggedout'));
exit;
}
示例3: WebPage
<?php
session_start();
include '../classes/WebPage.php';
//Set up page as a web page
$thisPage = new WebPage('../includes/constants.php');
//Create new instance of webPage class
//If user is not loggedIn reject the user
if (!isset($_SESSION['LoggedIn']) || $_SESSION['USERTYPE'] != 'Admin') {
$thisPage->redirectTo('index');
}
//redirect user to login page
$msg = "";
//Success or failure message
$errorArr = array();
//Array of errors
$dbObj = new Database();
$userObj = new User();
//User Deletion Handler
if (filter_input(INPUT_POST, "delete-user") !== NULL) {
$userToDel = new User();
//Instantiate user class
$userToDel->id = filter_input(INPUT_POST, 'hidden-user-id') ? mysqli_real_escape_string($dbObj->connection, filter_input(INPUT_POST, 'hidden-user-id', FILTER_VALIDATE_INT)) : '';
if (filter_input(INPUT_POST, 'hidden-user-id') === "") {
array_push($errorArr, "Illegal Operation.");
}
//If validated and not empty submit it to database
if (count($errorArr) < 1) {
if ($userToDel->delete($dbObj, 'users') === 'success') {
$msg = $thisPage->messageBox('User successfully deleted.', 'success');
} else {
示例4: WebPage
define("CURRENT_PAGE", "event-detail");
require 'classes/WebPage.php';
//Set up page as a web page
$thisPage = new WebPage();
//Create new instance of webPage class
$dbObj = new Database();
//Instantiate database
$thisPage->dbObj = $dbObj;
$courseObj = new Course($dbObj);
$categoryObj = new CourseCategory($dbObj);
$eventObj = new Event($dbObj);
$quoteObj = new Quote($dbObj);
include 'includes/other-settings.php';
require 'includes/page-properties.php';
//get the course id; if failed redirect to course-categories page
$thisEventId = filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT) ? filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT) : $thisPage->redirectTo('index');
foreach ($eventObj->fetchRaw("*", " id = {$thisEventId} ") as $event) {
$eventData = array('id' => 'id', 'name' => 'name', 'image' => 'image', 'description' => 'description', 'location' => 'location', 'dateTime' => 'date_time', 'status' => 'status');
foreach ($eventData as $key => $value) {
switch ($key) {
case 'image':
$eventObj->{$key} = MEDIA_FILES_PATH1 . 'event/' . $event[$value];
break;
case 'status':
if ($event[$value] == 0) {
$thisPage->redirectTo('index');
}
break;
default:
$eventObj->{$key} = $event[$value];
break;
示例5: WebPage
define("CURRENT_PAGE", "member-detail");
require 'classes/WebPage.php';
//Set up page as a web page
$thisPage = new WebPage();
//Create new instance of webPage class
$dbObj = new Database();
//Instantiate database
$thisPage->dbObj = $dbObj;
$courseObj = new Course($dbObj);
$categoryObj = new CourseCategory($dbObj);
$quoteObj = new Quote($dbObj);
$memberObj = new Tutor($dbObj);
include 'includes/other-settings.php';
require 'includes/page-properties.php';
//get the course id; if failed redirect to course-categories page
$thisMemberId = filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT) ? filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT) : $thisPage->redirectTo('members/');
foreach ($memberObj->fetchRaw("*", " id = {$thisMemberId} ") as $member) {
$memberData = array('id' => 'id', 'name' => 'name', 'picture' => 'picture', 'bio' => 'bio', 'website' => 'website', 'qualification' => 'qualification', 'field' => 'field', 'email' => 'email');
foreach ($memberData as $key => $value) {
switch ($key) {
case 'picture':
$memberObj->{$key} = MEDIA_FILES_PATH1 . 'tutor/' . $member[$value];
break;
default:
$memberObj->{$key} = $member[$value];
break;
}
}
}
//Override page-properties
$thisPage->title = StringManipulator::trimStringToFullWord(62, stripslashes(strip_tags($memberObj->name . " Profile - " . WEBSITE_AUTHOR)));
示例6: array
$message->setTo(array($emailAddress => WEBSITE_AUTHOR));
$message->setSubject($subject);
$message->setBody($body);
$message->setFrom($email, $name);
$message->setContentType("text/html");
$mailer = Swift_Mailer::newInstance($transport);
$mailer->send($message);
$msgStatus = 'success';
$msg = 'Your course booking message has been sent.';
} else {
$msgStatus = 'error';
$msg = $thisPage->showError($errorArr);
}
}
//get the course id; if failed redirect to course-categories page
$thisCourseId = filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT) ? filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT) : $thisPage->redirectTo('courses');
foreach ($courseObj->fetchRaw("*", " status = 1 AND id = {$thisCourseId} ") as $course) {
$courseData = array('id' => 'id', 'name' => 'name', 'code' => 'code', 'image' => 'image', 'media' => 'media', 'amount' => 'amount', 'shortName' => 'short_name', 'category' => 'category', 'startDate' => 'start_date', 'endDate' => 'end_date', 'description' => 'description', 'status' => 'status', 'featured' => 'featured', 'currency' => 'currency');
foreach ($courseData as $key => $value) {
switch ($key) {
case 'image':
$courseObj->{$key} = MEDIA_FILES_PATH1 . 'course-image/' . $course[$value];
break;
case 'media':
$courseObj->{$key} = $course[$value];
break;
case 'startDate':
$dateParam = explode('-', $course[$value]);
$dateObj = DateTime::createFromFormat('!m', $dateParam[1]);
$courseObj->{$key} = $dateParam[2] . ' ' . $dateObj->format('F') . ', ' . $dateParam[0] . '.';
break;
示例7: Database
<?php
session_start();
include '../config/config.php';
$dbObj = new Database($cfg);
//Instantiate database
$thisPage = new WebPage($dbObj);
//Create new instance of webPage class
$contestObj = new Contest($dbObj);
// Create an object of Contest class
$errorArr = array();
//Array of errors
//get the contest id; if failed redirect to contest-categories page
$thisContestId = filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT) ? filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT) : $thisPage->redirectTo('manage-contests');
//Check if the contest exists if not redirect it to manage-contests page
if (count($contestObj->fetchRaw("*", " id = {$thisContestId} ")) < 1) {
$thisPage->redirectTo('manage-contests');
}
foreach ($contestObj->fetchRaw("*", " id = {$thisContestId} ") as $contest) {
$contestData = array('status' => 'status', 'id' => 'id', 'title' => 'title', 'intro' => 'intro', 'description' => 'description', 'header' => 'header', 'logo' => 'logo', 'startDate' => 'start_date', 'endDate' => 'end_date', 'announcementDate' => 'announcement_date', 'winners' => 'winners', 'question' => 'question', 'answer' => 'answer', 'point' => 'point', 'bonusPoint' => 'bonus_point', 'rules' => 'rules', 'prize' => 'prize', 'message' => 'message', 'css' => 'css', 'dateAdded' => 'date_added', 'announceWinner' => 'announce_winner', 'restart' => 'restart', 'restartInterval' => 'restart_interval', 'cutOffPoint' => 'cut_off_point', 'theme' => 'theme');
foreach ($contestData as $key => $value) {
switch ($key) {
default:
$contestObj->{$key} = $contest[$value];
break;
}
}
}
$cfg->templateName = $contestObj->theme ? $contestObj->theme : 'default';
?>
<!DOCTYPE html>
示例8: Database
<?php
session_start();
include 'config/config.php';
require 'swiftmailer/lib/swift_required.php';
$dbObj = new Database($cfg);
//Instantiate database
$thisPage = new WebPage($dbObj, 'webpage');
//Create new instance of webPage class
$contestObj = new Contest($dbObj);
$entrantObj = new Entrant($dbObj);
$errorArr = array();
//get the contest id; if failed redirect to contest-home page
$thisContestId = filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT) ? filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT) : $thisPage->redirectTo(SITE_URL);
if (count($contestObj->fetchRaw("*", " id = {$thisContestId} AND status = 1 ")) < 1) {
$thisPage->redirectTo(SITE_URL);
}
foreach ($contestObj->fetchRaw("*", " id = {$thisContestId} ") as $contest) {
$contestData = array('status' => 'status', 'id' => 'id', 'title' => 'title', 'intro' => 'intro', 'description' => 'description', 'header' => 'header', 'logo' => 'logo', 'startDate' => 'start_date', 'endDate' => 'end_date', 'announcementDate' => 'announcement_date', 'winners' => 'winners', 'question' => 'question', 'answer' => 'answer', 'point' => 'point', 'bonusPoint' => 'bonus_point', 'rules' => 'rules', 'prize' => 'prize', 'message' => 'message', 'css' => 'css', 'dateAdded' => 'date_added', 'announceWinner' => 'announce_winner', 'restart' => 'restart', 'restartInterval' => 'restart_interval', 'cutOffPoint' => 'cut_off_point', 'theme' => 'theme');
foreach ($contestData as $key => $value) {
switch ($key) {
case 'header':
$contestObj->{$key} = MEDIA_FILES_PATH1 . 'contest-header/' . $contest[$value];
break;
case 'logo':
$contestObj->{$key} = MEDIA_FILES_PATH1 . 'contest-logo/' . $contest[$value];
break;
default:
$contestObj->{$key} = $contest[$value];
break;
}
示例9: switch
array_push($errorArr, "Password Mismatch !!! ");
if (filter_input(INPUT_POST, $postVar) == "") {
array_push($errorArr, "Please confirm your password. ");
}
}
default:
if (filter_input(INPUT_POST, $postVar) == "") {
array_push($errorArr, "Please enter a {$postVar} ");
}
}
}
if (count($errorArr) < 1) {
$thisUser->password = mysqli_real_escape_string($dbObj->connection, filter_input(INPUT_POST, 'password1'));
$thisUser->id = $_SESSION['USERID'];
$newPassword = mysqli_real_escape_string($dbObj->connection, filter_input(INPUT_POST, 'password'));
switch ($thisUser->changePassword($dbObj, 'users', $newPassword)) {
case 'success':
$_SESSION['topmsg'] = $thisPage->messageBox('Password successfully changed.', 'success');
$thisPage->redirectTo($_SERVER['HTTP_REFERER']);
break;
case 'error':
$_SESSION['topmsg'] = $thisPage->messageBox('Password update failed. Please re-enter your details.', 'error');
$thisPage->redirectTo($_SERVER['HTTP_REFERER']);
break;
}
} else {
$_SESSION['topmsg'] = $thisPage->showError($errorArr);
$thisPage->redirectTo($_SERVER['HTTP_REFERER']);
}
//Display error messages
}
示例10: User
$thisUser = new User();
//Instantiate user class
//Login Handler
if (filter_input(INPUT_POST, "login") !== NULL) {
$postVars = ['username', 'password'];
// Login Form field names
foreach ($postVars as $postVar) {
$thisUser->{$postVar} = filter_input(INPUT_POST, $postVar) ? mysqli_real_escape_string($dbObj->connection, filter_input(INPUT_POST, $postVar)) : '';
if (filter_input(INPUT_POST, $postVar) == "") {
array_push($errorArr, "Please enter a {$postVar} ");
}
}
if (count($errorArr) < 1) {
switch ($thisUser->login($dbObj, 'users')) {
case 'success':
$thisPage->redirectTo('dashboard');
break;
case 'error':
$msg = $thisPage->messageBox('Login Failed. Please re-enter you login details.', 'error');
break;
}
} else {
$msg = $thisPage->showError($errorArr);
}
//Display error messages
}
//Logout Handler
if (!isset($_SESSION['LoggedIn']) && filter_input(INPUT_GET, base64_encode('loggedout')) !== NULL && filter_input(INPUT_POST, "login") === NULL) {
$msg = $thisPage->messageBox('You are now successfully logged out', 'success');
}
?>
示例11: User
$userObj = new User($dbObj);
// Create an object of Admin class
$errorArr = array();
//Array of errors
$msg = '';
$msgStatus = '';
if (isset($_GET['id']) && isset($_GET['email'])) {
$userObj->email = filter_input(INPUT_GET, 'email', FILTER_VALIDATE_EMAIL) ? mysqli_real_escape_string($dbObj->connection, filter_input(INPUT_GET, 'email', FILTER_VALIDATE_EMAIL)) : '';
if ($userObj->email == "") {
array_push($errorArr, "valid email ");
}
$userObj->id = filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT) ? mysqli_real_escape_string($dbObj->connection, filter_input(INPUT_GET, 'id', FILTER_VALIDATE_INT)) : '';
if ($userObj->id == "") {
array_push($errorArr, " id ");
}
if (count($errorArr) < 1) {
if (!$userObj->emailExists()) {
$msgStatus = 'error';
$msg = '<h3>Subscription Removal Failed!</h3><p>REASON: Your email does not exist in our database.</p>';
} else {
$msgStatus = $userObj->deleteRaw();
$msg = $msgStatus == 'success' ? '<h3>SUCCESS</h3><p>You have successfully unsubscribed from our site.</p>' : '<h3>ERROR</h3><p>Subscription removal failed.</p>';
}
} else {
$msgStatus = 'error';
$msg = $thisPage->showError($errorArr);
}
$_SESSION['msgStatus'] = $msgStatus;
$_SESSION['msg'] = $msg;
$thisPage->redirectTo(SITE_URL);
}