Den kan ikke poste userlevel bruger skal være 0 og bestyrelsen 1.
SMS og mail skal poste 1 hvis der er en flueben.
<?
$js[] = "createUser.js";
require("inc.setting.php");
$header = $siteName;
//Create user!
if($_SERVER['REQUEST_METHOD'] == "POST") {
if(empty($_POST["vo_nummer"])) {
$error = true;
$messageArray[] = "Udfyld Vonr";
}
if(empty($_POST["password"])) {
$error = true;
$messageArray[] = "Udfyld Kode";
}
if(empty($_POST["navn"])) {
$error = true;
$messageArray[] = "Udfyld Navn";
}
if(empty($_POST["efternavn"])) {
$error = true;
$messageArray[] = "Udfyld Efternavn";
}
if(empty($_POST["adresse"])) {
$error = true;
$messageArray[] = "Udfyld Adresse";
}
if(empty($_POST["postnr"])) {
$error = true;
$messageArray[] = "Udfyld Postnr";
}
if(empty($_POST["bynavn"])) {
$error = true;
$messageArray[] = "Udfyld Bynavn";
}
if(empty($_POST["email"])) {
$error = true;
$messageArray[] = "Udfyld Email";
}
if(!$error) {
$q = mysql_query("INSERT INTO `users` SET
`vo_nummer`='".mysql_real_escape_string($_POST["vo_nummer"])."',
`password`='".mysql_real_escape_string($_POST["password"])."',
`navn`='".mysql_real_escape_string($_POST["navn"])."',
`efternavn`='".mysql_real_escape_string($_POST["efternavn"])."',
`adresse`='".mysql_real_escape_string($_POST["adresse"])."',
`postnr`='".mysql_real_escape_string($_POST["postnr"])."',
`bynavn`='".mysql_real_escape_string($_POST["bynavn"])."',
`Userlevel`='".mysql_real_escape_string($_POST["Userlevel"])."',
`email`='".mysql_real_escape_string($_POST["email"])."'") or die(mysql_error());
$messageArray[] = "Brugeren er oprettet!";
}
}
require_once("inc.top.php");
require_once("inc.top.php");
if($_SESSION["userlevel"] != "1") {
exit();
}
?>
<div id="mainContent">
<div id="leftContent">
<?require_once("inc.left_content.php");?>
</div>
<div id="pageContent">
<h1>Opret bruger</h1>
<br />
<?
if(is_array($messageArray)) {
foreach($messageArray AS $value) {
echo $value."<br />";
}
}
?>
<form action="" method="post">
<table style="width:350px;" cellpadding="0" cellspacing="3">
<tr>
<td>Vo-nummer</td>
<td><input type="text" name="vo_nummer" id="vo_nummer" onkeyup="checkForm(this.id)" /></td>
<td><img id="vo_nummer_img" src="<?php echo GFXDIR."false.gif" ?>" /></td>
</tr>
<tr>
<td>Vælg password</td>
<td><input type="text" name="password" id="password" onkeyup="checkForm(this.id)" /></td>
<td><img id="password_img" src="<?php echo GFXDIR."false.gif" ?>" /></td>
</tr>
<tr>
<td>E-Mail</td>
<td><input type="text" name="email" id="email" onkeyup="checkForm(this.id)" /></td>
<td><img id="email_img" src="<?php echo GFXDIR."false.gif" ?>" /></td>
</tr>
<tr>
<td>Mobil</td>
<td><input type="text" name="mobil" id="mobil" onkeyup="checkForm(this.id)" /></td>
<td><img id="mobil_img" src="<?php echo GFXDIR."false.gif" ?>" /></td>
</tr>
<tr>
<td>Navn</td>
<td><input type="text" name="navn" id="navn" onkeyup="checkForm(this.id)" /></td>
<td><img id="navn_img" src="<?php echo GFXDIR."false.gif" ?>" /></td>
</tr>
<tr>
<td>Efternavn</td>
<td><input type="text" name="efternavn" id="efternavn" onkeyup="checkForm(this.id)" /></td>
<td><img id="efternavn_img" src="<?php echo GFXDIR."false.gif" ?>" /></td>
</tr>
<tr>
<td>Adresse</td>
<td><input type="text" name="adresse" id="adresse" onkeyup="checkForm(this.id)" /></td>
<td><img id="adresse_img" src="<?php echo GFXDIR."false.gif" ?>" /></td>
</tr>
<td>Postnr</td>
<td><input type="text" name="postnr" id="postnr" onkeyup="checkForm(this.id)" /></td>
<td><img id="postnr_img" src="<?php echo GFXDIR."false.gif" ?>" /></td>
</tr>
</tr>
<td>By</td>
<td><input type="text" name="bynavn" id="bynavn" onkeyup="checkForm(this.id)" /></td>
<td><img id="bynavn_img" src="<?php echo GFXDIR."false.gif" ?>" /></td>
</tr>
<tr>
<td>Billede</td>
<td><input type="file" name="billede" id="billede" onkeyup="checkForm(this.id)" /></td>
</tr>
<tr>
<td>Userlevel</td>
<td><select type="text" name="userlevel" id="userlevel" onkeyup="checkForm(this.id)">
<option value="0">Bruger</option>
<option value="1">Bestyrelse</option>
</select>
</td>
</tr><tr>
<td>SMS</td>
<td>
<input type="checkbox" name="SMS_send" id="sms_send" value="1" onkeyup="checkForm(this.id)" />
</td>
</tr><tr>
<td>Mail</td>
<td>
<input type="checkbox" name="mail_send" id="mail_send" value="1" onkeyup="checkForm(this.id)" />
</td>
</tr>
<tr>
<td colspan="2"> </td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="Opret"></td>
</tr>
</table>
</form>
</div>
</div>
<?require_once("inc.footer.php")?>
på forhånden tak