vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Log out from non VB page (https://vborg.vbsupport.ru/showthread.php?t=177620)

muan 04-30-2008 03:16 PM

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.

Medina 04-30-2008 04:10 PM

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>
"
;
}
?>


muan 05-01-2008 10:46 PM

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 .....................

MoT3rror 05-01-2008 10:52 PM

Just send them to login.php?do=logout&logouthash=$vbulletin->userinfo['logouthash'] or you can destory the cookies that vbulletin uses.

Medina 05-02-2008 11:09 AM

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!

muan 05-09-2008 07:41 AM

Sorry folks, been distracted for a few days ! Thanks for the replies :)


All times are GMT. The time now is 03:33 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.01063 seconds
  • Memory Usage 1,740KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete