Log in

View Full Version : Going to write a hack...


Radgam
05-04-2003, 05:32 PM
Probably just for use at my own board but who knows, if it turns out good i may release here.

Basically, i'm looking to create a section of my site that only register members of certain user groups can access. It's not a forum, but actually website (of sorts) with files and other extras that members of the forum will be able to access (no one else).

Just wondered if anyone could help me get started and offer any tips. If someone tries to access the section of the site i'd like it to check if they are logged in, and then to decided what to do based on their user group. If they are not, it'll post the login code.

I'm guessing all i need to do is add this at the begining of my php file and it will check the rest?

require('./global.php');
if ($bbuserinfo['userid']=0) {
// Some sort of login code here
}

is that an okay start and am i on the right track? I wanted to more or less integrated with vb, but my concern is that by using the above code when people access the website section it will update when they last visited the forum (even though it's not a visit).

Hope i made sense somewhere in there ;)

N9ne
05-04-2003, 07:51 PM
If global.php is included, I believe it WILL update their last visit, but i'm not 100% sure on that.

Tigga
05-04-2003, 08:16 PM
Something like this should get you started...

(If the page isn't in your forums directory, you will need this first chdir line. If not then it's not necessary ;))
chdir('/home/path/to/your/forums');
require('./global.php');
if ($bbuserinfo['userid']=='0') {
show_nopermission();
}

And yes, if global.php is included it will update their last visit as well. Personally though I like that since it keeps track of where visitors are anywhere on your site, plus you can add who's online locations so they show up on the WOL. :)

Radgam
05-05-2003, 09:29 AM
Thanks very much for the information :)
It's a great start and after looking over my idea for the site i agree that it would be better for the last visit and WOL list to be updated so the code you listed is perfect :D

Thanks again,
~Rad

Tigga
05-05-2003, 10:16 AM
No problem. :)
One thing though - Take the trailing slash off the end in that code. Just looked at it again and noticed that was there.

Radgam
05-06-2003, 01:40 PM
Thanks again :)
I've already got around 90% of the hack done but i might re-write part of it so it actually uses a database :D
It's easier to integrate things into vb than i thought it would be !