26/02/2008, 09:28
|
| | | Fecha de Ingreso: agosto-2007 Ubicación: Quito - Ecuador
Mensajes: 1.720
Antigüedad: 17 años, 3 meses Puntos: 28 | |
Re: Fallo en envio de cabezeras Código PHP: <?php require_once('../Connections/connect.php'); ?>
<?php
include_once("fckeditor/fckeditor.php") ;
?>
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$ediciondir= '../imgprod/';
$uploaddir=$ediciondir;
if (!is_dir($ediciondir)) { mkdir($uploaddir, 0777); }
move_uploaded_file($_FILES['imagen']['tmp_name'], $uploaddir . $_FILES['imagen']['name']);
$filename = $_FILES['imagen']['name'];
$ediciondir= '../ficha/';
$uploaddir=$ediciondir;
if (!is_dir($ediciondir)) { mkdir($uploaddir, 0777); }
move_uploaded_file($_FILES['ficha']['tmp_name'], $uploaddir . $_FILES['ficha']['name']);
$filename2 = $_FILES['ficha']['name'];
$insertSQL = sprintf("INSERT INTO productos (Id_categoria, Id_marca, nombre, codigo, uso, descripcion, tipo, imagen, ficha, status) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['Id_categoria'], "int"),
GetSQLValueString($_POST['Id_marca'], "int"),
GetSQLValueString($_POST['nombre'], "text"),
GetSQLValueString($_POST['codigo'], "text"),
GetSQLValueString($_POST['uso'], "text"),
GetSQLValueString($_POST['descripcion'], "text"),
GetSQLValueString($_POST['tipo'], "text"),
GetSQLValueString($filename, "text"),
GetSQLValueString($filename2, "text"),
GetSQLValueString($_POST['status'], "text"));
mysql_select_db($database_connect, $connect);
$Result1 = mysql_query($insertSQL, $connect) or die(mysql_error());
$insertGoTo = "list_prod.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
mysql_select_db($database_connect, $connect);
$query_Recordset1 = "SELECT * FROM categoria";
$Recordset1 = mysql_query($query_Recordset1, $connect) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
mysql_select_db($database_connect, $connect);
$query_Recordset2 = "SELECT * FROM marca WHERE Id_categoria =".$row_Recordset1['id'];
$Recordset2 = mysql_query($query_Recordset2, $connect) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);
?>
<table width="500" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><img src="images/header.jpg" width="500" height="200"></td>
</tr>
<tr>
<td align="center"><span class="style2">Ingresar Productos</span></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><TABLE width=500 border=0 align="center" cellPadding=0 cellSpacing=0 bordercolor="#FF0000" id=table2>
<TBODY>
<TR>
<TD width="8" vAlign=top ></TD>
<TD width=498 align="center" vAlign=middle class="nucomplet"><form action="<?php echo $editFormAction; ?>" method="post" enctype="multipart/form-data" name="form1" onSubmit="MM_validateForm('descripcion','','R');return document.MM_returnValue">
<table width="414" align="center">
<tr valign="baseline">
<td width="96" align="right" valign="middle" nowrap class="textoINDEX"><div align="left">Categoria: </div></td>
<td width="306" valign="middle" class="textoINDEX"><div align="left">
<select name="Id_categoria" class="todopanel" id="Id_categoria">
<?php
do {
?>
<option value="<?php echo $row_Recordset1['Id_categoria']?>"><?php echo $row_Recordset1['nombre']?></option>
<?php
} while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
$rows = mysql_num_rows($Recordset1);
if($rows > 0) {
mysql_data_seek($Recordset1, 0);
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
}
?>
</select>
</div></td>
</tr>
<tr valign="baseline">
<td align="right" valign="middle" nowrap class="textoINDEX"><div align="left">Marca</div></td>
<td align="left" valign="middle" class="textoINDEX"><div align="left">
<select name="Id_marca" class="todopanel" id="Id_marca">
<?php
do {
?>
<option value="<?php echo $row_Recordset2['Id_marca']?>"><?php echo $row_Recordset2['nombre']?></option>
<?php
} while ($row_Recordset2 = mysql_fetch_assoc($Recordset2));
$rows = mysql_num_rows($Recordset2);
if($rows > 0) {
mysql_data_seek($Recordset2, 0);
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
}
?>
</select>
</div></td>
</tr>
<tr valign="baseline">
<td align="right" valign="middle" nowrap class="textoINDEX"><div align="left">Nombre:</div></td>
<td valign="middle" class="textoINDEX"><div align="left">
<input name="nombre" type="text" class="todopanel">
</div></td>
</tr>
<tr valign="baseline">
<td align="right" valign="middle" nowrap class="textoINDEX"><div align="left">Codigo</div></td>
<td align="left" valign="middle" class="textoINDEX"><input type="text" name="codigo" id="codigo">
</label></td>
</tr>
<tr valign="baseline">
<td align="right" valign="middle" class="textoINDEX"><div align="left">Uso</div></td>
<td align="left" valign="middle" class="textoINDEX"><input type="text" name="uso" id="uso"></td>
</tr>
<tr valign="baseline">
<td align="right" valign="middle" class="textoINDEX"><div align="left">Descripción</div></td>
<td align="left" valign="middle" class="textoINDEX"><?php
$oFCKeditor = new FCKeditor('descripcion') ;
$oFCKeditor->BasePath = 'fckeditor/' ;
$oFCKeditor->Value = '<p></p>' ;
$oFCKeditor->Create() ;
?></td>
</tr>
<tr valign="baseline">
<td align="right" valign="middle"><div align="left">
<p>Tipo</p>
</div></td>
<td valign="middle" ><div align="left">
<input type="text" name="tipo" id="tipo">
</div></td>
</tr>
<tr valign="baseline">
<td align="right" valign="middle" class="textoINDEX"><div align="left">Ficha</div></td>
<td valign="middle"><div align="left">
<input name="ficha" type="file" id="ficha" enctype="multipart/form-data">
</div></td>
</tr>
<tr valign="baseline">
<td align="right" valign="middle"><div align="left">Imagen:</div></td>
<td valign="middle" class="textoINDEX"><div align="left">
<input name="imagen" type="file" enctype="multipart/form-data">
</div></td>
</tr>
<tr valign="baseline">
<td align="left" valign="middle">Status</td>
<td valign="middle"><label>
<select name="status" id="status">
<option>0</option>
<option value="Impresión una cara">1</option>
<option value="Impresión doble cara">2</option>
<option value="Laminado">3</option>
</select>
</label></td>
</tr>
<tr valign="baseline">
<td align="right" valign="middle" class="Estilo6"><div align="left">
<input type="hidden" name="MM_insert" value="form1">
</div></td>
<td valign="middle"><div align="left"></div></td>
</tr>
<tr valign="baseline">
<td nowrap align="right"> </td>
<td><div align="left">
<input name="submit" type="submit" class="todopanel" value="Insertar registro">
</div></td>
</tr>
</table>
</form></TD>
<TD width=13 vAlign=top> </TD>
</TR>
</TBODY>
</TABLE></td>
</tr>
<tr>
<td><img src="images/footer.jpg" width="500" height="8"></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
</table>
</body>
<?php
mysql_free_result($Recordset1);
mysql_free_result($Recordset2);
?>
__________________ Diseño gráfico, Web, imagen corporativa, publicidad ... |