Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

PHP Redirect

PHP redirects to specified page if username and password correct

9:37 pm on Feb 10, 2013 (gmt 0)

New User

joined:Feb 10, 2013
posts: 1
votes: 0

When a user logs in onto my site, the form checks against the database using check.php. But I need it to check the information against the database then, if the information (username and password) is correct, redirects them to the homepage, but if they have not supplied the correct information, doesn't redirect them. Is this possible? If so can you provide me with a PHP Script. I've tried javascript redirect, header redirect and meta redirect but dreamweaver says that there is an error in the syntax on that specific line.
3:00 am on Feb 12, 2013 (gmt 0)


WebmasterWorld Administrator jatar_k is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 24, 2001
votes: 0

Welcome to WebmasterWorld jsrip2012,

you could do that, just use header() [php.net] if their information is correct, otherwise I would output the login page again with whatever error was encountered.

just watch out to not have any output to the browser before using header(), even blank lines at the top of the file.