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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.