The Apache Haus Forum

Advanced search  

News:

Welcome to Apache Haus Distribution Forum

Pages: [1]   Go Down

Author Topic: PHP Get urls params for bookmarked pages  (Read 4654 times)

mario

  • Administrator
  • Member Elite
  • *****
  • Offline Offline
  • Posts: 579
PHP Get urls params for bookmarked pages
« on: March 31, 2009, 08:09:45 PM »

Often users make bookmarks on page with GET params which are only availibe when you are logged in. Senario: Call bookmark, but you are redirected to the login and than to the start page but not to the bookmark. So we take the url params and save them and after login go back to the requested page.

Code: [Select]
/**
* @return string $self Komplette URL mit allen Parametern
*/
function get_this_uri_and_params(){
$self = $_SERVER['PHP_SELF'];
$n = 0;
foreach($_GET as $name=>$val){
if(!$n){
$self .= "?";
}
else
{
$self .= "&";
//& ??
}
$self .= $name."=".$val;
$n++;
}
return $self;
}

$self = $this->get_this_uri_and_params();
echo <<<END
<form action="$self" method="post" name="login">
<table>
<tr><td>Loginname:</td><td><input type="text" name="suser" /></td></tr>
<tr><td>Passwort:</td><td><input type="password" name="spass" /></td></tr>
<tr><td>&nbsp;</td><td>&nbsp;</td></tr>
<tr><td><input type="submit" value="Login" /></td><td>&nbsp;</td></tr>
</table>
</form>
END;

Hope this short snippet helps someone
Logged
Pages: [1]   Go Up
 

Sitemap 1 2 3 4 5 6 7 8 9 10 11 12 13