本文整理汇总了PHP中Redirect::To方法的典型用法代码示例。如果您正苦于以下问题:PHP Redirect::To方法的具体用法?PHP Redirect::To怎么用?PHP Redirect::To使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Redirect
的用法示例。
在下文中一共展示了Redirect::To方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: register
public function register()
{
/* $user = array(
'name' => Input::get('name'),
'surname' => Input::get('surname'),
'mail' => Input::get('mail'),
'username' => Input::get('username'),
'password' => Input::get('password'),
're-password' => Input::get('re-password')
);*/
$gelen = Input::all();
// Kurallar
$rules = array('name' => 'required|alpha|min:3|max:20', 'surname' => 'required|alpha|min:3|max:20', 'mail' => 'required|email|min:8|max:60|unique:users,user_mail', 'username' => 'required|alpha_dash|min:5|max:15|unique:users,user_uname', 'password' => 'required|confirmed|min:8|max:20', 'password_confirmation' => 'required|min:8|max:20');
// Hata mesajları
$messages = array('name.required' => 'Adınızı Boş Geçmemelisiniz.', 'name.alpha' => 'Adınız Kurallara Uygun Olmalı.', 'name.min' => 'Adiniz asgari :min Karakter Olmalıdır.', 'name.max' => 'Adiniz asgari :max azami Olmalıdır.', 'surname.required' => 'Adınızı Boş Geçmemelisiniz.', 'surname.alpha' => 'Adınız Kurallara Uygun Olmalı.', 'surname.min' => 'Adiniz asgari :min Karakter Olmalıdır.', 'surname.max' => 'Adiniz asgari :max azami Olmalıdır.', 'mail.required' => 'Mail adresinizi bilmeliyiz.', 'mail.email' => 'Geçerli bir mail adresiniz olmalı.', 'mail.unique' => 'Mail adresi başkası tarafından kullanılıyor.', 'mail.max' => 'Mail adresiniz azami :max Karakter Olmalıdır.', 'mail.min' => 'Mail adresiniz asgari :min Karakter Olmalıdır.', 'username.required' => 'Kullanıcı adınızı Boş Geçmemelisiniz.', 'username.unique' => 'Kullanıcı adı başkası tarafından kullanılıyor.', 'username.alpha_dash' => 'Geçerli bir kullanıcı adınız olmalı.', 'username.min' => 'Kullanici Adiniz asgari :min Karakter Olmalıdır.', 'username.max' => 'Kullanici Adiniz Azami :max Karakter Olmalıdır.', 'password.required' => 'Şifreniz boş olmamalı.', 'password.confirmed' => 'Şifreler Birbiriyle Uyuşmuyor.', 'password.min' => 'Şifreniz en az :min karakterli olmalıdır.', 'password.max' => 'Şifreniz en fazla :max karakterli olmalıdır.');
// Validation
$validate = Validator::make($gelen, $rules, $messages);
if ($validate->fails()) {
return View::make('register.register')->withErrors($validate);
} else {
$uye = new User();
$uye->name = $gelen['name'] . ' ' . $gelen['surname'];
$uye->mail = $gelen['mail'];
$uye->uname = $gelen['username'];
$uye->password = Hash::make($gelen['password']);
$uye->save();
$insertedId = $uye->id;
if ($insertedId) {
$dizi['register'] = true;
return Redirect::To('login')->with('register', 'success');
}
}
}
示例2: create
/**
* Show the form for creating a new user
*
* @return Response
*/
public function create()
{
$validator = Validator::make($data = Input::all(), User::$rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
$user = new User();
$user->username = $data['username'];
$user->password = Hash::make($data['username']);
$user->email = $data['email'];
$user->save();
Flash::success('You have Created a New User!');
Redirect::To('/');
}
示例3: agregarevento
public function agregarevento()
{
if (Request::isMethod('post')) {
$rules = array('razon' => 'required|min:6|max:30', 'fecha_ini' => 'required', 'fecha_fin' => 'required');
$validation = Validator::make(Input::except('_token'), $rules);
if ($validation->fails()) {
return Redirect::to('agregar-evento')->withErrors($validation);
}
$data = Input::except("_token");
$data['tiempo_ini'] = date("G:i", strtotime(Input::get('tiempo_ini')));
$data['tiempo_fin'] = date("G:i", strtotime(Input::get('tiempo_fin')));
$data = array_add($data, 'persona', Auth::user()->nombre);
$data = array_add($data, 'user_id', Auth::user()->id);
$evento = Eventos::create($data);
flashMessage("Evento Agregado Correctamente");
return Redirect::To('ver-eventos');
}
$areas = Areas::get();
return View::make('agregarevento')->with(compact('areas'));
}
示例4: catch
| Create the database file and insert the default sittengs
|
|--------------------------------------------------------------------------
*/
$dbFile = ABSPATH . '/database/' . Config::Get('db/dbname') . '.db';
if (!file_exists($dbFile)) {
Session::Put("setup", true);
Redirect::To("install");
die;
}
/*
|--------------------------------------------------------------------------
| Check If there an admin
|--------------------------------------------------------------------------
|
*/
if (file_exists($dbFile)) {
try {
if (DB::GetInstance()->queryGet("SELECT id FROM users where roles = 1 ")->count() == 0) {
Session::Put("setup", true);
Redirect::To("install");
die;
}
} catch (Exception $ex) {
session_destroy();
die("Some database table(s) is missing Please delete the database file an reinstall the application.");
}
}
// Everything is okay
Session::Delete("setup");
Options::CheckSiteUrl();
示例5: FbAppAuth
private function FbAppAuth($app_id, $app_secret, $redirect, $oldApi)
{
$fb = new Facebook\Facebook(['app_id' => $app_id, 'app_secret' => $app_secret, 'default_graph_version' => 'v2.4']);
$helper = $fb->getRedirectLoginHelper();
try {
$accessToken = $helper->getAccessToken();
} catch (Facebook\Exceptions\FacebookResponseException $e) {
// When Graph returns an error
throw new Exception($e->getMessage());
return false;
} catch (Facebook\Exceptions\FacebookSDKException $e) {
// When validation fails or other local issues
throw new Exception($e->getMessage());
return false;
}
if (Input::Get('state', 'GET') && Input::Get('code', 'GET')) {
return $accessToken;
} else {
if (Input::Get('error_message')) {
throw new Exception(Input::Get('error_message', 'GET'));
}
}
$perms = array();
$perms[] = "publish_actions";
$perms[] = "public_profile";
if ($oldApi == "true") {
$perms[] = "user_groups";
}
Redirect::To($helper->getLoginUrl($redirect, $perms));
}
示例6: viewActivity
public function viewActivity($gid, $id)
{
$activity = GroupPageActivityGroup::with('groupPageActivity', 'groupPage')->where('grouppageactivityID', $id)->where('grouppageID', $gid)->first();
$submittedFile = GroupPageActivityFiles::with('owner')->where('OwnerID', Auth::user()->StudentID)->where('grouppageactivityID', $id)->first();
if (MyDate::onGoing($activity->deadline, date('Y-m-d H:i:s'))) {
return Redirect::To('/')->with('message', 'The requested page is unavailable.')->with('url', '');
}
return View::make('validated.grouppage.viewActivity', compact('activity', 'submittedFile'));
}
示例7: Template
<?php
include 'core/init.php';
$template = new Template();
$logs = new Logs();
if (Input::get("action", "GET") == "clear") {
try {
Logs::Clear();
Session::Flash("logs", "success", lang('LOGS_CLEARED'), true);
} catch (Exception $ex) {
Session::Flash("logs", "danger", $ex->GetMessage(), true);
}
Redirect::To("logs.php");
}
$template->header("Logs");
if (Session::exists('logs')) {
foreach (Session::Flash('logs') as $error) {
echo "<div class='alert alert-" . $error['type'] . "' role='alert'>";
echo "<a href='#' class='close' data-dismiss='alert' aria-label='close'>×</a>";
echo "<span class='glyphicon glyphicon-exclamation-sign' aria-hidden='true'></span>";
echo " " . $error['message'];
echo "</div>";
}
}
?>
<div class="messageBox"></div>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><span class="glyphicon glyphicon-alert"></span> <?php
echo lang("logs");
示例8: lang
if ($user->find(Input::get('username'))) {
// Send confirmation email
if ($active == 0) {
$registerMessage = "Hello " . Input::get('username') . ",<br /><br />";
$registerMessage .= "Thank you for registering with " . Options::get("sitename") . "! To complete your registration, please click on the link below or paste it into a browser to confirm your e-mail address.<br/>";
$registerMessage .= "<a href='" . Options::Get("siteurl") . "/confirmregistration.php?email=" . Input::Get("email") . "&code=" . $code . "' >" . Options::Get("siteurl") . "/confirmregistration.php?email=" . Input::Get("email") . "&code=" . $code . "</a>";
$registerMessage .= "<br/><br/><br/>Please do not reply to this message.<br/>" . Options::get("sitename");
Mail::Send(Input::Get("email"), Options::get("sitename") . ' Account activation', $registerMessage);
}
$registerSuccessMsg = lang('THANK_YOU_REGISTERING');
if ($active == 0) {
$registerSuccessMsg .= "<br/>" . lang('THANK_YOU_REGISTERING_CONFIRMATION');
}
// User message after the signing up
Session::flash("signin", "success", $registerSuccessMsg, true);
Redirect::To("signin.php");
}
} catch (Exception $e) {
echo "<div class='alert alert-danger alert-singnin' role='alert'>";
echo lang("OPERATION_FAILED_TRY_AGAIN") . "<br/> " . $e->GetMessage();
echo "</div>";
}
} else {
echo "<div class='alert alert-danger alert-singnin' role='alert'><ul>";
foreach ($validation->errors() as $error) {
echo "<li>" . $error . "</li>";
}
echo "</ul></div>";
}
}
?>
示例9: Posts
<?php
include 'core/init.php';
$posts = new Posts();
$template = new Template();
if (Input::get("action", "GET") == "delete" && Input::Get("id", "GET")) {
try {
$posts->delete(Input::Get("id", "GET"));
Session::Flash("posts", "success", lang('POST_DELETED_SUCCESS'), true);
} catch (Exception $ex) {
Session::Flash("posts", "danger", $ex->GetMessage(), true);
}
Redirect::To("posts.php");
}
$template->header("Posts");
if (Session::exists('posts')) {
foreach (Session::Flash('posts') as $error) {
echo "<div class='alert alert-" . $error['type'] . "' role='alert'>";
echo "<a href='#' class='close' data-dismiss='alert' aria-label='close'>×</a>";
echo "<span class='glyphicon glyphicon-exclamation-sign' aria-hidden='true'></span>";
echo " " . $error['message'];
echo "</div>";
}
}
?>
<div class="messageBox"></div>
<div class="panel panel-default">
<div class="panel-heading">
<h3 class="panel-title"><span class="glyphicon glyphicon-duplicate"></span> <?php
示例10: foreach
foreach (Input::get("checkbox") as $checkbox) {
$user->Delete($checkbox);
}
Session::Flash("usersPage", "success", lang('USERS_ACCOUNT_DELETED_SUCCESS'), true);
} catch (Exception $ex) {
Session::Flash("usersPage", "danger", $ex->GetMessage(), true);
}
}
if (Input::get("action") == "delete" && Input::get("userId") && $user->hasPermission("admin")) {
try {
$user->Delete(Input::get("userId"));
Session::Flash("usersPage", "success", lang('USER_ACCOUNT_DELETED_SUCCESS'), true);
} catch (Exception $ex) {
Session::Flash("usersPage", "danger", $ex->GetMessage(), true);
}
Redirect::To("users.php");
}
if (Input::get("activate") && $user->hasPermission("admin") && Input::get("checkbox")) {
try {
foreach (Input::get("checkbox") as $checkbox) {
$user->activate($checkbox);
}
Session::Flash("usersPage", "success", lang('USERS_ACCOUNT_ACTIVE_SUCCESS'), true);
} catch (Exception $ex) {
Session::Flash("usersPage", "danger", $ex->GetMessage(), true);
}
}
if (Input::get("deactivate") && $user->hasPermission("admin") && Input::get("checkbox")) {
try {
foreach (Input::get("checkbox") as $checkbox) {
$user->deactivate($checkbox);
示例11: catch
$fb->DeleteApp(Input::get("id", "GET"));
} catch (Exception $ex) {
Session::Flash("settings", "danger", $ex->GetMessage(), true);
}
Redirect::To("settings.php#tab-fbApps");
}
// Deauthorize
if (Input::get("action", "GET") == "deauthorize" && Input::get("id", "GET")) {
try {
$fb->DeauthorizeApp(Input::get("id", "GET"));
Session::Flash("settings", "success", lang('APP_DEAUTH_SUCCESS'), true);
} catch (Exception $ex) {
echo $ex->GetMessage();
Session::Flash("settings", "danger", $ex->GetMessage(), true);
}
Redirect::To("settings.php#tab-fbApps");
}
if (Input::get('save')) {
$validate = new Validate();
$validation = $validate->check($_POST, array('postInterval' => array('disp_text' => lang('POST_INTERVAL'), 'required' => true), 'language' => array('disp_text' => lang('LANGUAGE'), 'required' => true, 'inArray' => Language::GetAvailableLangs())));
if (Input::Get("email") != $user->data()->email) {
$validation = $validate->check($_POST, array('email' => array('disp_text' => lang('EMAIL'), 'required' => true, 'unique' => 'users', 'valid_email' => true)));
}
if (Input::Get("password")) {
$validation = $validate->check($_POST, array('password' => array('disp_text' => lang('PASSWORD'), 'min' => '6', 'max' => '32'), 'repassword' => array('disp_text' => lang('RE_ENTER_PASSWORD'), 'required' => true, 'matches' => 'password')));
}
if ($validation->passed()) {
try {
$db = DB::GetInstance();
$openGroupOnly = Input::Get("openGroupOnly") == "on" ? 1 : 0;
$uniquePost = Input::Get("uniquePost") == "on" ? 1 : 0;
示例12: getNotifications
public function getNotifications($autologin_token)
{
eerror_log('Task Notifications autologin' . json_encode($autologin_token));
// logout
Auth::logout();
$missing_sales_autologin_entry = TaskNotificationAutologin::where('token', $autologin_token)->first();
if (!$missing_sales_autologin_entry) {
return Redirect::To('/');
} else {
$user = User::find($missing_sales_autologin_entry->users_id);
Auth::loginUsingId($user->id);
$event_id = $missing_sales_autologin_entry->events_id;
$task_id = $missing_sales_autologin_entry->taskevents_id;
$missing_sales_autologin_entry->update(['token' => null]);
return Redirect::to('/my-events/' . $event_id . '/dashboard?taskId=' . $task_id);
}
}
示例13: user
$salt = Hash::salt(32);
try {
$user = new user();
$user->create(array('username' => Input::get('username'), 'password' => Hash::make(Input::get('password'), $salt), 'salt' => $salt, 'email' => Input::get('email'), 'roles' => '1', 'active' => '1', 'signup' => date('Y-m-d H:i:s')));
$siteurl = substr(CurrentPath(), 0, strrpos(CurrentPath(), 'install/'));
$db->query("INSERT INTO `options` (`option`,`value`) values ('siteurl', ? )", array($siteurl));
$db->query("INSERT INTO `options` (`option`,`value`) values ('sitename', ? )", array(Input::get('sitename')));
$db->query("INSERT INTO `options` (`option`,`value`) values ('users_can_register', '1' )");
$db->query("INSERT INTO `options` (`option`,`value`) values ('users_must_confirm_email', '0' )");
// Setup the cron jobs (Evry 5 min by default)
$output = shell_exec('crontab -l');
$cron_file = "/tmp/crontab.txt";
$cmd = "* * * * * wget -O /dev/null " . $siteurl . "cron.php >/dev/null 2>&1";
file_put_contents($cron_file, $output . $cmd . PHP_EOL);
exec("crontab {$cron_file}");
Redirect::To("../index.php");
} catch (Exception $e) {
die($e->getMessage());
}
}
if (!empty($errors)) {
echo "<div class='alert alert-danger' role='alert'>";
echo "<a href='#' class='close' data-dismiss='alert' aria-label='close'>×</a>";
echo "<span class='glyphicon glyphicon-exclamation-sign' aria-hidden='true'></span>";
foreach ($errors as $error) {
echo " " . $error . "</br>";
}
echo "</div>";
} elseif ($validation->errors()) {
echo "<div class='alert alert-danger' role='alert'>";
echo "<a href='#' class='close' data-dismiss='alert' aria-label='close'>×</a>";
示例14: realpath
require_once realpath(dirname(__FILE__)) . '/Classes/Input.php';
require_once realpath(dirname(__FILE__)) . '/Classes/Validate.php';
require_once realpath(dirname(__FILE__)) . '/Classes/Token.php';
require_once realpath(dirname(__FILE__)) . '/Classes/Session.php';
if (Input::exists()) {
if (Token::check(Input::get('token'))) {
$validate = new Validate();
$validation = $validate->check($_POST, array('username' => array('required' => true, 'min' => 2, 'max' => 20, 'unique' => 'Users'), 'password' => array('required' => true, 'min' => 6, 'max' => 64), 'password_again' => array('required' => true, 'matches' => 'password'), 'name' => array('required' => true, 'min' => 2, 'max' => 50)));
if ($validate->passed()) {
$user = new User();
$salt = Hash::salt(32);
try {
$user->create(array('username' => Input::get('username'), 'password' => Hash::make(Input::get('password')), 'salt' => $salt, 'name' => Input::get('name'), 'joined' => date('Y-m-d H:i:s'), 'groupid' => 1));
Session::flash('home', 'You have been registered and can now log in');
Redirect::To(404);
} catch (Exception $e) {
die($e->getMessage());
}
} else {
print_r($validate->errors());
}
}
}
?>
<form action="" method="POST">
<div class="field">
<label for="username">Username</label>
<input type="text" name="username" id="username" value="" autocomplete="off">
</div>