Jump to content

User Authentication -- Multiple Pages


Triple_Deuce

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.