Redirecting Users Post-Login |
Description: Want to send your users to a page other than phpBB's index.php? |
Author: VxJasonxV |
Date: Fri Jun 18, 2004 1:48 am |
Type: HowTo |
Keywords: referer, redirect, forward, refer, login |
Category: MODifications |
|
It's quite simple.
Say for instance you're letting users login at the first page on your site.
Your site consists of:
Code: | + yoursite.com/
+-- main.php
+--+ phpBB2/
+--+ login.php
+--+ index.php
+--+--+ includes/ |
Now, yoursite.com/main.php has a form with a username and password field, a submit button, and a checkbox asking the user if they want to automatically login on each visit to the site.
main.php is supposed to update with new information whenever a user is logged in and visit's the page. Although there's a problem, whenever someone logs in from main.php, they are taken to yoursite.com/phpBB2/index.php
There's a way around this, yes there is.
In main.php, you're likely to have something along the lines of:
Code: | <form action="phpBB2/login.php" method="post">
~insert your form code here~
</form> |
So how do we get users to come BACK to main.php instead of phpBB2/index.php?
Simple.
Add in a 'hidden' input field.
Code: | <form action="phpBB2/login.php" method="post">
<input type="hidden" name="redirect" value="../main.php">
~the original form code here~
</form> |
That's all!
Things to know:
The Value of the redirect is RELATIVE to phpBB root. So if you want to redirect to a journal folder from your site, then the value will be something to the effect of:
Code: | value="../journal/index.php |
Start from where login.php resides, and traverse directories from there.
A very simple tweak, but oh-so powerful.
Enjoy! |
|
|