Help With Redirection

Discussion forum for MOD Writers regarding MOD Development.
Locked
gamercross
Registered User
Posts: 9
Joined: Fri Oct 26, 2007 9:03 am

Help With Redirection

Post by gamercross »

Hello, i have a login intergration script, so when i log onto my site, it logs onto the forum. However, once i log in it goes to the forum and stays there. Is it possible to add a redirection say to the successful login page, which will take me back to the page which i logged in from or a page i specify?

You can see it on the site in question and heres a test login and pass:

Website: http://www.gamercross.co.uk
Username: test
Password: testgx2007

Thanks,

Gamercross
gamercross@msn.com :D
User avatar
bum63
Registered User
Posts: 262
Joined: Tue Oct 10, 2006 8:36 pm

Re: Help With Redirection

Post by bum63 »

I use simple redirect in .tpl file like this:

<input tabindex="3" type="submit" class="mainoption" name="login" value="{L_LOGIN}">
<input type="hidden" name="redirect" value="forum.php">

you can put in any page you want,
<input type="hidden" name="redirect" value="index.php">
or whatever
<input type="hidden" name="redirect" value="welcome.html">
works for me just fine
User avatar
Lumpy Burgertushie
Registered User
Posts: 68316
Joined: Mon May 02, 2005 3:11 am
Contact:

Re: Help With Redirection

Post by Lumpy Burgertushie »

;you already have the redirect in your html for the login form, but you do not have a value for it.

robert
I'm baaaaaccckkkk. still doing work on donation basis. PM your needs.

Premium phpBB 3.3 Styles by PlanetStyles.net

If nobody is in the forest, does a tree really fall?
gamercross
Registered User
Posts: 9
Joined: Fri Oct 26, 2007 9:03 am

Re: Help With Redirection

Post by gamercross »

Belows that script, thanks for your replies, i really need to get this right. Could you put your redirection script into my script below to allow it to redirect. Here is the redirect information.

Login from page: http://www.gamercross.co.uk (website homepage)
It then goes to my forum homepage which is: http://www.gamercross.co.uk/forum

BUT . . . i need it to bounce back to the page it logged in from or the website homepage (http://www.gamercross.co.uk)

Thanks - btw, my login form is currently in times new roman font, im having some problems with getting the font to verdana, could you also change the script to do that aswell.

Thankyou, your help would be greatly appreciated. :D


<?php
// By Arslan Hassan
// Date Created Tuesday, 14 Aug 2007
// Free to use easy to implement
// FORUM DIRECTORY IS SET TO /forums


//Please Set Your Cookie Name First
if($_COOKIE['phpbb3_5k61p_u'] == "1" || $_COOKIE['phpbb3_5k61p_u'] == ""){
?>
<form name="form1" method="post" action="forum/ucp.php?mode=login">
Username:
<input type="text" class="post" name="username" size="20" maxlength="40" value="" />
<br />

<span class="Bold_Title">Password:</span>

<input type="password" class="post" name="password" size="20" maxlength="32" />


<br />
Remember Me </span>

<input type="checkbox" name="autologin" />
</span>
<input type="hidden" name="redirect" value="" />
<br />
<input type="submit" name="login" value="Log In" class="form_button"/>
<span class="gensmall"><a href="forum/ucp.php?mode=sendpassword" class="Heading_2"><br />
I Forgot My Password </a></span>
</form>
<?php
}else{
$sid = $_COOKIE['phpbb3_5k61p_sid'];
$userid = $_COOKIE['phpbb3_5k61p_u'];

$host = 'localhost' ;
$db = 'lymqlsa_forum';
$pass = '***********';
$username = 'lymqlsa_forum';
mysql_connect($host,$username,$pass);
if (!mysql_select_db($db)) die(mysql_error());
$query = mysql_query("SELECT * FROM phpbb_users WHERE user_id = ".$userid);
$data = mysql_fetch_array($query);
?>
Welcome <?php echo $data['username'] ?> | <a href="forum/ucp.php?mode=logout&sid=<?php echo $sid ?>">Logout</a><br />
<a href="forum/"></a><a href="forum/" class="Bold_Title">Forum Home<br />
</a><span class="Bold_Title"><?php echo $data['user_new_privmsg'] ?><a href="forum/ucp.php?i=pm&folder=inbox"> New Messages<br />
</a></span><a href="forum/ucp.php" title="User Control Panel" accesskey="u">User Control Panel<br />
</a><a href="forum/search.php?search_id=egosearch">View Your Posts</a>
<?php
}
?>
Last edited by gamercross on Tue Nov 13, 2007 4:31 pm, edited 1 time in total.
User avatar
dellsystem
Former Team Member
Posts: 3879
Joined: Sat Apr 09, 2005 8:54 pm
Location: Montreal
Name: Wendy
Contact:

Re: Help With Redirection

Post by dellsystem »

Looks like you're using 3.0 and not 2.0, so I've moved it to the correct forum :)

Is font-family defined for body in your style sheet? Maybe you just need to define "Bold_Title" with the verdana font.
Former moderator and website team member | My MODs, and more (GitHub)
gamercross
Registered User
Posts: 9
Joined: Fri Oct 26, 2007 9:03 am

Re: Help With Redirection

Post by gamercross »

Can anyone please help me with this?

Thankyou,
Gamercross
User avatar
Spivester
Registered User
Posts: 18
Joined: Mon Jan 17, 2005 4:27 pm
Location: Canada
Contact:

Re: Help With Redirection

Post by Spivester »

Change your code to this...

Code: Select all

<input type="hidden" name="redirect" value="../index.php" />
Change the index.php to index.html or whatever your index page is on your front page. That should work.. remember than the redirect value is relative to your forum directory.
Locked

Return to “[3.0.x] MOD Writers Discussion”