Hi I already managed to create some login code, but what I was trying was to set up an individual login, so that a different user gets a different site after login. This is the code I already use: login.php: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <style> label { width:25%; text-align:left; float:left; font-weight:bold; } .row { padding: 5px; } </style> <body> <form action="logincheck.php" method="post"> <div class="row"><label for="name">Login: </label><input type="text" name="login" size="15"></div> <div class="row"><label for="password">Password: </label><input type="password" name="password" size="15"></div> <div class="row"><input type="submit" value="Log in"></div> </form> </body> </html> Code (markup): logincheck.php <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <?php $login=$_POST['login']; $password=$_POST['password']; $found=false; $con = mysql_connect('localhost','login','pass'); mysql_select_db('vcdozies', $con); $query = 'SELECT * FROM login WHERE login=addslashes($login)'; $result = mysql_query($query); $row=$result; $goal=''.$result['goal']; if (strcmp($row['password'],$password)) { echo (addslashes($goal)); if(strcmp($row['login'],$login)) {echo ('<meta http-equiv="refresh" content="5;url='.addslashes($goal).'">');$found=true;} } echo (' </head> <body>'); if (!$found) {echo ('Invalid pass/username');} mysql_close($con); echo('</body> </html>'); ?> Code (markup): My MySQL db table login is a table with 4 fields (id,login,password and goal). But when I load the page ( http://vcdozies.phpnet.us/test/login.php and I give in the username (=laurens) - pass (=persoons) I get the refresh page, but in the refresh meta tag is no url filled in. What am I doing wrong?
I feel this one will be more useful for you since you seem to be a beginner level coder. http://www.plus2net.com/php_tutorial/php_login_script.php
If you don't output the header information just yet, once you verify the login, you can use a Header redirect.
I do understand my code is still primitive, but I think it's quite correct except the redirect function. And that link you gave, there's nothing in it of a custom redirect. I mean when I sign in, I get page x.php, when someone else signs in, he/she gets page y.php. That's what my goal is for this little project. Ty