if ( $user_auth && $user_level <= -1 )
{
$blq1 ="anunciante, descr, url, tipo, nVistos, nVisitas, filename";
$list = true;
if ( isset( $sins ) )
{
displayForm( "./?dgo=adm/publicidad.php&ins=new" );
$list = false;
}
if ( isset( $smod ) )
{
$res = @mysql_query( "SELECT id,$blq1 FROM publicidad WHERE id=$smod", $conexion );
$datos = @mysql_fetch_array( $res );
list( $db_id, $db_anunciante, $db_descr, $db_url, $db_tipo, $db_nVistos, $db_nVisitas, $db_filename ) =$datos;
displayForm( "./?dgo=adm/publicidad.php&mod=$smod" );
$list = false;
}
if ( isset( $mod ) )
{
if ( !empty($imgData_name) && $imgData_size > 0 )
{
/*
$img_prop = GetImageSize($imgData);
$db_Foto_w = $img_prop[0];
$db_Foto_h = $img_prop[1];
*/
$addsql_p1 = ",filename='$imgData_name'"; //, Foto_w='$db_Foto_w', Foto_h='$db_Foto_h'";
}
$sql = "UPDATE publicidad SET ".
"anunciante='$db_anunciante' ".
",url='$db_url' ".
",tipo='$db_tipo' ".
",descr='$db_descr' $addsql_p1".
" WHERE id=$mod";
$res = @mysql_query( $sql, $conexion ) OR die("eror");
if ( !empty($imgData_name) && $imgData_size > 0 )
{
$file_size = filesize($imgData);
$imgDEL = "db/publicidad/$mod"."_i001@*";
echo `rm -rf $imgDEL`;
fwrite( fopen("db/publicidad/".$mod."_i001@$imgData_name", "wb"),
fread(fopen($imgData,"rb"),$file_size), $file_size);
}
$list = true;
}
if( isset( $ins ) )
{
if ( !empty($imgData_name) && $imgData_size > 0 )
{
$img_prop = GetImageSize($imgData);
/*
$db_Foto_w = $img_prop[0];
$db_Foto_h = $img_prop[1];
$addsql_p1 = ",Foto_mime, Foto_w, Foto_h";
*/
$addsql_p2 = ",'$imgData_name'";//, '$db_Foto_w', '$db_Foto_h'";
}
$sql = "INSERT INTO publicidad (FAlta, $blq1 $addsql_p1) VALUES ".
"(NOW(),'$db_anunciante','$db_descr','$db_url','$db_tipo','0','0','$imgData_name')";
$res = @mysql_query( $sql, $conexion ) OR die( "Error
".@mysql_error($conexion) );
if ( !empty($imgData_name) && $imgData_size > 0 )
{
$file_size = filesize($imgData);
$last_id = @mysql_insert_id($conexion);
fwrite( fopen("db/publicidad/".$last_id."_i001@$imgData_name", "wb"),
fread(fopen($imgData,"rb"),$file_size), $file_size);
}
echo "
ID asignado = ".@mysql_insert_id($conexion)."
"; $list = true; } if( isset( $del ) ) { $imgDEL = "db/publicidad/$del"."_i001*"; echo `rm -rf $imgDEL`; $res = @mysql_query( "DELETE FROM artistas WHERE id=$del" ); $list = true; } if ( isset( $list ) && $list ) displayList($conexion); displayMenu(); } function displayList($cnx, $orderBy, $orderDir) { $thisLOCATION = "./?dgo=adm/publicidad.php"; $res = @mysql_query( "SELECT id, anunciante, descr, nVistos, nVisitas FROM publicidad", $cnx ); echo "id | ". "Anunciante | ". "Descripción | ". "Vistos / Visitas | ". "Borrar | "; while( $datos=@mysql_fetch_array($res) ) { list ( $db_id, $db_anunciante, $db_descr, $db_nVistos, $db_nVisitas )= $datos; echo "
$db_id | ". "$db_anunciante | $db_descr | $db_nVistos / $db_nVisitas | ![]() |