Jump to content

Using a get value from another page and using it in session redirect


idea96
 Share

Recommended Posts

Hello everyone...

I am trying to get a variable (path of the page) sent to a login form, which will use the get value received for session redirect...

$_GET["pageroute"]; $setpath=htmlentities($_GET["pageroute"]);

if($session->login($input->post->user, $input->post->pass)) {
 
$session->redirect('$setpath');
 
any suggestion please...
 
Tj
Link to comment
Share on other sites

Not sure I completely follow, but it might be better to just send the page ID to the login form:

?pageid={$page->id}

It is cleaner and easier to send a number in a "get". Then you can do: 

$pageid = (int) $input->get->pageid;

to make sure it is only an integer that was sent to the form.

Then on the page that displays the form you can get the path of the page if you need it using:

$page_path = $pages->get($pageid)->path;

But depending on your actual code structure and needs, there might even be a cleaner way. You could potential use a session variable - lots of options. If this idea doesn't seem a good fit, let us know and we'll help you get it better optimized.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...