problem med submit
Når jeg klikker på subtmit knappen får jeg en internal server error. Jeg har prøvet ret meget, også at kommemtere headers ud. Jeg er skide sur og skide træt. Nu vil jeg spørge jeg .. kan I se nogle fejl her?? Frygt ikke, gu er det langt men meget af det er ren copy paste.showuser.php
-----------------------------------------------------
<?php
// Her tjekkes om brugeren er admin .. virker fint!
session_start();
$u = strlen($usr);
$a = strlen($admin);
$user = ucwords($usr);
if ($u == 0 || $a == 0){
header ("location: http://www.mavser.adsl.dk/test/ny/main.htm");
exit;}
if ($mode == "update"){
$db = mysql_connect("localhost", "Hathor", "losinos");
mysql_select_db("users", $db);
$result=mysql_query("select user from users where user='$usern'");
$usertest=mysql_fetch_array($result);
$lenght = strlen($upass);
$user = strtolower($usern);
if ($upass!="" && $usern!="" && $lenght > 3){
mysql_query("INSERT INTO users where id = '$id' (user, pass, email, type) VALUES ('$usern', '$upass', '$uemail', '$utype')");
//header ("location: http://www.mavser.adsl.dk/test/ny/main.htm");
}
else{
//header ("location http://www.mavser.adsl.dk/test/ny/main.htm");
}}
else if ($mode == ""){
$db = mysql_connect("localhost", "Hathor", "losinos");
mysql_select_db("users", $db);
$id1 = mysql_query("SELECT id FROM users WHERE id = '$id'");
$navn1 = mysql_query("SELECT user FROM users WHERE id = '$id'");
$pass1 = mysql_query("SELECT pass FROM users WHERE id = '$id'");
$mail1 = mysql_query("SELECT email FROM users WHERE id = '$id'");
$type1 = mysql_query("SELECT type FROM users WHERE id = '$id'");
while ($id2 = mysql_fetch_array($id1)){
$id3[] = $id2[0];
}
while ($navn2 = mysql_fetch_array($navn1)){
$navn[] = $navn2[0];
}
while ($pass2 = mysql_fetch_array($pass1)){
$pass[] = $pass2[0];
}
while ($mail2 = mysql_fetch_array($mail1)){
$mail[] = $mail2[0];
}
while ($type2 = mysql_fetch_array($type1)){
$type[] = $type2[0];
}
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="../css/style.css">
</head>
<body background="../pics/bg.gif">
<h1>Administration of users</h1>
<br><br>
<?php
if ($type[0] == 3){
echo "<table width=100% border=0><tr><td valign=\"top\" width=75%>";
echo "Username: ".$navn[0]."<br>";
echo "Password: ".$pass[0]."<br>";
echo "Email : ".$mail[0]."<br>";
echo "Type: Basic user"."<br>";
echo "</td>";
echo "<td valign=\"top\" width=25%>";
echo "<FORM METHOD=POST ACTION=showuser.php?mode=update>";
echo "Username:<br>";
echo "<INPUT TYPE=TEXT NAME=usern value=\"$navn[0]\"><br>";
echo "Password:<br>";
echo "<INPUT TYPE=TEXT NAME=upass value=\"$pass[0]\"><br>";
echo "Email:<br>";
echo "<INPUT TYPE=TEXT NAME=uemail value=\"$mail[0]\"></br>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td>";
$type1 = ""; $type2 = ""; $type3 = "";
if ($type[0] == 1) $type1 = " checked";
if ($type[0] == 2) $type2 = " checked";
if ($type[0] == 3) $type3 = " checked";
print("<input type=\"radio\" name=\"utype\" value=1" . $type1 . ">Admin<br>");
print("<input type=\"radio\" name=\"utype\" value=2" . $type2 . ">Authorized<br>");
print("<input type=\"radio\" name=\"utype\" value=3" . $type3 . ">Basic<br>");
echo "<input type=submit value=Submit>";
echo "</td></tr></table><br>";
echo "<font color=red>Be sure that you do not give a user admin access by mistake!</font>";
}
else if ($type[0] == 2){
echo "<table width=100% border=0><tr><td valign=\"top\" width=75%>";
echo "Username: ".$navn[0]."<br>";
echo "Password: ".$pass[0]."<br>";
echo "Email : ".$mail[0]."<br>";
echo "Type: Athorized user"."<br>";
echo "</td>";
echo "<td valign=\"top\" width=25%>";
echo "<FORM METHOD=POST ACTION=showhuser.php?mode=update>";
echo "Username:<br>";
echo "<INPUT TYPE=TEXT NAME=usern value=\"$navn[0]\"><br>";
echo "Password:<br>";
echo "<INPUT TYPE=TEXT NAME=upass value=\"$pass[0]\"><br>";
echo "Email:<br>";
echo "<INPUT TYPE=TEXT NAME=uemail value=\"$mail[0]\"></br>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td>";
$type1 = ""; $type2 = ""; $type3 = "";
if ($type[0] == 1) $type1 = " checked";
if ($type[0] == 2) $type2 = " checked";
if ($type[0] == 3) $type3 = " checked";
print("<input type=\"radio\" name=\"utype\" value=1" . $type1 . ">Admin<br>");
print("<input type=\"radio\" name=\"utype\" value=2" . $type2 . ">Authorized<br>");
print("<input type=\"radio\" name=\"utype\" value=3" . $type3 . ">Basic<br>");
echo "<input type=submit value=Submit>";
echo "</td></tr></table><br>";
echo "<font color=red>Be sure that you do not give a user admin access by mistake!</font>";
}
else {
echo "<table width=100% border=0><tr><td valign=\"top\" width=75%>";
echo "Username: ".$navn[0]."<br>";
echo "Email : ".$mail[0]."<br>";
echo "Type: Admin"."<br>";
echo "</td>";
echo "<td valign=\"top\" width=25%>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td>";
echo "</td></tr></table>";
}
?>
<br><br><br>
<a href="admin.php">Back to admin page</a>
</body>
</html>
<?php
}
?>
--------------------------------------------------------
Håber ikke at det var en alt for tør omgang!!!
mvh.
Hathor
