Click to See Complete Forum and Search --> : Creating Accounts


Emry
05-23-2006, 02:27 PM
Ok so here is my problem. I am a student webpage designer (Highschool) and am looking for how to make a 'members only' section of my page. Does anyone know how to make an passworded account? I am soooo confused.

BrainDonor
05-23-2006, 02:41 PM
If it's an Apache server...

Google .htaccess

Emry
05-23-2006, 06:47 PM
yea sorry it isn't

Raremandan
05-23-2006, 09:31 PM
You can also use PHP for password protected pages.

<?php

$form = "<table>
<tr>
<td align='center' bgcolor='lightblue'>
<font face='verdana' size='1'><b>This page is password protected!</b></td></tr>
<tr>
<td align='center'><form method='post' action='protected.php'>
<input name='password' type='password' id='password' maxlength='15'></td></tr>
<tr><td align='center'>
<input type='submit' name='Submit' value='Unlock this page!'></form></td></tr>
</table></center>";

echo "$form";
?>

<?PHP
$setpassword = "PASSWORD";
// Change the password above
$password = $_POST['password'];

if ($password == $setpassword)
{
echo "Access granted.";
}
else
{
echo "Access denied.";
}
?>

Also another different way is:

<?
//part 1
if (!isset($PHP_AUTH_USER))
{
header("WWW-Authenticate: Basic realm=\"Your Password.\"");
Header("HTTP/1.0 401 Unauthorized");
exit;
}

//part 2
else if(($PHP_AUTH_USER=="youruser") && ($PHP_AUTH_PW=="yourpassword"))
{
echo "Authenticated!";
//place the code for the whole user page in here
//you can also set up a redirect to the user page if you want
}

//part 3
else
{
echo "Login Failed";
//fail try again
}
?>

Emry
05-24-2006, 01:43 PM
Heh I guess I should be named super noob but how would I go about encrypting them to begin w/