<%@ $Language=JScript /* PARA COLORES PHP */ %><% @set_time_limit(7200); //2 horas include("../includes/DB_Conectar.php"); /*toma la seguridad de la página imagenes_borrar.php*/ $admABMLink_manual="imagenes_borrar.php"; include("../includes/inc_auth.php"); include("../includes/funciones.php"); /*Datos para crear Thumbnail de la imagen*/ $basedir = "$app_path/ADVF/imagenes/"; $resolution = "100x100"; $resolutionNT=100; /*********/ switch($tipo){ case 'F': $titulo = $I_uploadimages; $col1 = $I_imagepath; $col2 = $I_name; $col3 = $I_category; $col4 = $I_capturedate; if ($OS=="Windows_NT") { $extensiones = "JPG or JPEG"; } else { $extensiones = "JPG, JPEG, GIF or PNG"; } $directorio = "imagenes"; $err1 = $I_name; $advTipo = "F"; $tam_maximo= 310000; break; case 'A': $titulo = $I_uploadaudiofiles; $col1 = $I_audiofilepath; $col2 = $I_title; $col3 = $I_category; $col4 = $I_capturedate; $extensiones = "MP3, MID, WAV"; $directorio = "audios"; $err1=$I_title; $advTipo = "A"; $tam_maximo= 2000000; break; case 'V': $titulo = $I_uploadvideofiles; $col1 = $I_videofilepath; $col2 = $I_title; $col3 = $I_category; $col4 = $I_capturedate; $extensiones = "AVI, MOV, MPG"; $directorio = $I_videos; $err1=$I_title; $advTipo = "V"; $tam_maximo= 2000000; break; case 'D': $titulo = $I_uploaddocuments; $col1 = $I_documentpath; $col2 = $I_name; $col3 = $I_category; $col4 = $I_capturedate; $extensiones = "PDF, DOC, XLS, PPT"; $directorio = "documentos"; $err1=$I_name; $advTipo = "D"; $tam_maximo= 1000000; break; case 'Z': $titulo = $I_uploadcompressedfiles; $col1 = $I_filepath; $col2 = $I_name; $col3 = $I_category; $col4 = $I_capturedate; $extensiones = "ZIP, RAR"; $directorio = "zip"; $err1="name"; $advTipo = "Z"; $tam_maximo= 1000000; break; } %> <%=$I_administration%> <% $uploadDir = $app_path . "ADVF/$directorio/"; $UploadOK = false; $MAXBATCH = 1; if ($Action=="Upload"){ for ($i=1; $i<=$MAXBATCH; $i++) { if (phpversion() < 4) { $upload = $HTTP_POST_VARS["upload${i}"]; $tmp_name = $upload; $tam = $HTTP_POST_VARS["upload${i}_size"]; $nom = $HTTP_POST_VARS["upload${i}_name"]; } else { $upload = $HTTP_POST_FILES["upload${i}"]; $tmp_name = $HTTP_POST_FILES["upload${i}"]["tmp_name"]; $tam = $HTTP_POST_FILES["upload${i}"]["size"]; $nom = $HTTP_POST_FILES["upload${i}"]["name"]; } $epigraf = $HTTP_POST_VARS["epigraf${i}"]; $epigraf_ia = $HTTP_POST_VARS["epigraf_ia${i}"]; $categ = $HTTP_POST_VARS["categ${i}"]; $diac = $HTTP_POST_VARS["diac${i}"]; $mesc = $HTTP_POST_VARS["mesc${i}"]; $yearc = $HTTP_POST_VARS["yearc${i}"]; if ($tam > $MAX_FILE_SIZE) { $msje="$I_errorthefileisbigger $MAX_FILE_SIZE bytes."; %>

<%=$titulo%>

<%=$msje%> <%=$I_back%>

