Login Script Problems
Posted: Tue Aug 10, 2004 8:17 pm
Here is all the code I'm using for the login script but when I tried to login it says "Error on Page". Does anyone know whats wrong with the code.
Also is it possible to have different users login to different pages, insted of all users logining into the same page. How would you do this?
login.html:
login.php:
Also is it possible to have different users login to different pages, insted of all users logining into the same page. How would you do this?
login.html:
Code: Select all
<form action="login.php" method="post">
Username: <input type="text" name="username" class="form"><br>
Password: <input type="password" name="password" class="form"><p>
<input type="button" name="login" value="login" onClick="go()">Code: Select all
<?php
//function display_name() {
// global $_POSTї'username'];
//}
function valid_login($username, $password) {
return ($username == 'username' && $password == 'password')
or ($username == 'admin' && $password == 'pass')
or ($username == 'name' && $password == 'word');
}
if ($_SESSIONї'logged_in']= 1) {
header( "Location: index.php" );
}
session_start();
if ( valid_login($_POSTї'username'], $_POSTї'password']) ) {
$_SESSIONї'logged_in'] = 1;
header( "Location: index.php" );
}
else {header( "Location: login.html" );}
?>