Log in

View Full Version : Need help big time


C.Birch
07-29-2002, 05:09 PM
Right i have no idea how to go about this but basicy i want to password some areas of my site useing my vb database info.

The site and board are on same host server but not the same domain.

i want to make it so if you try to get to a page that you needed to be signed in for its shows you a login page but if your loged in it takes you right to the real page, also if your logged out and you login on that page i want it so it takes you to that page and not back to the main index page.

I already have it working useing a php/mysql login i found but it does not use my vb database where has thats who i want it working save people having to sign up 2 times.

code im useing right now on a page that needs you to be logged in to view is this:



<?php
include "auth.php"; // always include this, always.
$USER=new user('',$user_name,$id_hash,'','','','');
if ($USER->islogged_in()) {
site_header('Welcome back!');

?>

//Main page html code goes here

<?
account_links(); // shows account links from functions.inc
site_footer();
} else {
site_header('Welcome');
login_form(); // displays login form if not logged in
site_footer();
}
?>

JulianD
07-30-2002, 05:41 AM
You can include the global.php file from your VB installation, and then use a simple IF to determine the usergroupid of the logged user:


<?php

require("path/to/vbulletin/global.php");

if ($bbuserinfo["usergroupid"]==6) { // is admin
//misc stuff
} elseif ($bbuserinfo["usergroupid"]==1) { // a guest
//stuff only for guests
}


something like that... Just sneak into the vbulletin files, and you will learn how to identify an user!

Hope this helps!

Logician
07-30-2002, 08:37 AM
you may want to take a look at this hack (https://vborg.vbsupport.ru/showthread.php?s=&threadid=36419) too, if your secured pages are HTML, not PHP..

C.Birch
07-30-2002, 03:53 PM
hehe i already found that hack deep down the lists last night after this post it works great thanx just what i wanted but is there a way to edit it so the templates pages can be called for from a address out side of the boards?

because my site is at www.ultimatesteps.com and my boards at www.ultimate-forums.co.uk? this way i can still keep the same address showing.

i guess i could use a mysql database to hide the address's but there most be a easyer way. that takes less time.

Logician
07-30-2002, 04:25 PM
well I can't think an easy way. BTW how do you plan to use "mysql database" to hide the address, I didnt get it?

C.Birch
07-30-2002, 04:39 PM
you can set up a data base and some php code to call from the data base and basicy you can turn a address in to the domain address with just a id number, its used to make long page address's short but it could be used to hide the address.

eg:

https://vborg.vbsupport.ru/hdhd/dhdhd/dhdshd/showthread.php?

could get turn it to

http://www.vbulletin.org/yourphp.php=id1

im not up to speed with the full codeing but i know it can be done.

Logician
07-31-2002, 11:55 AM
You dont need a database to do it, it's a little .htaccess redirect trick. However AFAIK .htaccess redirect changes the URL to the latter after the redirection. So for example if in your address bar you write:

https://vborg.vbsupport.ru/hdhd...showthread.php?

you are automatically moved to

http://www.vbulletin.org/yourphp.php=id1

if set in .htaccess, but right after the redirection, your URL line will be read as:

http://www.vbulletin.org/yourphp.php=id1

as well..I'm not aware if there is an advanced tip to prevent this behaviour..