Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    May 2011
    Posts
    3
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Can I redirect different users to different webpages using Mysql/php ?

    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

  • #2
    New Coder
    Join Date
    Nov 2010
    Posts
    11
    Thanks
    0
    Thanked 4 Times in 4 Posts
    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.

  • Users who have thanked Fabster for this post:

    ghostpirate (06-07-2011)

  • #3
    New to the CF scene
    Join Date
    May 2011
    Posts
    3
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Thanks, thats the term I was looking for.

  • #4
    Regular Coder
    Join Date
    Sep 2010
    Posts
    331
    Thanks
    9
    Thanked 6 Times in 6 Posts
    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
    Last edited by elitis; 06-08-2011 at 10:56 AM.

  • #5
    New Coder
    Join Date
    Nov 2010
    Posts
    43
    Thanks
    4
    Thanked 2 Times in 2 Posts
    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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •