Hello,
I have this script.
And it won't work.
i have tried al things wich i'm capable of.
login:
<form name="form1" method="post" action="checkuser.php">
<td height="30"><font color="#FFFF00" face="Fixedsys">Nickname
:</font></td>
<td height="30"> <input name="username" type="text" id="username" size="10"></td>
</tr>
<tr>
<td height="32"><font color="#FFFF00" face="Fixedsys">Paswoord
:</font></td>
<td height="32"> <input name="password" type="password" id="password" size="10"></td>
</tr>
<tr>
<td colspan="2" height="17">
<p align="center"><input type="submit" value=" Login "></td>
</tr>
</table>
</div>
</td>
</tr>
</table>
</form>
checkuser.php:
<?php
session_start();
include 'db.php';
// Conver to simple variables
$username = $_POST['username'];
$password = $_POST['password'];
if((!$username) || (!$password)){
echo "Vul al de informatie in <br />";
include 'index.php';
exit();
}
// Convert password to md5 hash
$password = md5($password);
// check if the user info validates the db
$sql = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password' AND activated='1'");
$login_check = mysql_num_rows($sql);
if($login_check > 0){
while($row = mysql_fetch_array($sql)){
foreach( $row AS $key => $val ){
$$key = stripslashes( $val );
}
// Register some session variables!
session_register('first_name');
$_SESSION['first_name'] = $first_name;
session_register('last_name');
$_SESSION['last_name'] = $last_name;
session_register('email_address');
$_SESSION['email_address'] = $email_address;
session_register('user_level');
$_SESSION['user_level'] = $user_level;
mysql_query("UPDATE users SET last_login=now() WHERE userid='$userid'");
header("Location: login_success.php");
}
} else {
echo "Je kan niet inloggen of je paswoord of nicknaam was niet goed of je hebt je niet geactiveerd.<br />
Probeer nog een keer!<br />";
include 'index.php';
}
?>
login_success.php
<?php
session_start();
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta http-equiv="Content-Language" content="en-us">
<meta name="Title" content=" .::StreetFreaks::. To Fast To Get Busted...">
<meta name="Author" content="Mathijs G.">
<meta name="Subject" content="streetracing,streetperformance">
<meta name="Description" content="Deze site gaat over streetracing in en om heerenveen.">
<meta name="Keywords" content="straat,street,race,racing,performance,tuning,heerenveen,streetperformance,races,foto's,street race foto's,sph,SPH,streetfreaks,streetfreaks.nl,StreetFreaks.nl,StreetFreaks,STREETFREAKS,opel,nissan,fiat,renault,ford,nissan skyline,skyline">
<meta name="Copyright" content="©StreetFreaks.nl">
<meta name="Designer" content="Mathijs G.">
<meta name="Publisher" content="Mathijs G. & Eric-Jan G.">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>.::StreetFreaks::. To Fast To Get Busted.</title>
<style type="text/css">.link { color: #FFFF00; font-family: Fixedsys }
</style>
</head>
<body bgcolor="#344C50">
<div align="center">
<center>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<?php
if($_SESSION['user_level'] == 1)
{
?>
<td><img border="0" src="../images/Chat.png" width="100" height="20"></td>
<td><img border="0" src="../images/Mail.png" width="100" height="20"></td>
<td><img border="0" src="../images/U_foto.png" width="110" height="20"></td>
<td><img border="0" src="../images/Profiel.png" width="100" height="20"></td>
<?php
}
if($_SESSION['user_level'] == 2)
{
?>
<td><img border="0" src="../images/C_info.png" width="130" height="20"></td>
<td><img border="0" src="../images/P_news.png" width="130" height="20"></td>
<?php
}
else
{
echo "oeps<br>";
echo "Ff wat anders dan<br>";
echo "je voornaam is ".$_SESSION['first_name']." en je achternaam is ".$_SESSION['last_name']."<br>";
echo "Klopt dit";
}
?>
DOes anybody knows the answer for this "i think little" problem ?