<%die(); } if ($tmp_name != "none" && $tmp_name != "") { // chequeo la extension: $ext = StrToLower(SubStr($nom, StrRPos($nom, ".") + 1)); if (($ext!="gif" && $ext!="jpg" && $ext!="png" && $ext!="jpeg" && $tipo=="F") || ($ext!="mp3" && $ext!="mid" && $ext!="wav" && $tipo=="A") || ($ext!="avi" && $ext!="mov" && $ext!="mpg" && $tipo=="V") || ($ext!="pdf" && $ext!="doc" && $ext!="ppt" && $ext!="xls" && $tipo=="D") || ($ext!="zip" && $ext!="rar" && $tipo=="Z")) { $msje="$I_invalidfileformat : $ext. $I_itmustbe $extensiones."; %> <%=$msje%> <%=$I_back%>

<%die(); } //$dest = $uploadDir . $nom; $uniqid = uniqid(""); $dest = $uploadDir . "${uniqid}.${ext}"; $site_path = "ADVF/$directorio/${uniqid}.${ext}"; $srcimage = $uniqid.".".$ext; if ($categ == "null") { $msje="$I_errorselectcategory $nom."; %> <%=$msje%> <%=$I_back%>

<%die(); } if (trim($epigraf) == "") { $msje="$I_errorfillinthe $err1: $nom."; %> <%=$msje%> <%=$I_back%>

<%die(); } $valida = checkdate($mesc,$diac,$yearc); if (!$valida && $yearc != ""){ $msje="$I_errorinvalidcapturedate $diac-$mesc-$yearc ."; %> <%=$msje%> <%=$I_back%>

<%die(); } else { $advFechaCaptura = $yearc. "-" . $mesc ."-". $diac; } //me fijo si hay otro igual cargado $sql="select count(*) as cant from ADVF where advTitulo='$epigraf' and advBytes='$tam'"; $rscomp=$conn->execute($sql); if($rscomp->field(cant)>0){ //Ya fue subido el archivo $msje="$I_errorthefileisyet"; %> <%=$msje%> <%=$I_back%>

<%die(); } $sql = "insert into ADVF (advTipo, advTitulo, advTitulo_IA, advFecha, advLink, catID, advBytes, advFechaCaptura, advAutor) values ('$advTipo', '$epigraf', '$epigraf_ia', '$condate', '$site_path', $categ, '$tam','$advFechaCaptura','$usradID')"; //echo "$sql
"; $conn->Execute ($sql); //copio el temporal a dest: @unlink($dest); //por si existe uno anterior, aunque es imposible if (@copy($tmp_name, $dest)){ $msje="$I_uploaded"; //crea Thumnail si es tipo imagen if($advTipo=="F"){ $tnimage = GetThumbnailName($srcimage, $resolution); if ($OS=="Windows_NT") { //Detecta si es NT o linux y utiliza diferentes metodos de thumbnailing genthumbnail($basedir . $srcimage,$resolutionNT,$basedir,$tnimage); } else { $mycmd="/cgi-bin/thumber.pl?op=-geometry&arg=${resolution}&in=${basedir}${srcimage}&out=${basedir}${tnimage}"; //echo $mycmd; virtual($mycmd); } } %> <% $UploadOK = true; } else{ $msje="1: $I_uploadfailed"; %> <%=$msje%> <% $perms = @fileperms($uploadDir); $owner = @fileowner($uploadDir); if (!$perms){ %>
2: <%=$I_thefolder%> <%=$uploadDir%> <%=$I_notexist%>
<% } else{ $myuid = getmyuid(); $perms = @fileperms($dest); $owner = @fileowner($dest); echo "perms: '$perms'
"; echo "owner: '$owner'
"; echo "myuid: '$myuid'
"; if (!($perms & 2) && !(($owner == $myuid) && ($perms & 128))){ echo "3: $I_user '" . get_current_user() . "' $I_havenotpermision $dest
\n"; } } %>
<% } } else { if ($tam > 0) { %> 4: <%=$I_uploadfailed%>

<% } } } %> <% } %>   <% // cargo las categorias: $sqlCateg = "select * from ADVF_Categorias order by catNombre"; $rsCateg = $conn->Execute($sqlCateg); $cmboCateg = "";//"\n"; while (!$rsCateg->eof) { $catID = $rsCateg->Field("catID"); $catNombre = $rsCateg->Field("catNombre"); $cmboCateg .= "\n"; $rsCateg->MoveNext(); } %> > <% for ($j=1; $j<=$MAXBATCH; $j++) { $array_fecha=explode("-",substr($condate,0,10)); %> > > > <% } %>
  <%=$col1%> <%=$col2%> <%=$col2%>
<%=$I_alternativelanguage%>
<%=$col3%>
 
 <%=$msje%>