Version: , by (Guest)
Developer Last Online: Jan 1970
Version: Unknown
Rating:
Released: 06-21-2000
Last Update: Never
Installs: 0
No support by the author.
For those of you wondering how to make restricted pages so that only members of your vB can view them, here is a quick code example to do so. Just require this file as the very first line of whatever file that you want to require a user to have logged into the vB in order to view. Copy this code into a file and save it into the forums directory (same directory as index.php, members.php, etc.) and name it whatever you want.
Its a REALLY simple script that just checks to see if the vB cookie exist. Nothing special at all, but for those of you with no programming experience it's something to work with.
Code:
<?php
/* Here we check to see if the vBulletin cookie exist.
If it doesn't, we prompt the user to either log in or
sign up*/
if (!$HTTP_COOKIE_VARS["bbuserid"]) {
?>
<table border="0" width="600" cellspacing="0" cellpadding="2" align="center">
<tr>
<td valign="top">
<center><h2>Unathorized Access</h2></center>
If the users cookie isn't set, here is where your error message, or whatever message, will be.
</td>
<td valign="top" bgcolor="#D2D2D2">
<form action="index.php" method="post">
<table border="0" width="100%" cellpadding="2">
<tr>
<td width="50%" valign="top"><b>username</b></td>
<td width="50%" valign="top"><input maxLength="25" name="username" size="10"></td>
</tr>
<tr>
<td width="50%" valign="top"><b>password</b></td>
<td width="50%" valign="top"><input maxLength="13" name="password" size="10" type="password" value></td>
</tr>
<tr>
<td width="100%" valign="top" colspan="2">
<p align="center"><input type="submit" value="Login!"></td>
</tr>
</table>
</form>
</td>
</tr>
</table>
<?php
exit;
}
?>
[Edited by Krucifyx on 06-22-2000 at 07:02 AM]
Show Your Support
This modification may not be copied, reproduced or published elsewhere without author's permission.
When I use the code in the top example I get the login box on the screen, but I also see this error just above it.
Warning: Undefined index: bbuserid in c:\inetpub\wwwroot\dealerforge\vbulletin\homelogin .php on line 7
When I am logged into the forums, I go straight to the page, when I am not logged in I am presented with a login box with the error above, however when I try to login on that page I get this:
CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:
and the error ends there.
Any help would be appreciated in fixing this, but otherwise it is exactly what I am looking for, thank you!
mashby, all you need to do is put in the path that the global.php is stored in, and check that it is ch-mod'd correctly, it shouldnt give you any problems, you just need to make sure all the paths correspond.