本文整理汇总了PHP中Redirect函数的典型用法代码示例。如果您正苦于以下问题:PHP Redirect函数的具体用法?PHP Redirect怎么用?PHP Redirect使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Redirect函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: delete
public function delete($id = null)
{
$account = $this->load_account($id);
$account->destroy();
Site::flash("notice", "The account has been deleted");
Redirect("admin/twitter/accounts");
}
示例2: Comment
public function Comment()
{
$Session = Gdn::Session();
$this->Form->SetModel($this->ActivityModel);
$NewActivityID = 0;
if ($this->Form->AuthenticatedPostBack()) {
$Body = $this->Form->GetValue('Body', '');
$ActivityID = $this->Form->GetValue('ActivityID', '');
if ($Body != '' && is_numeric($ActivityID) && $ActivityID > 0) {
$NewActivityID = $this->ActivityModel->Add($Session->UserID, 'ActivityComment', $Body, '', $ActivityID, '', TRUE);
}
}
// Redirect back to the sending location if this isn't an ajax request
if ($this->_DeliveryType === DELIVERY_TYPE_ALL) {
Redirect($this->Form->GetValue('Return', Gdn_Url::WebRoot()));
} else {
// Load the newly added comment
$this->Comment = $this->ActivityModel->GetID($NewActivityID);
$this->Comment->ActivityType .= ' Hidden';
// Hide it so jquery can reveal it
// Set it in the appropriate view
$this->View = 'comment';
// And render
$this->Render();
}
}
示例3: Set
/**
* Allows the setting of data into one of two serialized data columns on the
* user table: Preferences and Attributes. The method expects "Name" &
* "Value" to be in the $_POST collection. This method always saves to the
* row of the user id performing this action (ie. $Session->UserID). The
* type of property column being saved should be specified in the url:
* ie. /dashboard/utility/set/preference/name/value/transientKey
* or /dashboard/utility/set/attribute/name/value/transientKey
*
* @param string The type of value being saved: preference or attribute.
* @param string The name of the property being saved.
* @param string The value of the property being saved.
* @param string A unique transient key to authenticate that the user intended to perform this action.
*/
public function Set($UserPropertyColumn = '', $Name = '', $Value = '', $TransientKey = '') {
$this->_DeliveryType = DELIVERY_TYPE_BOOL;
$Session = Gdn::Session();
$Success = FALSE;
if (
in_array($UserPropertyColumn, array('preference', 'attribute'))
&& $Name != ''
&& $Value != ''
&& $Session->UserID > 0
&& $Session->ValidateTransientKey($TransientKey)
) {
$UserModel = Gdn::Factory("UserModel");
$Method = $UserPropertyColumn == 'preference' ? 'SavePreference' : 'SaveAttribute';
$Success = $UserModel->$Method($Session->UserID, $Name, $Value) ? 'TRUE' : 'FALSE';
}
if (!$Success)
$this->Form->AddError('ErrorBool');
// Redirect back where the user came from if necessary
if ($this->_DeliveryType == DELIVERY_TYPE_ALL)
Redirect($_SERVER['HTTP_REFERER']);
else
$this->Render();
}
示例4: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store(Request $request)
{
$this->validate($request, ['soal' => 'required|min:5', 'opsiA' => 'required|different:opsiB,opsiC,opsiD', 'opsiB' => 'required|different:opsiA,opsiC,opsiD', 'opsiC' => 'required|different:opsiA,opsiB,opsiD', 'opsiD' => 'required|different:opsiA,opsiB,opsiC', 'opsiBenar' => 'required', 'kuis_id' => 'required|integer']);
$kuis = Kuis::find($request->kuis_id);
Soal::create($request->all());
return Redirect('kuis/' . $request->kuis_id)->with('successMessage', " Berhasil menambahkan soal pada {$kuis->title}");
}
示例5: AccountRoleForm
function AccountRoleForm(&$Context, &$UserManager, $User)
{
$this->Name = 'AccountRoleForm';
$this->ValidActions = array('ApproveUser', 'DeclineUser', 'Role', 'ProcessRole');
$this->Constructor($Context);
if ($this->IsPostBack) {
$this->User =& $User;
$Redirect = 0;
if ($this->PostBackAction == 'ProcessRole' && $this->IsValidFormPostBack() && $this->Context->Session->UserID != $User->UserID && $this->Context->Session->User->Permission('PERMISSION_CHANGE_USER_ROLE')) {
$urh = $this->Context->ObjectFactory->NewObject($this->Context, 'UserRoleHistory');
$urh->GetPropertiesFromForm();
if ($UserManager->AssignRole($urh)) {
$Redirect = 1;
}
}
if ($Redirect) {
$Url = GetUrl($this->Context->Configuration, $this->Context->SelfUrl, '', 'u', $User->UserID);
Redirect($Url);
} else {
$this->PostBackAction = str_replace('Process', '', $this->PostBackAction);
}
if ($this->PostBackAction == 'Role') {
$RoleManager = $this->Context->ObjectFactory->NewContextObject($this->Context, 'RoleManager');
$RoleData = $RoleManager->GetRoles();
$this->RoleSelect = $this->Context->ObjectFactory->NewObject($this->Context, 'Select');
$this->RoleSelect->Name = 'RoleID';
$this->RoleSelect->CssClass = 'PanelInput';
$this->RoleSelect->AddOptionsFromDataSet($this->Context->Database, $RoleData, 'RoleID', 'Name');
$this->RoleSelect->SelectedValue = $this->User->RoleID;
$this->RoleSelect->Attributes = ' id="ddRoleID"';
}
}
$this->CallDelegate('Constructor');
}
示例6: save
public function save(Request $request)
{
//dd($request);
$this->validate($request, ['Name' => 'required|max:100', 'Email' => 'required|email', 'Password' => 'required|min:6', 'Role' => 'required']);
Users::create(['Name' => $request['Name'], 'Email' => $request['Email'], 'Role_Id' => $request['Role'], 'Password' => Hash::make($request['Password'])]);
return Redirect('users');
}
示例7: PluginController_ThankFor_Create
public function PluginController_ThankFor_Create($Sender)
{
$Session = $this->Session;
if (!$Session->IsValid()) {
return;
}
//$Sender->Permission('Plugins.ThankfulPeople.Thank'); // TODO: PERMISSION THANK FOR CATEGORY
$ThanksLogModel = new ThanksLogModel();
$Type = GetValue(0, $Sender->RequestArgs);
$ObjectID = GetValue(1, $Sender->RequestArgs);
$Field = $ThanksLogModel->GetPrimaryKeyField($Type);
$UserID = $ThanksLogModel->GetObjectInserUserID($Type, $ObjectID);
if ($UserID == False) {
throw new Exception('Object has no owner.');
}
if ($UserID == $Session->UserID) {
throw new Exception('You cannot thank yourself.');
}
if (!self::IsThankable($Type)) {
throw new Exception("Not thankable ({$Type}).");
}
// Make sure that user is not trying to say thanks twice.
$Count = $ThanksLogModel->GetCount(array($Field => $ObjectID, 'InsertUserID' => $Session->User->UserID));
if ($Count < 1) {
$ThanksLogModel->PutThank($Type, $ObjectID, $UserID);
}
if ($Sender->DeliveryType() == DELIVERY_TYPE_ALL) {
$Target = GetIncomingValue('Target', 'discussions');
Redirect($Target);
}
$ThankfulPeopleDataSet = $ThanksLogModel->GetThankfulPeople($Type, $ObjectID);
$Sender->SetData('NewThankedByBox', self::ThankedByBox($ThankfulPeopleDataSet->Result(), False));
$Sender->Render();
}
示例8: SettingsController_ToggleVoting_Create
public function SettingsController_ToggleVoting_Create($Sender) {
$Sender->Permission('Garden.Settings.Manage');
if (Gdn::Session()->ValidateTransientKey(GetValue(0, $Sender->RequestArgs)))
SaveToConfig('Plugins.Voting.Enabled', C('Plugins.Voting.Enabled') ? FALSE : TRUE);
Redirect('settings/voting');
}
示例9: delete
public function delete($id = null)
{
$slideshow = self::load_slideshow($id);
$slideshow->destroy();
Site::flash("notice", "The slide has been deleted");
Redirect("admin/slideshow");
}
示例10: contact
public function contact()
{
$content = Content::find_by_permalink("contact");
$this->assign("content", $content);
$contact = new Contact();
if ($this->post) {
$contact->name = $_POST['name'];
$contact->emailaddress = $_POST['emailaddress'];
$contact->subject = $_POST['subject'];
$contact->message = $_POST['message'];
$contact->ip = Site::RemoteIP();
if ($this->csrf) {
$sent = $contact->send();
if ($sent) {
Site::flash("notice", "The email has been sent");
Redirect("contact");
}
} else {
global $site;
$site['flash']['error'] = "Invalid form submission";
}
}
$this->assign("contact", $contact);
$this->title = "Contact Us";
$this->render("contact/contact.tpl");
}
示例11: init
public function init($formID)
{
switch ($formID) {
case 'vote':
$key = key($_POST[$formID]);
$id = $_POST[$formID][$key];
if (check_in_ses('vote_set', $id)) {
}
Redirect($base . '#review-' . $id);
exit;
break;
case 'review':
$validation = crud_validation($reviews->form_map(), 'review');
$data = $reviews->post = $validation['post'];
if ($validation['error']) {
foreach ($validation['error'] as $e => $v) {
$reviews->map[$e]['error'] = $v;
}
} else {
$crud->insert(REVIEWS_TABLE, $data);
$rating = $reviews->get_rating($data['productID']);
$customers_rating = round($rating['avg'] * 2) / 2;
$crud->update(PRODUCTS_TABLE, array('customers_rating' => number_format($customers_rating, 2, '.', ''), 'customer_votes' => (int) $rating['amt']), 'productID=' . $productID);
}
Redirect($base . '#review-' . $id);
exit;
break;
}
}
示例12: delete
public function delete(Request $request, $id)
{
$b = Usersgroup::find($id);
$b->name = $request->input('name');
$b->delete();
return Redirect('usersgroup');
}
示例13: delete
public function delete($permalink = null)
{
$news = self::load_news($permalink, false);
$news->destroy();
Site::flash("notice", "The news has been deleted");
Redirect("admin/news");
}
示例14: Index
public function Index()
{
$mute = $this->input->get('mute');
if ($this->input->get('mute') == 1) {
$mute_time = time() + 600;
setcookie('mute', $mute_time, $mute_time, '/');
Redirect();
}
if ($this->input->get('mute') == -1) {
setcookie('mute', 0, time() - 1, '/');
Redirect();
}
$data['muted'] = $this->input->cookie('mute');
$data['filter'] = '';
if (isset($_GET['filter'])) {
$data['filter'] = $_GET['filter'];
}
$this->load->helper('date');
$servers = $this->config->item('supervisor_servers');
if (empty($servers)) {
$data['list'] = array();
} else {
foreach ($servers as $name => $config) {
$data['list'][$name] = array('server' => $config, 'processes' => $this->_request($name, 'getAllProcessInfo'));
}
}
$data['cfg'] = $servers;
$this->load->view('welcome', $data);
}
示例15: HandleThumbShoePostRename
function HandleThumbShoePostRename($pagename, $auth = 'edit')
{
global $WikiLibDirs;
global $ThumbShoePageSep;
global $HandleAuth, $UploadFileFmt, $LastModFile, $TimeFmt;
$newname = $_REQUEST['newname'];
if ($newname == '') {
Abort("?no new image name");
}
$newname = str_replace('.', '_', $newname);
$newpage = $_REQUEST['newpage'];
if ($newpage == '') {
Abort("?no new image page");
}
$newimgpage = $newpage . $ThumbShoePageSep . $newname;
$tsdir = '';
foreach ((array) $WikiLibDirs as $dir) {
if ($dir->exists($pagename) and $dir->iswrite) {
$tsdir = $dir;
break;
}
}
if (!$tsdir) {
Abort("Cannot rename {$pagename} to {$newimgpage}; cannot find page");
return;
}
## check authorization
if (!RetrieveAuthPage($newimgpage, $auth, TRUE, READPAGE_CURRENT)) {
Abort("?cannot rename image page from {$pagename} to {$newimgpage}");
}
$newnewpage = @$tsdir->rename($pagename, $newimgpage);
if ($newnewpage) {
Redirect($newnewpage);
}
}