PDA

View Full Version : Protecting NON-VB Pages.


Sebastian
12-23-2002, 11:15 PM
Okay, I search for such a hack, found a couple, some work, and others don't even make any sense.

Basically this is what I want:

1) Protect pages, so a user must be registered to view it.

2) Say I put a link on my front page that leads to a file... how do I block non members from clicking the link, so the download doesn't start and they get directed to the login/register page?

3) When they log in it directs them to the page they were trying to view.

I have an idea how to do it, but I want to make sure I am choosing the right method.

I know I would need to put something like this in the head section of the page I want to protect:

<?php
chdir("forums/");
require("global.php");

if ($bbuserinfo[userid]==0)
{
blah, blah..
?>

am I close? ;)

my main focus it protecting links so people can't download my files if they aren't registerd.

thanks.

Chris M
12-23-2002, 11:22 PM
Yes...

<?php
chdir("./forums");
require("./global.php");

if ($bbuserinfo[userid]==0) {
show_nopermission();
}
?>

:)

Satan

Sebastian
12-23-2002, 11:42 PM
Hmm.. getting include errors.

This is how I have my pages:

<?php
include("../config.php");
include("../header.php");
?>

// content

<?php
include("../footer.php");
?>

I tried like this but get still get include errors.

<?php
chdir("./forums");
require("./global.php");

if ($bbuserinfo[userid]==0) {
show_nopermission();
}
include("../config.php");
include("../header.php");
?>

// content

<?php
include("../footer.php");
?>

I also tried putting it after header but then it can't find the footer.

Sebastian
12-23-2002, 11:53 PM
okay apparently i need more code than just that....

I only got it to work by setting FULL path starting from /home :(

and after I tried to view the page it inserted the VB login page INSIDE the non VB page LOL it was messy, broken images etc....

I found this hack but it's way sloppy:
https://vborg.vbsupport.ru/showthread.php?s=&threadid=36934

how do I protect links like attachments? so people can't download the files that are on no vb page?

Xenon
12-24-2002, 12:03 AM
you can't protect those files really, except if you save em into the db as attachments :)

Sparkz
12-24-2002, 12:27 AM
Sure you can.
You can put them outside directory-tree that comprises your web-space and have some php-file output them. I imagine this is exactly what PPN's 'attachments as files'-hack does.

Sebastian
12-24-2002, 04:38 PM
Xenon, where did your reply go? i got an email and i don't see it here ;) LOL

someone try to make this hack, i know it's possible just don't have the knowledge.

okrogius
12-24-2002, 04:57 PM
Originally posted by Xenon
you can't protect those files really, except if you save em into the db as attachments :)

Actually that's not true. All you need to do is move them to a non-web acessible locations. Then create a file which outputs them using fpassthrough() after checking login, that is all.

Sebastian
12-24-2002, 05:09 PM
so can you make a working hack? :)

okrogius
12-24-2002, 06:05 PM
<a href="https://vborg.vbsupport.ru/showthread.php?threadid=46963" target="_blank">https://vborg.vbsupport.ru/showt...threadid=46963</a>

Xenon
12-25-2002, 09:25 PM
@Codename: Sparkz already told me two posts above ;)
i know i was wrong, at least it depends on your host, if you have such locations, not every host supports that (ok i think just free hosts would have such problems ;))

@Sebastian: i deleted it myself, because i said something i saw answered a post above ;)

Chris M
12-25-2002, 09:34 PM
Arunan?:confused:

Satan

Xenon
12-25-2002, 09:46 PM
pssst ;)
ok, it's to late, i should go to bed :)

*edits post*

Chris M
12-25-2002, 09:56 PM
Indeed you should Xenon:)

Satan

Sebastian
12-25-2002, 10:47 PM
LOL too much eggnog.

okrogius
12-26-2002, 02:19 AM
Originally posted by Xenon
@Codename: Sparkz already told me two posts above ;)
i know i was wrong, at least it depends on your host, if you have such locations, not every host supports that (ok i think just free hosts would have such problems ;))

@Sebastian: i deleted it myself, because i said something i saw answered a post above ;)

Some of us have the evil habbit of clicking the quote button before bothering to read further :p.