79 lines
3.2 KiB
PHP
79 lines
3.2 KiB
PHP
<?
|
|
require( "../addons/open_db.php" );
|
|
require( "../addons/autenticate.php" );
|
|
if ( ! $user_auth ) die( "<META CONTENT=\"0; URL=..\error.htm\" HTTP-EQUIV=\"REFRESH\"> ");
|
|
|
|
if ( !empty($imgData_name) && isset( $idd ) && isset( $img ) )
|
|
{
|
|
if ( $imgData_size > 0 )
|
|
{
|
|
$img_prop = GetImageSize($imgData);
|
|
$imgW = $img_prop[0]; $p_imgW = $imgW;
|
|
$imgH = $img_prop[1]; $p_imgH = $imgH;
|
|
$fsize = filesize($imgData);
|
|
fwrite( fopen( "../db/discos/".$idd."_".$img."_".$imgData_name, "wb" ),
|
|
fread(fopen($imgData,"rb"), $fsize), $fsize);
|
|
} else {
|
|
if ( strcmp($imgData_name, "ninguna" ) != 0 ) die("<script language=\"javascript\">window.close();</script>");
|
|
$data = "";
|
|
$imgW = 0;
|
|
$imgH = 0;
|
|
$img_prop = "";
|
|
}
|
|
|
|
$res = @mysql_query( "SELECT file FROM extrasDiscos WHERE idd=$idd AND tipo='F' AND id_data='$img'", $conexion );
|
|
if ( @mysql_num_rows( $res ) > 0 )
|
|
{
|
|
$db_file = mysql_fetch_array( $res );
|
|
unlink("../db/discos/".$idd."_".$img."_".$db_file[0] );
|
|
$sql_upd = "UPDATE extrasDiscos SET file = '$imgData_name', W='$imgW', H='$imgH'" .
|
|
" WHERE id = ".$idd;
|
|
$res = mysql_query( $sql_upd, $conexion ) OR die("No puedo modificar esta foto<br>$sql_upd<br>".mysql_error($conexion));
|
|
}else{
|
|
@mysql_query( "INSERT INTO extrasDiscos (file, W, H, idd, tipo, id_data) VALUES ".
|
|
" ('$imgData_name', '$imgW', '$imgH', '$idd', 'F', '$img') ", $conexion );
|
|
}
|
|
mysql_close($conexion);
|
|
echo "<html><head></head><body onload='window.close();'><p>Procesando petición.<br>Por favor, espere...<br></body></html>";
|
|
} else {
|
|
?>
|
|
<html>
|
|
<head>
|
|
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
|
<title>Portal -web- ------------------------------------------------------------- -www.infdj.com- ---------------------------------------------------------------------------------------------------- </title>
|
|
<link href="skins/articulos.ico" rel="SHORTCUT ICON">
|
|
<link rel="stylesheet" type="text/css" href="../addons/estilo.css" body="../addons/estilo.css">
|
|
|
|
<body background="../images/bg.gif" bgcolor="<?echo $bg_color ?>" text="#000000">
|
|
|
|
<div align="center"><center>
|
|
<table border="0" cellpadding="0" cellspacing="0" width="340">
|
|
<?
|
|
if ( !isset( $idd ) )
|
|
{
|
|
echo "<tr><td>";
|
|
echo "<br>Error procesando su petición.<br><li>ACCESO DENEGADO</li>";
|
|
echo "</td></tr>";
|
|
} else {
|
|
echo "<tr></tr>";
|
|
?>
|
|
<u>Cambiar o Agregar foto:</u><img src="../images/box.gif"
|
|
align="left" hspace="0" width="100" height="98"><br><br>
|
|
<li>Pulse examinar y busque la imagen en su
|
|
equipo.</li>
|
|
<li>Envie la imagen al servidor.</li>
|
|
<br><br>Este proceso puede tardar varios minutos
|
|
dependiendo de su conexión y el tráfico.
|
|
<?
|
|
echo "<tr><td><form ACTION=\"$PHP_SELF?idd=$idd&img=$img\" method=\"POST\" enctype=\"multipart/form-data\">";
|
|
echo "<INPUT TYPE=\"hidden\" name=\"MAX_FILE_SIZE\" value=\"300000\"><input type=\"file\" size=\"15\" name=\"imgData\">";
|
|
echo " <input type=\"image\" name=\"I2\" src=\"../images/enviar.gif\" align=\"absmiddle\" width=\"69\" height=\"14\" border=\"0\">";
|
|
echo "</form></td></tr>";
|
|
}
|
|
?>
|
|
</table>
|
|
</center></div>
|
|
|
|
</body>
|
|
</html>
|
|
<? } ?>
|