Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 04-14-2004, 01:34 AM
royli57 royli57 is offline
 
Join Date: Mar 2004
Posts: 16
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default How do I redirect non-logged in users to login page?

Hi

I am using a cookie check to see if the user is logged in.

If the user is not logged in, I want to redirect the user to the forum login page, and then have the user be returned to the original page after login.

Any ideas how I can do this? I could not find a page that was only login that I could redirect to.

Thanks,

Roy :bandit:
Reply With Quote
  #2  
Old 04-14-2004, 02:32 PM
Scrub's Avatar
Scrub Scrub is offline
 
Join Date: Oct 2001
Posts: 188
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Are you wanting this to happen when they try to view the index or threads? I belive you could edit the usergroup options for Unregistered/Logged Out users in your admincp to make it so they have to log in before viewing anything.
Reply With Quote
  #3  
Old 08-21-2004, 12:32 AM
sydude's Avatar
sydude sydude is offline
 
Join Date: Aug 2004
Location: New York
Posts: 41
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Royli57,

Can you please post or email the code for what you have? What you already had was good enough for me. I just want some of my non-VB pages to check to see if there's a bbuserid cookie present before allowing access. I can't figure out how to do it - of course, I have no clue what I'm doing, so maybe that's why...

Thanks

Sy
Reply With Quote
  #4  
Old 08-21-2004, 01:05 PM
deathemperor's Avatar
deathemperor deathemperor is offline
 
Join Date: Jul 2003
Location: HOL
Posts: 1,270
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

this could be easily done by using an if condition:
PHP Code:
if ($bbuserinfo['userid'] == 0)
{
        
print_no_permission();

this checks wether one is a user of your board and if he is not it will open the login page, if he is of course he can view that page.
I think we can change $bbuserinfo['userid'] == 0 to something like $bbuserinfo['usergroupid'] == 2 ( which is a usergroup of guests)
Reply With Quote
  #5  
Old 08-21-2004, 01:29 PM
sydude's Avatar
sydude sydude is offline
 
Join Date: Aug 2004
Location: New York
Posts: 41
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

deathemperor, thank you for the response. I'm pretty uneducated with all of this stuff, so I'm not sure exactly what to do with it. I've taken just the snippet of code you provided and placed it within <?php and ?> tags at the head of my html file, and renamed my file to end in .php.

But that doesn't seem to work. All I get is a white screen. Do I need to use any other code? BTW, when I check to see what the cookie names are for my vbulletin site, the userid cookie comes back as 'bbuserid'.

It would be really appreciated if you could help me with this.

Thanks

Sy
Reply With Quote
  #6  
Old 08-22-2004, 10:25 AM
deathemperor's Avatar
deathemperor deathemperor is offline
 
Join Date: Jul 2003
Location: HOL
Posts: 1,270
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

it's not simple by placing that code in a php file and hope it work for you. you must include the global.php to that file, and that code does something like:
PHP Code:
if ($bbuserinfo['userid'] == 0

        
print_no_permission(); 

else
{
        echo 
"you can access this page";

you don't have to check for any cookies.
depending on what your purpose is use it properly
Reply With Quote
  #7  
Old 08-24-2004, 04:54 PM
sydude's Avatar
sydude sydude is offline
 
Join Date: Aug 2004
Location: New York
Posts: 41
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thank you, Deathemperor. I really appreciate the help, but this is still too complicated for me. I have no idea how include a global.php in the file, etc. I don't really know anything about php, I only know html.

What I really need is a complete block of code to just insert into my html files that will redirect a user to the vbulletin login page if they aren't already logged in. Again, I really appreciate your help on this.

Thanks

Sy
Reply With Quote
  #8  
Old 08-25-2004, 04:35 AM
deathemperor's Avatar
deathemperor deathemperor is offline
 
Join Date: Jul 2003
Location: HOL
Posts: 1,270
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

then you would need these:
https://vborg.vbsupport.ru/showthread.php?t=62164
and
php.net

for how to include a page in a page
and it's must be an php file, no way it can be html file
I actually don't understand what you need for that file
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:00 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03816 seconds
  • Memory Usage 2,228KB
  • Queries Executed 13 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (2)bbcode_php
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (8)post_thanks_box
  • (8)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (8)post_thanks_postbit_info
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete