login.php
<?php
session_start();
include_once ("dbconnection.php");
$tbl_name="gebruikers";
$myusername=$_POST['loginnaam'];
$mypassword=$_POST['wachtwoord'];
//SQL user zoeken
$sql="SELECT Unaam,mail_adr,aangemaakt,toegang_nivo
FROM $tbl_name
WHERE gebr_naam='$myusername' and wachtw='$mypassword'";
$query = mysql_query($sql) or die(mysql_error());
$result=mysql_fetch_array($query);
$count=mysql_num_rows($query);
$toegang_nivo=$result['toegang_nivo'];
$Unaam=$result['Unaam'];
$mail_adr=$result['mail_adr'];
$aangemaakt=$result['aangemaakt'];
if($count==1){
// Register $myusername, $mypassword and redirect to file "login_success.php"
$_SESSION['myusername'] = $myusername;
$_SESSION['mypassword'] = $mypassword;
$_SESSION['toegang_nivo'] = $toegang_nivo;
$_SESSION['Unaam'] = $Unaam;
$_SESSION['mail_adr'] = $mail_adr;
$_SESSION['aangemaakt'] = $aangemaakt;
header("location:frames.php");
}
else {
echo "Wrong Username or Password";
}
?>