replica
Trådstartare
Vad gör jag för del. Vill göra ett inloggningssystem med hjälp av php. Har hittat en kod på nätet där man inte behöver någon databas, men sidan jag vill länkar till "kan inte visas".
Hjäälp mig!!
HTML:
<form action="http://n.domaindlx.com/fofh/member.php" method="post">
<p style="margin-top: 0; margin-bottom: 0">Username:
<input type="text" name="username" size="16"><br>
</p>
<p style="margin-top: 0; margin-bottom: 0">Password:
<input type="password" name="password" size="16"><br>
<input type="submit" value=" Login ">
</p>
</form>
<?php
$username = $_POST['username'];
$password = $_POST['password'];
// location of page to go to if username and password match
$url = "http://n.domaindlx.com/fofh/member.php";
$user_array = array("Jeannie","user1","user2","user3","user4");
$pass_array = array("test","pass1","pass2","pass3","pass4");
$user_length = count( $user_array );
for ( $i = 0; $i < $user_length; $i++ )
{
if ( $username == $user_array[$i] && $password == $pass_array[$i] )
{
session_start();
session_register("user");
session_register("loggedIn");
$_SESSION['user'] = $username;
$_SESSION['loggedIn'] = "true";
header("Location: $url");
}
}
// nothing became valid while we looped so verification failed
echo '<b>Verification Failed!</b>';
?>
Hjäälp mig!!