...

View Full Version : Can I redirect different users to different webpages using Mysql/php ?



ghostpirate
06-07-2011, 05:52 PM
Im wondering if SQL / PHP is the right way to go about doing this.

I have a database of users in MySQL and my PhP login script is working ok , but, I would like each user to be redirected to there own page after login. Is it possible to extract a the string from say "webpage" field in my database and then redirect the user to a url using that string?

If its possible what commands should I be looking at from a tutorial point of view.

Im a noob at this but its a lot of fun, a point in the right direction would be great.

Thanks
Ghostpirate:)

Fabster
06-07-2011, 08:12 PM
What you describe is a user system, unless I understand you wrong. A specific user logs on with their username/password and you want them to be redirected to their personal profile page or whatever.

The are several php(mysql user system tutorials out there, Google for it and several will pop up.

ghostpirate
06-07-2011, 08:28 PM
Thanks, thats the term I was looking for. :)

elitis
06-08-2011, 10:54 AM
there are multiple things you could use to redirect.
You could use header(), a meta tag refresh (which can also redirect), a javascript refresh, and there are probably more than that. Out of those three I believe header() is the fastest. And for the string part do you mean redirecting a user to a page that has a string? ex: http://example.com?os=home

Stubworth
06-08-2011, 11:08 PM
Here's a simplified overview of what you need to have in place to make this happen:

Users sign-up -> User information goes into a MySQL database in a 'users' table.

You have one template page for each 'custom' page. -> The content on this page varies depending on the user who is logged in, e.g. it will say 'Welcome <Username>!'

Using 'if' statements and other MySQL queries you can store user preferences and display certain information based only on user groupings.

That's how it works (very basically) you'll need to look up how to do all of those things, but that's how it works. You don't have a separate page for everyone, it just changes what it displays based on the information it pulls from the username of whoever is logged in.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum