Triple_Deuce Posted February 7, 2007 Share Posted February 7, 2007 Ok... I want people to login and once they login they can access multiple pages... I want to make sure that no one else can access those pages unless logged in. Basically... I dont want the special pages to keep asking for the login information everytime they visit a different special page. how would I go about doing this? so far I just have a simple login, but like i said...i need it to be able to go through many pages... hope this makes sense <? if ((!$_POST[username]) || (!$_POST[password])) { header("Location: authuser.html"); exit; } $db_name = "tripled_vpa"; $table_name = "user"; $connection = @mysql_connect("localhost", "tripled_user", "triple222") or die(mysql_error()); $db = @mysql_select_db($db_name, $connection) or die(mysql_error()); $sql = "SELECT * FROM $table_name WHERE username = '$_POST[username]' AND password = password('$_POST[password]')"; $result = @mysql_query($sql,$connection) or die(mysql_error()); $num = mysql_num_rows($result); if ($num !=0) { $msg = "Logged In!"; } else { header("Location: authuser.html"); exit; } ?> <html> <head> <title></title> </head> <body> <center> <LINK REL=stylesheet HREF="style1.css" TYPE="text/css"> <? echo "$msg"; ?> <br> <a href="menu2.html" target="left">>Click Here<</a> </body> </html> Link to comment https://forums.phpfreaks.com/topic/37473-user-authentication-multiple-pages/ Share on other sites More sharing options...
Balmung-San Posted February 7, 2007 Share Posted February 7, 2007 Use a Session. Link to comment https://forums.phpfreaks.com/topic/37473-user-authentication-multiple-pages/#findComment-179199 Share on other sites More sharing options...
roopurt18 Posted February 7, 2007 Share Posted February 7, 2007 http://www.phpfreaks.com/forums/index.php/topic,115254.msg469365/topicseen.html#msg469365 http://www.phpfreaks.com/forums/index.php/topic,114046.0.html Those should get you started. Link to comment https://forums.phpfreaks.com/topic/37473-user-authentication-multiple-pages/#findComment-179305 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.