codice:
<?
include("config.inc.php");
session_register('password');
if(!$password){
echo "
<script language='JavaScript'>
window.top.location = 'index.php';
</script>
";
exit;
}
if($form == "inviata"){
if(trim ($campo1) != ""){
$campo1 = str_replace("\<","<",$campo1);
$campo1 = str_replace("\>",">",$campo1);
$campo2 = str_replace("\>",">",$campo2);
$campo2 = str_replace("\<","<",$campo2);
$campo3 = str_replace("\>",">",$campo3);
$campo3 = str_replace("\<","<",$campo3);
if(!$id){
$query = "INSERT INTO pagine (sezione,campo1,campo2,campo3,livelli) VALUES ('$sezione','$campo1','$campo2','$campo3','$livelli','0')";
}
else{
$query = "UPDATE pagine SET sezione='$sezione',campo1='$campo1',campo2='$campo2',campo3='$campo3' where id='$id'";
}
if (mysql_query($query, $db)){
$last_id = mysql_insert_id();
}
echo "
<script language='JavaScript'>
this.location = 'pagine.php';
</script>
";
exit;
}
else{
$message = "Si è verificato un errore durante l'operazione";
}
}
if($id and $message == ""){
$query = "SELECT * FROM pagine where id='$id'";
$result=mysql_query($query, $db);
while ($row = mysql_fetch_array($result))
$campo1=$row[campo1];
$campo2 = $row[campo2];
$campo3 = $row[campo3];
}
?>
<html>
<script language='Javascript'>
function popwin(url){
myRemote = window.open(url,"newwin","width=500,height=550,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=no,copyhistory=no");
myRemote.focus()
}
</script>
<body bgcolor='#FFFFFF'>
<form method=post action="add_pagina.php" enctype="multipart/form-data">
<input type='hidden' name='form' value='inviata'>
<input type='hidden' name='id' value='<? echo $id; ?>'>
<table width='50%' border=0 cellpadding=0 cellspacing=0 bgcolor='#FFFFFF'>
<tr>
<td>
<? echo "<font size='1' color='#333333' face='verdana,arial'>$message</font>"; ?>
<table width='100%' border=1 cellpadding=0 cellspacing=0 bgcolor='#F0F8FF'>
<tr>
<td colspan=2 bgcolor='#D2E9FF'>
<font size='1' color='#333333' face='verdana,arial'>Aggiunta Pagina</font>
</td>
</tr>
<tr>
<td width='50%'>
<font size='1' color='#333333' face='verdana,arial'>Sezione</font>
</td>
<td width='50%'>
<select name="sezione" style="width:425;">
<?
$query = "SELECT * FROM sezioni";
$result=mysql_query($query, $db);
while ($row = mysql_fetch_array($result)) {
if($row[nome_sezione] == $nome_sezione){
echo"
<option name='sezione' value='$row[id]' selected>$row[nome_sezione]</option>
";
}
else{
echo"
<option name='sezione' value='$row[id]'>$row[nome_sezione]</option>
";
}
}
?>
</select>
</td>
</tr>
<tr>
<td width='50%'>
<font size='1' color='#333333' face='verdana,arial'>Title</font>
</td>
<td width='50%'>
<input type='text' name='campo1' value="<? echo $campo1 ?>" maxlength='500' style="width:425;">
</td>
</tr>
<tr>
<td width='50%'>
<font size='1' color='#333333' face='verdana,arial'>campo2</font>
</td>
<td width='50%'>
<input type='text' name='campo2' value="<? echo $campo2 ?>" maxlength='300' style="width:425;">
</td>
</tr>
<tr>
<td width='50%'>
<font size='1' color='#333333' face='verdana,arial'>campo3</font>
</td>
<td width='50%'>
<input type='text' name='description' value="<? echo $campo3 ?>" maxlength='600' style="width:425;">
</td>
</tr>
<tr>
<td colspan=2 align='right'>
<input type='submit' value='invia'>
</td>
</tr>
<tr>
<td height='20' bgcolor='#D2E9FF' colspan=2 align='right'>
<font size='1' color='#333333' face='verdana,arial'>Panel Admin</font>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
ci dareste una controllatina?