28, May 2012

Redirection to multiple pages and/or directories - webmaster forum

 
Webdigity webmaster forums
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  Access_user Class (Moderator: Olaf)
Topic: Redirection to multiple pages and/or directories
« previous next »
Pages: [1] Print

Author Topic: Redirection to multiple pages and/or directories  (Read 1749 times)
Kill the googlebot
*
Posts: 6
44 credits
Members referred : 0

Turkish translator


« on: Jul 25, 2006, 03:25:08 am »

Hi Olaf,

Firstly, thank you for this great script. It really helped a lot to ease my job and my mind. Nevertheless, I have a problem that I cannot tackle, being a newbie in php.

The problem is this:
I have a site with multiple subdirectories such as: mysite.com/apages/, mysite.com/bpages/, etc.
I am trying to provide an option to login from anywhere in the site, but I would like to have the access_user class redirect the logged-in user to the originating page. English is not my native language, so let me put it in simpler terms:

User A clikcks the login link on page mysite.com/apage.php after logging in, he should be redirected to mysite.com/apage.php
User B clicks the login link on page mysite.com/bpage.php. After logging in, he should be redirected to mysite.com/bpage.php.

But the db_config file allows only one page for redirection ("define("START_PAGE", "mypage")").
How can I accomplish this? I tried it by using http_referer, etc. but of no avail.
Thank you in advance for your kind support.
I crack Photoshop!
*
Gender: Male
Posts: 3
18 credits
Members referred : 0



« Reply #1 on: Jul 25, 2006, 08:17:46 am »

Hi all  Tongue
To what attribute you distinguish users?
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #2 on: Jul 25, 2006, 11:02:48 am »

Hello,

What you are trying to is possible but you need write some new code to get it working like this. The script is written to redirect after login  if someone access a protected page before.

Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #3 on: Jul 25, 2006, 11:04:16 am »

Hi all  Tongue
To what attribute you distinguish users?

don't understand what you're meaning... please explain a little bit more.

Kill the googlebot
*
Posts: 6
44 credits
Members referred : 0

Turkish translator


« Reply #4 on: Jul 25, 2006, 11:10:20 am »

Thank you for your prompt reply Olaf,

In fact, pages are not protected. That is to say, they are accessible before login. However, there is a login link in the footer section.
Then why I need this?
Simply put, without login, the user is allowed to view the page. And login adds an "edit/modify/create" option for the page in question.

In fact, each subdirectory deals with a different topic, and it is possible to have multiple copies of access_user class installed for each subdirectory which is what I did originall. In this case, the script functions well. I simply wanted to avoid from such multiple installations.
« Last Edit: Jul 25, 2006, 11:13:46 am by layman »
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6691
34714 credits
Members referred : 374


It's time to use PHP5!


« Reply #5 on: Jul 25, 2006, 11:14:59 am »

Quote
Then why I need this?
Simply put, without login, the user is allowed to view the page. And login adds an "edit/modify/create" option for the page in question.

Yes why not, you can show a member additional content, I use the class to show prices to members only...

But the redirection is used inside this function:

Code:
function access_page($refer = "", $qs = "", $level = DEFAULT_ACCESS_LEVEL) {
$refer_qs = $refer;
$refer_qs .= ($qs != "") ? "?".$qs : "";
if (isset($_SESSION['user']) && isset($_SESSION['pw'])) {
$this->user = $_SESSION['user'];
$this->user_pw = $_SESSION['pw'];
if (!$this->check_user()) {
$_SESSION['referer'] = $refer_qs;
header("Location: ".$this->login_page);
}
if ($this->get_access_level() < $level) {
header("Location: ".$this->deny_access_page);
}
} else {
$_SESSION['referer'] = $refer_qs;
header("Location: ".$this->login_page);
}
}

you need to rewrite the login method with some function like above, just write small extension of the class.

I crack Photoshop!
*
Gender: Male
Posts: 3
18 credits
Members referred : 0



« Reply #6 on: Jul 25, 2006, 11:20:11 am »

I'd like to ask layman, what is the attribute which user A differs from user B

PS. Excuse for my bad English
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=3394
Tags : php directories Bookmark this thread : Digg Del.icio.us Dzone more....

Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  Access_user Class (Moderator: Olaf)
Topic: Redirection to multiple pages and/or directories
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
May 28, 2012, 12:29:23 pm





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!






Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2012 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.