elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Guía actualizada para evitar que un ransomware ataque tu empresa


  Mostrar Temas
Páginas: [1]
1  Programación / PHP / Aumentar tamaño maximo de archivos para subir? en: 17 Agosto 2009, 20:35 pm
Hola tengo una pagina en un servidor gratis o como en algun sitio he leido que los llaman alojamiento compartido. El caso es que tengo un pequeño reproductor de mp3 al que le subo archivos con un formulario.
Los archivos que subi para probar el reproductor los subi con el FileZilla, hasta ahi todo bien.
Pero cual ha sdo mi sorpresa que no puedo subir por http archivos de mas de 1,5 Megas y que no tarden mas de 10 segundos (creo) en subirse y si lo hago por el administrador de archivos ftp del host son 2megas y creo que tambien 10 segundos.
He leido que se puede hacer creando un archivo llamado .htaccess y poniendole algo asi:
Código:
php_value upload_max_filesize 100M
php_value post_max_size 100M
php_value max_execution_time 1000
php_value max_input_time 1000
pero me sigue dando el mismo problema, tambien he leido que se puede poniendo al principio del script que sube los archivos algo asi:
Código
  1. ini_set('post_max_size','100M');
  2. ini_set('upload_max_filesize','100M');
  3. ini_set('max_execution_time', '1000');
  4. ini_set('max_input_time', '1000');
pero no hay tu tia y la configuracion no cambia.
post_max_size
2M
upload_max_filesize
1500K
max_execution_time
10
max_input_time
10
Me gustaria saber si lo hago mal o si hay alguna otra forma de hacerlo con php ya que con el FileZilla puedo subir lo que me de la gana.

Mas que nada es porque quiero que cualquier usuario se pueda subir el archivo mp3 que desee que para eso hice el formulario en cuestion.
Y si no, habria que subir primero el archivo con el filezilla y luego editar el codigo del reproductor para añadirlo a la lista,cosa que tendria que hacer yo.

Gracias y salud'Os!!
2  Programación / PHP / Actualizar registro de tabla pinchando en imagenes. en: 4 Agosto 2009, 20:58 pm
Wenas, tengo una tabla con la informacion de los usuarios (nombre, email, etc...) donde tambien guardo la ruta del avatar que usa y para elegir el avatar, tengo una especie de galeria donde salen todos junto al nombre de archivo, quien lo añadio y cuando.
Lo que quiero hacer es que al pinchar en una de las imagenes actualice el registro de usuarios y cambie su avatar por el que ha clicado.
Pues bien, he conseguido hacerlo excepto que da igual en que imagen pinche que siempre actualiza el registro con los datos de la primera imagen de la tabla.
Esta seria la tabla:
Código
  1. <td width="500" valign="top"><?php do { ?>
  2.      <table width="100%" border="0" cellpadding="0" cellspacing="0">
  3.        <!--DWLayoutTable-->
  4.        <tr>
  5.          <td width="263" height="41" align="center" valign="middle"><span class="Estilo9">Titulo:<?php echo $row_Recordset2['titulo']; ?></span></td>
  6.          <td width="237" rowspan="4" align="center" valign="middle"><form name="form1" method="POST" action="<?php echo $editFormAction; ?>"><p>
  7.          <input type="hidden" name="rutavatar" value="<? echo $row_Recordset2['rutavatar'];?>" />
  8.          <input type="hidden" name="avatar" value="<? echo $row_Recordset2['avatar'];?>" />
  9.          <input type="hidden" name="rutathumb" value="<? echo $row_Recordset2['rutathumb'];?>" />
  10.          <input type="hidden" name="titulo" value="<? echo $row_Recordset2['titulo'];?>" />
  11.          <input type="hidden" name="Nombre" value="<? echo $row_userdata['Nombre'];?>" />
  12.          <a class="enlace" href="#" onclick="document.forms.form1.submit();return false">
  13.      <img src="<? echo $row_Recordset2['rutavatar'];?>" border="0" alt="enviar"></a></p>
  14.  
  15.              <input type="hidden" name="MM_update" value="form1">
  16.          </form>
  17.            <p>&nbsp;</p></td>
  18.        </tr>
  19.        <tr>
  20.          <td height="41" align="center" valign="middle"><span class="Estilo9">Nombre:<?php echo $row_Recordset2['avatar']; ?></span></td>
  21.        </tr>
  22.        <tr>
  23.          <td height="41" align="center" valign="middle"><span class="Estilo9">A&ntilde;adido por: <?php echo $row_Recordset2['addpor']; ?></span></td>
  24.        </tr>
  25.        <tr>
  26.          <td height="41" align="center" valign="middle"><span class="Estilo9">Subido el <?php echo $row_Recordset2['fecha']; ?>a las <?php echo $row_Recordset2['hora']; ?></span></td>
  27.        </tr>
  28.        <tr>
  29.          <td height="0"></td>
  30.          <td></td>
  31.        </tr>
  32.                            </table>
  33.      <?php } while ($row_Recordset2 = mysql_fetch_assoc($Recordset2)); ?></td>
