punterzone |
08-19-2011 04:56 PM |
External Page Login and Variables
Hey,
I'm looking to make a login form whereby I can login using a page on the root (as opposed to the forums which are located at /forum).
I've managed to make a login form that logs the user in, and redirects them back to the root, and they are logged in. What I can't get to work though, is getting access to the vB variables (to show username, avatar etc).
If I include global.php then the login form doesn't work. I've been at this for ages and just can't seem to get it to work. Was wondering if anyone has got this to work?
Just to clarity, I have other pages outside the forum which I would like people to be able to navigate around whilst logged in, and be shown as logged in, and have access to their user variables.
Here's the code I have:
PHP Code:
<form action="forum/login.php?do=login" method="post" onsubmit="md5hash(vb_login_password, vb_login_md5password, vb_login_md5password_utf, 0)">
<script type="text/javascript" src="forum/clientscript/vbulletin_md5.js?v=367"></script>
<table cellpadding="0" cellspacing="0" border="1">
<tr>
<td>User Name</td>
<td><input type="text" name="vb_login_username" id="navbar_username" /></td>
<td colspan="2"><input type="checkbox" name="cookieuser" value="1" id="cb_cookieuser_navbar" />Remember Me?</td>
</tr>
<tr>
<td>Password</td>
<td><input type="password" name="vb_login_password" id="navbar_password" /></td>
<td><input type="submit" value="Log in" /></td>
</tr>
</table>
<input type="hidden" name="s" value="" />
<input type="hidden" name="do" value="login" />
<input type="hidden" name="vb_login_md5password" />
<input type="hidden" name="vb_login_md5password_utf" />
</form>
That works fine to login, and redirects back to my test.php file. BUT if I add the following to the file it fails:
PHP Code:
chdir('/home/pzone/public_html/forum/');
require_once('/home/pzone/public_html/forum/global.php');
Thanks
|