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


PHP Redirect函数代码示例

本文整理汇总了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");
 }
开发者ID:ItsHaden,项目名称:epicLanBootstrap,代码行数:7,代码来源:twitter_account.controller.php

示例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();
     }
 }
开发者ID:nbudin,项目名称:Garden,代码行数:26,代码来源:activity.php

示例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();
 }
开发者ID:nerdgirl,项目名称:Forums-ILoveBadTV,代码行数:39,代码来源:class.utilitycontroller.php

示例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}");
 }
开发者ID:stwns,项目名称:Studport,代码行数:12,代码来源:SoalController.php

示例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');
 }
开发者ID:laiello,项目名称:lussumo-vanilla,代码行数:34,代码来源:Vanilla.Control.AccountRoleForm.php

示例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');
 }
开发者ID:ndcunningham,项目名称:Soci-Connect,代码行数:7,代码来源:UserController.php

示例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();
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:34,代码来源:class.thankfulpeople.plugin.php

示例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');
 }
开发者ID:nerdgirl,项目名称:Forums-ILoveBadTV,代码行数:7,代码来源:class.voting.plugin.php

示例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");
 }
开发者ID:ItsHaden,项目名称:epicLanBootstrap,代码行数:7,代码来源:slideshow.controller.php

示例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");
 }
开发者ID:ItsHaden,项目名称:epicLanBootstrap,代码行数:26,代码来源:contact.controller.php

示例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;
     }
 }
开发者ID:gblok,项目名称:rsc,代码行数:29,代码来源:class.forms.php

示例12: delete

 public function delete(Request $request, $id)
 {
     $b = Usersgroup::find($id);
     $b->name = $request->input('name');
     $b->delete();
     return Redirect('usersgroup');
 }
开发者ID:richardkeep,项目名称:prct,代码行数:7,代码来源:UsersgroupController.php

示例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");
 }
开发者ID:ItsHaden,项目名称:epicLanBootstrap,代码行数:7,代码来源:news.controller.php

示例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);
 }
开发者ID:barqshasbite,项目名称:supervisord-monitor,代码行数:29,代码来源:welcome.php

示例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);
    }
}
开发者ID:rubykat,项目名称:pmwiki-thumbshoe,代码行数:35,代码来源:rename.php


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