phpAuth Script Help

Hello,

I’m fairly new to php but I’ve managed to get the phpAuth script working on my site which is great but I’m wondering if it’s possible to modify the config page so that different users can be redirected to different pages? For example, Member 1 redirected to Page 1, Member 2 redirected to Page 2 and so on. Any help would be greatly received.

Thanks :)

[code]

<? //////////////////////////////////// // Configuration file for phpAuth // //////////////////////////////////// $database_name = "members.txt"; // Make sure you include the .txt in your database name $login_redirect = "secure1.php"; // page to directed to when logged in $logout_redirect = "index.php"; // redirect to your own logout page. ?>[/code]

Certainly you could find the section that verifies the authorization. I am sure after a successful login it will either “Re-direct” you to the appropriate page (normally) or have the rest of the page in the same script.

At that point you could add a piece of code that after you are verified, you could do another lookup in the database (or hard code it) that would redirect the user to a different location based upon your criteria.

You could use the header() function or a meta redirect to accomplish this.

[php]<?

////////////////////////////////////
// Configuration file for phpAuth //
////////////////////////////////////

$database_name = “members.txt”; // Make sure you include the .txt in your database name

$login_redirect = “secure1.php”; // page to directed to when logged in
$logout_redirect = “index.php”; // redirect to your own logout page.

?>[/php]

If this is your full file, you could try something like this:

[php]<?

////////////////////////////////////
// Configuration file for phpAuth //
////////////////////////////////////

$database_name = “members.txt”; // Make sure you include the .txt in your database name

// GET YOUR LOGIN AUTHORIZATION HERE
include “authorization_Script.php”;

if ($user == “UserOne”) {
$login_redirect = “secure1.php”; // page to directed to when logged in
}

if ($user == “UserTwo”) {
$login_redirect = “secure2.php”; // page to directed to when logged in
}

if (!$user) {
$logout_redirect = “index.php”; // redirect to your own logout page.
}
?>[/php]

There are different types of constrol structures to be found in the PHP Manual, so it’s really up to what you want.

Thanks for your code Zyppora, just one thing though. What does the below line refer to? Do I need a special Authorization Script page? include "authorization_Script.php";

Sorry if this is basic stuff!! :-?

No, that’s where you need to run your authorization script (allowing the user to input their credentials and validating them).

Sponsor our Newsletter | Privacy Policy | Terms of Service