Se ve que al repetir la tabla va aumentando el registro de rutas,nombres de archivo,etc pero no lo hace en lo que se refiere al formulario. Si esto se puede hacer, que hago mal?
No se si me explico bien que soy mu novato.
Gracias por adelantado.
Salud'os!!
3  Programación / PHP / Problema con condicional dentro de un bucle. en: 30 Julio 2009, 20:11 pm
Wenas, tengo una tabla mysql en la que meto links de descargas videos de youtube, etc... Mi idea es que si el registro es un video de youtube me meta el video a la derecha del link con object y que si no lo es que meta por ejemplo una imagen. Pues bien los videos aparecen bien pero no las imagenes. Lo he echo con el dreamweaver retocandolo a mi gusto y ha quedado asi:
Código:
<td colspan="3" valign="top"><?php do { ?>
      <table width="100%" border="2" cellpadding="0" cellspacing="1" bordercolor="#0033FF">
        <!--DWLayoutTable-->
        <tr>
          <td width="450" height="98" align="center" valign="middle" bordercolor="#FFFFFF"><span class="Estilo4">A&ntilde;adido por <span class="Estilo6"><?php echo $row_Recordset1['Addpor']; ?> <span class="Estilo7">el <?php echo $row_Recordset1['fecha']; ?> a las <?php echo $row_Recordset1['hora']; ?></span></span></span></td>
          <td width="439" rowspan="3" align="center" valign="middle">
  <?php if ($row_Recordset1['tipo']=Youtube)
  { echo '<object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/'.$row_Recordset1['datostube'].'&color1=0xb1b1b1&color2=0xcfcfcf&feature=player_embedded&fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowScriptAccess" value="always"></param><embed src="http://www.youtube.com/v/'.$row_Recordset1['datostube'].'&color1=0xb1b1b1&color2=0xcfcfcf&feature=player_embedded&fs=1" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="425" height="344"></embed></object>';
  }
  else {echo '<p class="Estilo9"><img src="imagenes/image.png" width="343" height="65"></p>';}?></td>
        </tr>
        <tr>
          <td height="44" align="center" valign="middle" bordercolor="#FFFFFF"><span class="Estilo4">Link:<br>
              <span class="Estilo6"><a href="<?php echo $row_Recordset1['Links']; ?>" target="_blank"><?php echo $row_Recordset1['Links']; ?></a></span> </span></td>
        </tr>
        <tr>
          <td height="151" align="center" valign="middle" bordercolor="#FFFFFF"><p class="Estilo4">Comentario:<br>
              <span class="Estilo6"><?php echo $row_Recordset1['Comentario']; ?></span> </p></td>
        </tr>
            </table>
      <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?></td>
Pone los videos bien y ordenados pero los que no son videos los pone como si lo fueran, osea se ve el recuadro del video pero en blanco en vez de la imagen que debía aparecer.
Yo supongo que el problema está en el condicional dentro del bucle como si el condicional solo lo tuviese en cuenta la primera vez.
Si es asi, como lo soluciono?
Gracias!
4  Programación / PHP / Ordenar galería de imagenes por fecha. en: 21 Abril 2009, 22:34 pm
Hola. Tengo hecha una galeria de fotos en php con partes de una galeria prefabricada que me descargué. Consta de dos partes, una es para subir las imagenes y crear los thumbs en una carpeta para la galeria y la otra abre la carpeta donde están y la muestra en una tabla.
Mi problema es que muestra las imagenes en dicha tabla pero sin ningun orden aparente, lo he mirado y no es ni por tamaño ni fecha ni nombre.
Son dos archivos index.php y gallerybuilder.php. (pongo solo lo importante)
Index.php
Código:
<?php
// el archivo empieza por

 $default = "";
 include("galleryBuilder.php");
?>
// y el codigo de la tabla donde aparecen las imagenes
<table align="center">
                <?php createGallery("Upload/pics/" . $a, "Upload/pics/" . $a . "thumbs/", 120, 80, 5, FALSE); ?>
              </table>
Y el Gallerybuilder.php
Código:
<?php
if($_GET["a"] != "")
{
 $a = $_GET["a"] . "/";
}
else
{
 $a = $default . "/";
}
// This is a very basic way of determining whether to insert
// an extra trailing slash or not


function createGallery($gF, $tF, $tW, $tH, $nR, $nW)
{
 // $gF is the path to the folder that contains the images
 //     example: "gallery/"

 // $tF is the path to the folder that contains the thumbnails of the images
 //     example: "gallery/thumbs/"

 // $tW is the desired width of the thumbnails
 //     example: 120

 // $tH is the maximum desired height of the thumbnails
 //     example: 80

 // $nR is the desired number of images in each row of the table
 //     example: 8

 // $nW is a boolean value. If set to TRUE, opens full sizes in new window
 //     example: FALSE


 echo " <tr>\n";

 buildThumbs($gF, $tF, $tW, $tH);
 // call to another function to generate the thumbs

 $open = opendir($gF);
 // open the directory to the gallery folder

 $i = 1;
 $j = 1;
 // we use $i and $j to loop alternating table cells and the number of cells
 // per row
 while(FALSE !== ($fileName = readdir($open)))
 {
  $info = pathinfo($gF . $fileName);
  // get info for the filename
  if(strtolower($info["extension"]) == "jpe" || strtolower($info["extension"]) == "jpeg" || strtolower($info["extension"]) == "jpg" || strtolower($info["extension"]) == "gif" || strtolower($info["extension"]) == "png")
  {
  // this case-insensitively checks for all possible JPEG, GIF, and PNG extensions and only
  // returns files that meet these conditions
   echo "  <td width=\"" . $tW . "\" height=\"" . $tH . "\" class=\"galleryCell";
   if($i == 1)
   {
    // if $i is 1
    echo "1";
    $i = 2;
   }
   else
   {
    echo "2";
    $i = 1;
   }
   echo "\"><a";
   if($nW == TRUE)
   {
    echo " target=\"_blank\"";
   }
   echo " href=\"" . $gF . $fileName . "\" title=\"" . $fileName . "\"><img class=\"galleryImage\" src=\"" . $tF . $fileName .  "\" border=\"0\"></a></td>\n";
   if($j == $nR)
   {
    // if $j is the number or cells per row...
    echo " </tr>\n <tr>\n";
    $j = 1;
   }
   else
   {
    $j++;
   }
  }
 }
 closedir($open);
 // close the directory
 echo " </tr>\n";
}






function buildThumbs($gF, $tF, $tW, $tH)
{
 // $gF is the path to the folder that contains the images
 //     example: "gallery/"

 // $tF is the path to the folder that contains the thumbnails of the images
 //     example: "gallery/thumbs/"

 // $tW is the desired width of the thumbnails
 //     example: 120

 // $tH is the maximum desired height of the thumbnails
 //     example: 80

 $open = opendir($gF);
 // open the directory to the gallery folder
 while(FALSE !== ($fileName = readdir($open)))
 {
  // loop throught the entire directory
  if(!file_exists($tF . $fileName))
  {
   // there is NOT already a thumbnail with the same name, so let's create one!
   $info = pathinfo($gF . $fileName);
   // get file info for each file
   if(strtolower($info["extension"]) == "jpe" || strtolower($info["extension"]) == "jpeg" || strtolower($info["extension"]) == "jpg" || strtolower($info["extension"]) == "gif" || strtolower($info["extension"]) == "png")
   {
    // this really long line asks if the lowercase version of the extension ends in each JPEG format (jpe, jpeg, jpg), a GIF format (gif), or a PNG format (png), all of our valid image types
    if(strtolower($info["extension"]) == "jpe" || strtolower($info["extension"]) == "jpeg" || strtolower($info["extension"]) == "jpg")
    {
     // this narrows it down--the image must be a JPEG
     $thumbnail = imagecreatefromjpeg($gF . $fileName);
    }
    if(strtolower($info["extension"]) == "gif")
    {
     // it must be a GIF
     $thumbnail = imagecreatefromgif($gF . $fileName);
    }
    if(strtolower($info["extension"]) == "png")
    {
     // create a PNG
     $thumbnail = imagecreatefrompng($gF . $fileName);
    }
    $oWidth    = imagesx($thumbnail);
    // original width
    $oHeight   = imagesy($thumbnail);
    // original height
    $tWidth    = $tW;
    // the new thumbnail will have the specified width
    $tHeight   = floor($oHeight * ($tWidth / $oWidth));
    // calculate the thumbnail height by multiplying the original height by the width ratio
    if($tHeight > $tH)
    {
     // if the image is still too tall...
     $tHeight  = $tH;
     // set the height to the max height
     $tWidth   = floor($oWidth * ($tHeight / $oHeight));
     // calculate the thumnail width by multiplying the original width by the height ratio
    }
    $tempImage = imagecreatetruecolor($tWidth, $tHeight);
    // create a temporary image (it's blank right now)

    imagecopyresized($tempImage, $thumbnail, 0, 0, 0, 0, $tWidth, $tHeight, $oWidth, $oHeight);
    // copy and resize the full-size image into a thumbnail - see PHP.net's imagecopyresized() function for details

    if(strtolower($info["extension"]) == "jpe" || strtolower($info["extension"]) == "jpeg" || strtolower($info["extension"]) == "jpg")
    {
     // save a JPG thumbnail!
     $thumbnail = imagejpeg($tempImage, $tF . $fileName);
    }
    if(strtolower($info["extension"]) == "gif")
    {
     // save a GIF thumbnail!
     $thumbnail = imagegif($tempImage, $tF . $fileName);
    }
    if(strtolower($info["extension"]) == "png")
    {
     // save a PNG thumbnail!
     $thumbnail = imagepng($tempImage, $tF . $fileName);
    }
   }
  }
 }
 closedir($open);
 // close the directory
}






function listAlbums($gF, $aS, $dF)
{
 // $gF is the path to the folder that contains the subfolders
 //     example: "gallery/"

 // $aS is the separator between each album title
 //     example: " &bull; "

 // $dF is the default folder that we wish to exclude from the list
 //     example: "default_gallery"

 $open = opendir($gF);
 // open the directory to the gallery folder

 $i = 1;
 $toReturn = "";
 // we use $i to loop through the count and $toReturn to come
 // up with a full album list to echo later
 while(FALSE !== ($fileName = readdir($open)))
 {
  if(is_dir($gF . $fileName) && $fileName != "." && $fileName != ".." && $fileName != $dF)
  {
   // if the file is actually a directory... ("." and ".." are not directories) and NOT the default
   $displayName = str_replace("_", " ", $fileName);
   // change all underscores to spaces in the display name
   $displayName = ucwords($displayName);
   // capitalize the first letter of each word in the display name
   $toReturn = $toReturn . "<a href=\"?a=" . $fileName . "\">" . $displayName . "</a>" . $aS;
   // add the album name, and add a separator
  }
 }
 $aS_length = strlen($aS);
 // here we figure out how many characters $aS is
 $aS_length = $aS_length * -1;
 // get the negative number
 echo substr_replace($toReturn, "", $aS_length);
 // this is a messy but understandable way to remove the last
 // album separator from the list

}
?>
Lo que quiero es que "opendir" ordene las imagenes por la fecha en la que han subido las imagenes. Como lo hago?
Gracias de antemano.
Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines