Redirects for Login page.

MODs, Hacks, Tips and Tricks for phpBB3 Session, LDAP, Login and Authentication System.
Also any bridges or integration with other software or systems.

Redirects for Login page.

Postby AJ Quick » 20 Jan 2007, 18:05

I don't know how safe this is.. but I wanted to be able to do redirects via URL when logging in. AKA: /forums/ucp.php?mode=login&redirect=(PAGE)

Here is the code:

Code: Select all
   case 'login':
      if ($user->data['is_registered'])
      {
         redirect(append_sid("{$phpbb_root_path}index.$phpEx"));
      }
      
      $redirect   = request_var('redirect', '');   
      
      if($redirect)
      {
         login_box($redirect);
      }else{
         login_box("index.$phpEx");
      }
   
   break;


Critiques? Feedback? etc.
http://www.AJQuick.com/ - The original phpBB v2 site integration tutorial.
http://www.GBFans.com/ - The Largest Ghostbusters website.
User avatar
AJ Quick    
Lt. Jr Grade
Lt. Jr Grade
 
Posts: 103
Joined: 10 Dec 2006, 12:20
Gender: Male




phpBB Academy at StarTrekGuide
Support STG
Using PayPal Donate

Re: Redirects for Login page.

Postby Handyman » 20 Jan 2007, 19:46

Here is the code you want to use
Note: you change the user->lang['LOGIN_EXPLAIN stuff to whatever you want it to say.
With that language, when you get transferred to the login page, it says: you must be logged in to view the memberlist.
Code: Select all
<?php
if ($user->data['user_id'] == ANONYMOUS)
{
    
login_box('', ((isset($user->lang['LOGIN_EXPLAIN_' . strtoupper($mode)])) ? $user->lang['LOGIN_EXPLAIN_' . strtoupper($mode)] : $user->lang['LOGIN_EXPLAIN_MEMBERLIST']));
}
Please contact me if you have any news to submit to SCOFF News.
SCOFFing at the candidates while you sleep.
My Mods || My Mod Queue
Image
User avatar
Handyman    
Rear Fleet Admiral
Rear Fleet Admiral
 
Posts: 7457
Joined: 08 May 2006, 04:45
Location: Where no man has gone before!
Favorite Team: Seattle Seahawks
Gender: Male

Re: Redirects for Login page.

Postby AJ Quick » 22 Jan 2007, 01:24

That code doesn't make sense for anything really important.. except for forcing a login box.

I use 'login_box' whenever I want to force someone to be logged in on any part of my site (even on non-forum pages). There are times when I will ask a user to login and want them to be able to return back to the same page.. but not force a login box. Thats what the code does.. it allows redirects through the URL.

It is possible to redirect to any page unfortunately.. so you could redirect to Google if wanted (so there would be security risks?) but its not like it transfers any data when doing that.
http://www.AJQuick.com/ - The original phpBB v2 site integration tutorial.
http://www.GBFans.com/ - The Largest Ghostbusters website.
User avatar
AJ Quick    
Lt. Jr Grade
Lt. Jr Grade
 
Posts: 103
Joined: 10 Dec 2006, 12:20
Gender: Male

Re: Redirects for Login page.

Postby Waleed » 22 Jan 2007, 01:39

AJ Quick wrote:It is possible to redirect to any page unfortunately.. so you could redirect to Google if wanted (so there would be security risks?) but its not like it transfers any data when doing that.


I don't think there would be any security risks with redirecting to any other page from the login box, as the loging box first logs you in, and then redirects you... Scratch
User avatar
Waleed
MOD Author
MOD Author
 
Posts: 672
Joined: 25 Jul 2006, 04:18
Location: Pakistan
Gender: Male
phpBB Knowledge: 6

Re: Redirects for Login page.

Postby tonydavis6 » 17 Mar 2007, 09:28

Where do you put this code?
tonydavis6
Crewman
Crewman
 
Posts: 4
Joined: 13 Mar 2007, 08:32
Gender: Male

Re: Redirects for Login page.

Postby Highway of Life » 17 Mar 2007, 10:07

Depends on where you want it. Wink

If you want to force the user to have to login when visiting your forum, but it just after the session is started on the index.php page.
Watch out! I might do a code wheelie!

User avatar
Highway of Life    
STG Jedi Master
STG Jedi Master
 
Posts: 10458
Joined: 08 May 2006, 05:23
Location: Beware of Programmers carrying screwdrivers
Gender: Male
phpBB Knowledge: 10

Re: Redirects for Login page.

Postby beaver86 » 06 Jun 2007, 06:17

:hello:

Could someone write a full code example for that login thing?!

P.S.:Suppose that i want it to be on my index.php page and the forum is located under the "forum" dir.

Thanks
User avatar
beaver86
Crewman
Crewman
 
Posts: 2
Joined: 01 May 2007, 18:33
Gender: Male

Re: Redirects for Login page.

Postby xceler8shun » 11 Jun 2008, 07:13

ive just had this approved over at phpbb.com

http://startrekguide.com/mods/index.php ... ail&id=144

may help you out.
xceler8shun    
Borg Drone
Borg Drone
 
Posts: 71
Joined: 28 Apr 2008, 16:58
Location: Australia
Gender: Male
phpBB Knowledge: 4


Return to Session, Login, Authentication System

Who is online

Users browsing this forum: No registered users and 1 guest