Mangler hjælp til denne kode fra min retprofil side..
Jeg har problemer med denne kode.Jeg kan sagtens få hentet oplysningerne fra databasen, men den gider ikke gemme det igen?
Kan i hjælpe mig?
<div class="center">
<div style="margin: 1px;background: #F6F6F6 url('heeeh.jpg');color:#fff;font-weight:bold;"><div style="padding: 5px;">
Min side</div></div></div>
<div style="padding: 5px;">
<?
if($_SESSION["id"] != "" AND $_SESSION["username"] != "" AND $_SESSION["email"] != "" AND $_SESSION["rank"] > 1) {
?>
<div style="float:right;margin-left:5px;clear:both;">
<div class="rightmenu">
<div style="margin: 1px;background-color: #F6F6F6;">
<div style="margin-bottom: 5px;background: #F6F6F6 url('heeeh.jpg');color:#fff;border-bottom:1px solid #fff;font-weight:bold;"><div style="padding: 5px;">
Menu<br />
</div></div><div id="menu10"><div style="padding: 5px;padding-top:0px;">
<?
echo "<a href=\"?p=mypage\">Min profil</a><br />";
echo "<a href=\"?p=mypage&o=edit\">Opdater oplysninger</a><br /><br />";
echo "<a href=\"?p=search\">Søg</a><br /><br />";
echo "<a href=\"?p=mailbox&o=incoming\">Indbakke</a><br />";
echo "<a href=\"?p=mailbox&o=outgoing\">Udbakke</a><br />";
echo "<a href=\"?p=mailbox&o=newpm\">Ny pm</a><br /><br />";
if($_SESSION["rank"] >= 3) {
echo "<a href=\"?p=mypage&o=todo\">Todo</a><br />";
echo "<a href=\"?p=mypage&o=news\">Nyheder</a><br />";
echo "<a href=\"?p=mypage&o=categories\">Kategorier</a><br />";
echo "<a href=\"?p=mypage&o=shout\">Shout-tekst</a><br />";
echo "<a href=\"?p=mypage&o=users\">Brugere</a><br />";
echo "<a href=\"?p=mypage&o=articles\">Artikler</a><br />";
echo "<a href=\"?p=mypage&o=links\">Links</a><br /><br />";
}
echo "</div></div></div></div></div>";
if($_GET["o"] == "") {
echo "Hej ".$_SESSION["username"];
}elseif($_GET[o] == "todo" AND $_SESSION["rank"] >= 3) {
connect();
if($_POST[todo_text] != "" AND $_POST[todo_link] != "") {
mysql_query("UPDATE admin_stuff SET text='$_POST[todo_text]', link='$_POST[todo_link]' WHERE id='1'");
}elseif($_POST[todo_text] == "" AND $_POST[todo_link] == "") {
echo "Du mangler at indtaste noget i feltet.";
}
$res = mysql_query("SELECT * FROM admin_stuff WHERE id='1'");
$row = mysql_fetch_array($res);
echo "<form action=\"./?p=mypage&o=todo\" method=\"post\">";
echo "<table style=\"width:100px;\">";
echo "<tr><td>Titel</td><td><input type=\"text\" name=\"todo_text\" value=\"".$row[text]."\"></td></tr>";
echo "<tr><td>Link</td><td><input type=\"text\" name=\"todo_link\" value=\"".$row[link]."\"></td></tr>";
echo "<tr><td><input type=\"submit\" value=\"Opdater\"></td></tr>";
echo "</table>";
echo "</form>";
}elseif($_GET["o"] == "edit") {
connect();
if($_POST["edit_update"] == "update") {
if($_POST["edit_passworda"] OR $_POST["edit_passwordb"] OR $_POST["edit_showemail"] OR $_POST["edit_newsletter"] OR $_POST["edit_realname"] OR $_POST["edit_location"] OR $_POST["edit_homepage"] OR $_POST["edit_msn"] OR $_POST["edit_yim"] OR $_POST["edit_aim"] OR $_POST["edit_icq"] OR $_POST["edit_signature"] OR $_POST["edit_description"]) {
$date = mktime(0,0,0,$_POST["month"],$_POST["date"],$_POST["year"]);
$realname = stripslashes(strip_tags($_POST["edit_realname"]));
$location = stripslashes(strip_tags($_POST["edit_location"]));
$msn = stripslashes(strip_tags($_POST["edit_msn"]));
$aim = stripslashes(strip_tags($_POST["edit_aim"]));
$yim = stripslashes(strip_tags($_POST["edit_yim"]));
$icq = stripslashes(strip_tags($_POST["edit_icq"]));
$www = strip_tags($_POST["edit_homepage"]);
$description = strip_tags($_POST["edit_description"]);
$signature = strip_tags($_POST["edit_signature"]);
if ($_POST["edit_newsletter"] == 1) {
$newsletter = 1;
}
else {
$newsletter = 0;
}
$month_1 = 31;
$month_2 = 29;
$month_3 = 31;
$month_4 = 30;
$month_5 = 31;
$month_6 = 30;
$month_7 = 31;
$month_8 = 31;
$month_9 = 30;
$month_10 = 31;
$month_11 = 30;
$month_12 = 31;
$month_calc = $$_POST[birth_m];
if($_POST[birth_d] <= $month_calc) {
if($_POST["edit_passworda"] == $_POST["edit_passwordb"] AND $_POST["edit_passworda"] != ""){
$mdfive = md5($_POST["edit_passworda"]);
mysql_query("UPDATE users SET password='$mdfive' WHERE id='$_SESSION[id]'") or die(mysql_error());
}elseif($_POST["edit_passworda"] != "" OR $_POST["edit_passworda"] != $_POST["edit_passwordb"]){
$errortext1 = "De to indtastede kodeord var ikke ens.";
}
$format_signature = format($signature);
$format_description = format($description);
mysql_query("UPDATE users SET newsletter='$newsletter',showemail='$_POST[edit_showemail]', msn='$msn', icq='$icq', yim='$yim', aim='$aim', signature='$format_signature', realname='$realname', birth_d='$_POST[birth_d]', birth_m='$birth_m', birth_y='$birth_y', location='$location', description='$format_description', homepage='$www' WHERE id='$id'") or die(mysql_error());
}else{
$errortext = "Du har indtastet forkert fødselsdags dato";
}
}else{
$errortext = "Du skal udfylde nogle felter før du kan opdatere dine oplysninger";
}
}
$res = mysql_query("SELECT * FROM users WHERE id='$id'");
$row = mysql_fetch_array($res);
echo "<table style=\"width:400px;\">";
echo "<form action=\"./?p=mypage&o=edit\" method=\"POST\">";
echo "<tr>";
echo "<td>Brugernavn:</td><td style=\"width:150px;\"><input type=\"text\" name=\"edit_username\" value=\"".$row[username]."\" disabled=\"disabled\" /></td><td></td>";
echo "</tr><tr>";
echo "<td>Kodeord:</td><td><input type=\"password\" name=\"edit_passworda\" value=\"\" /></td><td>(Lad felterne være tomme hvis ikke du vil ændre dit kodeord)</td>";
echo "</tr><tr>";
echo "<td>Kodeord igen:</td><td><input type=\"password\" name=\"edit_passwordb\" value=\"\" /></td><td>"; if($errortext1 != ""){ echo "<font style=\"color: #CC0000;\">(".$errortext1.")</font>"; }else{ echo "(For at sikre du har tastet rigtigt)"; } echo "</td>";
echo "</tr><tr>";
echo "<td><br /> </td></tr><tr>";
echo "<td>Navn:</td><td><input type=\"text\" name=\"edit_realname\" value=\"".$row[realname]."\" /></td><td></td>";
echo "</tr><tr>";
echo "<td>Alder:</td><td>";
echo "<select name=\"birth_d\">";
$d = 1;
while($d <= 31) {
echo "<option value='".$d."'";
if ($d == $row['birth_d']) { echo " selected"; }
echo ">".$d."</option>";
$d = $d+1;
}
echo "</select>";
echo "<select name=\"birth_m\">";
$m = 1;
while($m <= 12) {
echo "<option value=\"".$m."\"";
if ($m == $row['birth_m']) { echo " selected"; }
echo ">".$m."</option>";
$m = $m+1;
}
echo "</select>";
echo "<select name=\"birth_y\">";
$y = 1930;
while($y <= 2000) {
echo "<option value=\"".$y."\"";
if ($y == $row['birth_y']) { echo " selected"; }
echo ">".$y."</option>";
$y = $y+1;
}
echo "</select>";
echo "</td><td>(dd/mm/yyyy)</td>";
echo "</tr><tr>";
echo "<td>Bopæl:</td><td><input type=\"text\" name=\"edit_location\" value=\"".$row[location]."\" /></td><td></td>";
echo "</tr><tr>";
echo "<td>Hjemmeside:</td><td><input type=\"text\" name=\"edit_homepage\" value=\"".$row[homepage]."\" /></td><td>(husk http://)</td>";
echo "</tr><tr>";
echo "<td>Windows IM:</td><td><input type=\"text\" name=\"edit_msn\" value=\"".$row[msn]."\" /></td><td></td>";
echo "</tr><tr>";
echo "<td>Yahoo IM:</td><td><input type=\"text\" name=\"edit_yim\" value=\"".$row[yim]."\" /></td><td></td>";
echo "</tr><tr>";
echo "<td>AOL IM:</td><td><input type=\"text\" name=\"edit_aim\" value=\"".$row[aim]."\" /></td><td></td>";
echo "</tr><tr>";
echo "<td>ICQ:</td><td><input type=\"text\" name=\"edit_icq\" value=\"".$row[icq]."\" /></td><td></td>";
echo "</tr><tr>";
echo "<td>Signatur:</td><td><input type=\"text\" name=\"edit_signature\" value=\"".$row[signature]."\" maxlength=\"255\" /></td><td> (Her kan der bruges tekstkoder)</td>";
echo "</tr><tr>";
echo "<td>Nyhedsbrev:</td><td><input name=\"edit_newsletter\" value=\"1\" type=\"radio\" "; if($row[newsletter] == 1){ echo "checked=\"checked\""; } echo " >Ja <input name=\"edit_newsletter\" value=\"0\" type=\"radio\" "; if($row[newsletter] == 0){ echo "checked=\"checked\""; } echo " >Nej</td><td></td>";
echo "</tr><tr>";
echo "<td>Vis email:</td><td><input name=\"edit_showemail\" value=\"1\" type=\"radio\" "; if($row[showemail] == 1){ echo "checked=\"checked\""; } echo " \" >Ja <input name=\"edit_showemail\" value=\"0\" type=\"radio\""; if($row[showemail] == 0){ echo "checked=\"checked\""; } echo ">Nej</td>";
echo "</tr>";
echo "</table>";
echo "<table style=\"width:420px;\">";
echo "<tr><td>Fritekst:</td><td> (Her kan der bruges tekstkoder)</td></tr>";
echo "<tr><td></td><td><textarea name=\"edit_description\" rows=\"0\" cols=\"0\" style=\"width: 70%; height: 100px;margin-top:2px;\">".$row[description]."</textarea></td></tr>";
echo "</table>";
echo "<input type=\"hidden\" name=\"edit_update\" value=\"update\" />";
echo "<input type=\"submit\" value=\"Udfør\" class=\"submit\" style=\"float:left;\" />";
echo "</form>";
}
}else{
echo "Du skal være logget ind for at benytte denne side.";
}
?>
</div>
Mange tak --