Quantcast
Viewing all articles
Browse latest Browse all 152999

Re: Different destination pages for each user login

Sara.Reese wrote:

 

Hi Ben, there will be about 3 users, each one having their own welcome screen

 

adding a manual condition each time is fine, as the majority of our 1000+ customers will all be redirected to the same "standard" welcome page. Its only a select few of our "special customers" that will have their own login and welcome page (advanced customers).

 

I have tried this with the above code to do this, but I dont think I was pasting it in the correct place as it was erroring

 

On my database (in phpMyadmin) I have already set up the 3 columns: company, username & database, example below:


Image may be NSFW.
Clik here to view.
example.jpg

 

Most of our customers will get the same username and password to enter the same welcome page

 

You can do that for a limited amount of users;

 

First you need to add the 'company' to the query"

 

$LoginRS__query=sprintf("SELECT company, username, password FROM login WHERE username=%s AND password=%s",

 

Then you need to get the 'company' based on the username/password:

$LoginRS = mysql_query($LoginRS__query, $searchDB) or die(mysql_error());

$row_rsDetails = mysql_fetch_assoc($LoginRS);

$loginFoundUser = mysql_num_rows($LoginRS);

 

 

Then the last bit of php code needs to look like below:

 

Only the 3 companies in the database get their 'dedicated page' - all others will go to normal.php if they supply the correct username/password.

 

if (isset($_SESSION['PrevUrl']) && false) {

$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];

}

$company = $row_rsDetails['company'];

if ($company == "standard") {

header("Location: standard.php");

}

elseif ($company == "advanced") {

header("Location: advanced.php");

}

elseif ($company == "super") {

header("Location: super.php");

}

elseif ($company != "standard" || $company != "advanced" || $company != "super") {

header("Location: normal.php");

}

}

else {

header("Location: ". $MM_redirectLoginFailed );

}

}

?>


Viewing all articles
Browse latest Browse all 152999

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>