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

Reply
 
Thread Tools Display Modes
  #1  
Old 04-30-2008, 03:16 PM
muan muan is offline
 
Join Date: Feb 2006
Posts: 24
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default Log out from non VB page

Sure I read how to achieve this a while ago but can't find the thread anywhere !

I use a HTML based navigation bar to navigate the forum and want to add a 'Log Out' button to it. Can anyone give me the script or explain how to achieve it ?

TIA.
Reply With Quote
  #2  
Old 04-30-2008, 04:10 PM
Medina Medina is offline
 
Join Date: Oct 2006
Location: the Netherlands
Posts: 181
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Here it is.

PHP Code:
<?php
// Version 1.10
// Released April 24th, 2007
// Edit the line below to show path to your forums
$forumpath "http://www.yoursite.com/forums/";

// You dont have to edit anything underneath here,
// but you can if you wish to style the login box
// to match the style of your site.
// ---------------
// COPYRIGHT STUFF
// ---------------
// You are free to use and modify this script in anyway you like.
// However,
// - Do not remove copyright notice
// - Dont pass it off as your own work.
// 
// This script is provided free of charges, however If you use this on a commercial
// venture a small paypal donation to cwp@cwp.id.au would be apprecieated.

// We check if user is logged in
if ($vbulletin->userinfo['userid']!=0) {
// If Logged in display welcome back message
echo "Welcome Back, <b>";
echo 
$vbulletin->userinfo['username'];
echo 
" !</b><br />";
// If logged in display logout link
echo "<a href=\"".$forumpath."login.php?$session[sessionurl]do=logout&amp;logouthash=$logouthash";
echo 
$vbulletin->userinfo['logouthash'];
echo 
"\">";
echo 
"<font size=\"1\" face=\"verdana\">Log Out</font></a>
"
;
} else { 
// If user is not logged in, we do this stuff
// Display text and link to register.
echo "
 You have to <a href=\""
.$forumpath."register.php?s=$session[sessionhash]\"
 target=\"_parent\"><b>register</b></a>  before you can post on our forums or use our advanced features.
 "
;
// Display login boxes + button
// You can style this with html or CSS as normal if desired.
echo"
 <form action=\""
.$forumpath."login.php\" method=post onsubmit=md5hash(vb_login_password,vb_login_md5password,vb_login_md5password_utf)>
 <script type=text/javascript src=\""
.$forumpath."clientscript/vbulletin_md5.js\"></script>
 User Name:<br />
 <input name=vb_login_username type=text id=navbar_username onfocus=\"if (this.value == '
$vbphrase[username]') this.value = '';\" size=10 />
   
 <br />Password:<br />
 <input name=vb_login_password type=password size=10 />
 </br>
  
 <label for=cb_cookieuser_navbar><input name=cookieuser type=checkbox id=cb_cookieuser_navbar value=1 checked=checked />
 Remember Me?<br /></label>
 
  
 <input type=submit title=
$vbphrase[enter_username_to_login_or_register] value=\"Log In\" />
  
 <input type=hidden name=s value=
$session[sessionhash] />
 <input type=hidden name=do value=login />  
 <input type=hidden name=vb_login_md5password />
 <input type=hidden name=vb_login_md5password_utf />
 </form>
"
;
}
?>
Reply With Quote
  #3  
Old 05-01-2008, 10:46 PM
muan muan is offline
 
Join Date: Feb 2006
Posts: 24
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Thanks for that mate, but is there an easier way to do via a simple 'Log Out' text link. I don't want the complete sign in/register/log out box.

I was thinking there may be something simpler along the lines of

"forums/login.php?do=logout"

or similar .....................
Reply With Quote
  #4  
Old 05-01-2008, 10:52 PM
MoT3rror MoT3rror is offline
 
Join Date: Mar 2007
Posts: 423
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Just send them to login.php?do=logout&logouthash=$vbulletin->userinfo['logouthash'] or you can destory the cookies that vbulletin uses.
Reply With Quote
  #5  
Old 05-02-2008, 11:09 AM
Medina Medina is offline
 
Join Date: Oct 2006
Location: the Netherlands
Posts: 181
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

PHP Code:
// If logged in display logout link
echo "<a href=\"".$forumpath."login.php?$session[sessionurl]do=logout&amp;logouthash=$logouthash";
echo 
$vbulletin->userinfo['logouthash'];
echo 
"\">";
echo 
"<font size=\"1\" face=\"verdana\">Log Out</font></a>
"
;
} else { 
// If user is not logged in, we do this stuff
// Display text and link to register.
echo "
 You have to <a href=\""
.$forumpath."register.php?s=$session[sessionhash]\"
 target=\"_parent\"><b>register</b></a>  before you can post on our forums or use our advanced features.
 "

</SPAN>




Then you wil need this!
Reply With Quote
  #6  
Old 05-09-2008, 07:41 AM
muan muan is offline
 
Join Date: Feb 2006
Posts: 24
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Sorry folks, been distracted for a few days ! Thanks for the replies
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 04:08 AM.


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.03624 seconds
  • Memory Usage 2,224KB
  • 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
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)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_postinfo_query
  • fetch_postinfo
  • 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