PDA

View Full Version : Forum Login


Lotus Ims
13 Dec 2001, 19:01
I need help with a PHP script. I would like users to be able to login to the forums from a non-vB page. If someone could make a script for me or show me how to do this, it would be much appreciated. I know HTML, so i can do the layout myself. I have tried one of the hacks posted here, but it didn't work. I have include what I would like it to look like below.

If user is not logged in:

------------------------------------------------------------------------------

Welcome Guest! Click Here (http:///) to register or login below.

Username: |--------|
Password: |--------|

------------------------------------------------------------------------------

And if a user is logged in:

------------------------------------------------------------------------------

Wecome back Username. Click here (http:///) to go to the forums or click here (http:///) to logout.

You have # of Private Messages new messages. Click here (http:///) to read them!

-----------------------------------------------------------------------------

Thanks

amykhar
13 Dec 2001, 19:04
Check the released hacks forum. Search for login. It's there already.

Amy

Lotus Ims
13 Dec 2001, 19:05
I already tried that, and it didn't work.

amykhar
13 Dec 2001, 19:07
What didn't work? The script or the search?

Amy

Lotus Ims
13 Dec 2001, 23:05
the script

Goldfinger
15 Dec 2001, 02:45
url to hack please.. i tried searching for it but couldnt find it =\

Hiroshimator
16 Dec 2001, 09:43
<?PHP
chdir("/path/to/board");
require("./global.php");
?>
<html>
<head>
<title>My homepage :D</title>
</head>
<body><table width=100%">
<tr>
<td><img src="board/images/vBulletin_logo.gif"></td>
<td valign=bottom align=right>

<?PHP
if ($bbuserinfo['userid']!=0) {
$username=$bbuserinfo['username'];

print("Welcome back, <b>$username!</b>");
}
else {
?>

you're not logged in
<p>
<form action="http://path/to/board/member.php" method="post" />
<input type="hidden" name="s" value="<?PHP print("$session[sessionhash]"); ?>" />
<input type="hidden" name="action" value="login" />
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td align="left"><font class="verdana, arial, helvetica" size="1"><b>Username:</b></font></td>
<td align="left"><input type="text" name="username" size="7" /></td>
</tr>
<tr>
<td align="left"><font class="verdana, arial, helvetica" size="1"><b>Password:</b></font></td>
<td align="left"><input type="password" name="password" size="7" /></td>
</tr>
<tr>
<td align="center" colspan="2"><input type="submit" value="Login!" /></td>
</tr>
</table>
</form>
</p>
<?PHP } ?>
</td></tr>
<tr><td colspan=2><?PHP print("<a href='./board/member.php?s=$session[sessionhash]&action=logout'>Log Out</a>"); ?></td></tr>
</table>
</body></html>



this should work, don't forget to fill in your own path to your board directory in the chdir() routine.

Lotus Ims
17 Dec 2001, 01:13
I tried the above script. HOwever, I want to use it with cookies, and on a non vB page. The login works fine, but when i got back to the page where I want the login, it doesn't have my username. It still acts like I am not logged in.

amykhar
17 Dec 2001, 01:15
Lotus Ims

If you have included the script with the url instead of the path to the file, that's probably why it doesn't work.

Amy

Hiroshimator
19 Dec 2001, 15:00
don't forget to set your cookie domain .mydomain.com (notice the first dot) in your board options

tomba
20 Dec 2001, 13:04
well hmmm

I was able to do this myself ! Surprised as I was !
though I cannot figure out how to give en error message back if password or username are not correct.
anyone can point this out please?

greets,
Tomba Sciatori