Onbekend |
|
Ik ga uw code niet verbeteren maar tonen hoe ik het doe.
<?php
$user = $_POST['user'];
$password = $_POST['pass'];
$db = mysql_connect("localhost","user","password") or die (mysql_error());
mysql_select_db("database", $db);
$SQL_statement="SELECT rechten FROM gebruikers WHERE user ='".$user;"' AND password ='".$password."'";
$result = mysql_query($SQL_statement);
$rechten = mysql_fetch_array($result, MYSQL_ASSOC)
mysql_close();
unset($user, $password);
$recht = $rechten['rechten'];
switch($recht){
case 1:
echo("member");
break;
case 2:
echo("admin");
break;
case 3:
echo("webmaster");
break;
default:
echo("geen specifieke rechten");
}
?>
<?php $user = $_POST['user']; $password = $_POST['pass']; $SQL_statement="SELECT rechten FROM gebruikers WHERE user ='".$user;"' AND password ='".$password."'"; $recht = $rechten['rechten']; switch($recht){ case 1: break; case 2: break; case 3: break; default: echo("geen specifieke rechten"); } ?>
|