Hi everyone, i am trying to create a login box on my home page which will enable users to log in/out on the home page to my vbulletin forums. I have successfully managed to create a log in box - it works! BUT once logged in it remains the same. I would love to know how to make it changed once logged in to display your username and a log out button.
Here is the code i am currently using:

<!--Login Form-->
			
			<form action="http://www.wdw4brits.com/forums/login.php" method="post" onsubmit="md5hash(vb_login_password, vb_login_md5password, vb_login_md5password_utf, 0)">
			<input type="hidden" name="redirect" value="http://www.wdw4brits.com" />
<script type="text/javascript" src="http://www.wdw4brits.com/forums/clientscript/vbulletin_md5.js"></script>
<table border="0" cellpadding="0" cellspacing="3">

<tbody align="left"><tr>
<td ><label for="navbar_username">User Name</label></td>
<td><input class="bginput" style="font-size: 11px;" name="vb_login_username" size="10" accesskey="u" tabindex="101" value="User Name" onfocus="if (this.value == 'User Name') this.value = '';" type="text"></td>
</tr>
<tr>
<td ><label for="navbar_password">Password</label></td>

<td><input style="font-size: 11px;" name="vb_login_password" size="10" accesskey="p" tabindex="102" type="password"></td>
</tr><tr>
<td><input value="Log in" tabindex="104" title="Enter your username and password in the boxes provided to login, or click the 'register' button to create a profile for yourself." accesskey="s" type="submit"></td>
<td colspan="2" nowrap="nowrap"><label for="cb_cookieuser_navbar"><input name="cookieuser" value="1" tabindex="103" id="cb_cookieuser_navbar" accesskey="c" type="checkbox">Remember Me?</label></td>
</tr>
<tr>
  <td colspan="2">
<a href="http://www.wdw4brits.com/forums/login.php?do=lostpw">Forgot Password?</a><p></td>
</tr>
<tr><td colspan="2">
<a href="http://www.wdw4brits.com/forums/register.php">Register</a></td></tr>
</tbody></table>
<input name="s" value="" type="hidden">
<input name="do" value="login" type="hidden"> 
<input name="vb_login_md5password" type="hidden">
<input name="vb_login_md5password_utf" type="hidden">
		</form>
			
			<!--/Login Form-->

Every bit of help would be much appreciated.
Many Thanks.

why not you create session for this...
then you can check whether session is there or not...if ,you can print username and logout ..if session is not there the display normal login box...
if your requirement is something else than my post,,let me know...

I understand where you are coming from - that is what i wanted to do. But i am a noobie! to this programming so do you know the code that i would use?
Many Thanks

My problem is that vbulletin is different to normal log in. I have got the log in bit right but wanted to know how to change to log out once logged in. Do you use the if...else... - if so, how would you do it is it "if [member].."??
Many Thanks

I have tried creating some code but it is not working here is the code:

<?php 
		if($member){

// output some text
echo 'Username:
'.$info["username"].'
Registered on:
'.$info["regdate"];

// if the user ISN'T logged in
}else{

// output an error
echo 'Please Log in';}
?>

I am not sure what you have to type in for it to work with vbulletin. I am completely stuck!! Really need help!
Thanks to everyone who helps

I have made some progress, i have used the php "if & "else" to display login or logout. However when logged in all is fine - it displays "welcome... & logout" BUT when you are not logged in and i want the login box to appear this message appears: "Unable to add cookies, header already sent.
File: /customers/wdw4brits.com/wdw4brits.com/httpd.www/latest/index.php
Line: 8"

Code is below - CAN SOMEONE HELP PLEASE!
Many thanks

<?
require("global.php"); 

if ($bbuserinfo['userid']!=1) { 
$username=$bbuserinfo['username']; 
   
echo "<font face=\"verdana\" size=\"2\">&nbsp;<b>Welcome back, <font color=\"#FF3300\">$username</font>&nbsp;!</b>&nbsp;[<a href=\"http://www.wdw4brits.com/forums/member.php?s=&action=logout\">Logout</a>]</font>"; 

} else {
?>
			<form action="http://www.wdw4brits.com/forums/login.php" method="post" onsubmit="md5hash(vb_login_password, vb_login_md5password, vb_login_md5password_utf, 0)">
			<input type="hidden" name="redirect" value="http://www.wdw4brits.com" />
<script type="text/javascript" src="http://www.wdw4brits.com/forums/clientscript/vbulletin_md5.js"></script>
<table border="0" cellpadding="0" cellspacing="3">

<tbody align="left"><tr>
<td ><label for="navbar_username">User Name</label></td>
<td><input class="bginput" style="font-size: 11px;" name="vb_login_username" size="10" accesskey="u" tabindex="101" value="User Name" onfocus="if (this.value == 'User Name') this.value = '';" type="text"></td>
</tr>
<tr>
<td ><label for="navbar_password">Password</label></td>

<td><input style="font-size: 11px;" name="vb_login_password" size="10" accesskey="p" tabindex="102" type="password"></td>
</tr><tr>
<td><input value="Log in" tabindex="104" title="Enter your username and password in the boxes provided to login, or click the 'register' button to create a profile for yourself." accesskey="s" type="submit"></td>
<td colspan="2" nowrap="nowrap"><label for="cb_cookieuser_navbar"><input name="cookieuser" value="1" tabindex="103" id="cb_cookieuser_navbar" accesskey="c" type="checkbox">Remember Me?</label></td>
</tr>
<tr>
  <td colspan="2">
<a href="http://www.wdw4brits.com/forums/login.php?do=lostpw">Forgot Password?</a><p></td>
</tr>
<tr><td colspan="2">
<a href="http://www.wdw4brits.com/forums/register.php">Register</a></td></tr>
<tr><td>

</td></tr>
</tbody></table>
<input name="s" value="" type="hidden">
<input name="do" value="login" type="hidden"> 
<input name="vb_login_md5password" type="hidden">
<input name="vb_login_md5password_utf" type="hidden">
		</form>
<?
}
?>
This article has been dead for over six months. Start a new discussion instead.