![borracho](http://static.forosdelweb.com/fdwtheme/images/smilies/borracho.png)
Código PHP:
<?php
if ( !isset( $_GET['user'] ) )
{
header( "Location: [url]http://localhost/post_a_new_php/login.php[/url]" );
}
else
{
$user = $_GET['user'];
}
$permitidos = array ( "gif", "jpeg", "png", "pcx", "jpg", "bmp", "pas", "doc", "rtf", "zip", "rar", "wav", "mp3", "txt", "pdf", "ppt", "exe", "class" );
if ( !include( "config/main.php" ) )
{
die ( "Error abriendo el archivo de configuraciones" );
exit();
}
if ( !include( "mods/idiomas.php" ) )
{
die ( "Error abriendo el archivo de idiomas" );
exit();
}
echo"<html>
<head>
<title>$idioma[0]</title>
<!--
SELECT, option, textarea, input {
BORDER-RIGHT: #808080 1px dotted;
BORDER-TOP: #808080 1px dotted;
BORDER-BOTTOM: #808080 1px dotted;
BORDER-LEFT: #808080 1px dotted;
COLOR: #000000;
FONT-SIZE: 11px;
FONT-FAMILY: Verdana; BACKGROUND-COLOR: #ffffff }
BODY, TD {text-decoration: none; font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 8pt;}
a:active,a:visited,a:link {font-size : 10px; color: #808080; font-family: verdana; text-decoration: none;}
a:hover {font-size : 10px; color: #000000; font-family: verdana; text-decoration: none; }
-->
</style>
</head>";
$form = "
<body bgcolor=#FFFFFF>
<center><table border=0 width=99% cellspacing=0 cellpadding=0 align=\"center\">
<td height=\"1\" colspan=\"3\">
<td height=\"1\">
<tr>
<td height=\"1\">
<td height=\"1\" colspan=\"3\">
<FORM action=\"\" METHOD=\"POST\" ENCTYPE=\"multipart/form-data\">
<table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"1\">
<tr>
<td width=\"41%\"><input name=\"image\" type=\"file\" size=\"20\"></td>
<td width=\"59%\"> </td>
</tr>
<tr>
<td height=\"21\"><p> <br>
Comentarios:
<textarea name=\"textarea\" cols=\"18\"></textarea>
</p>
</td>
<td> </td>
</tr>
<tr>
<td>Importancia:
<select name=\"select\">
<option value=\"1\" selected>1</option>
<option value=\"2\">2</option>
<option value=\"3\">3</option>
<option value=\"4\">4</option>
<option value=\"5\">5</option>
</select> <input type=\"submit\" name=\"Submit\" value=\"Enviar\"></td>
</tr>
</table>
</form>
</center>";
if ( isset( $_FILES['image']['tmp_name'] ) )
{
if ( !is_uploaded_file( $_FILES['image']['tmp_name'] ) ) // Verifica si un archivo en verdad es real
{
echo "<script> alert(\"$idioma[12]\") </script>";
}
else
{
$image = $_FILES['image']['tmp_name'];
$image_name = $_FILES['image']['name'];
$image_name = str_replace( " ", "_", $image_name );
$extencion = explode ( ".", $image_name );
$extencion = end ( $extencion );
if ( $image_name == "" )
{
$img_result = "<script> alert (\"$idioma[2]\")</script>";
}
else
if ( @file_exists( "upload/$image_name" ) )
{
$img_result = "
<script>
var overwrite = confirm (\"$idioma[3]\")
if (overwrite==true)
{
alert (\"$idioma[10]\");
}
</script>";
if ( strstr( $img_result, "overwrite==true" ) )
{
$borrar = unlink( "upload/$image_name" );
$copiar = copy( $image, "upload/$image_name" );
}
}
else
if ( !@in_array( $extencion, $permitidos ) )
{
$img_result = "<script> alert (\"$idioma[4]\")</script>";
}
else
{
@move_uploaded_file( $image, "upload/$image_name" ) or $img_result = "<font color=red>$idioma[5]</font><br>";
if ( @file_exists( "upload/$image_name" ) )
{
$img_result = "<script> alert (\"$idioma[6]\")</script>"; //El archivo es subido satisfactoriamente
}
else
{
$img_result = "<script> alert (\"$idioma[7]\")</script>"; //Error
}
}
}
}
// Creo la cabecera de la tabla
echo "<center>$idioma[8]</center>";
echo "<center>$form</center>";
if ( !isset( $img_result ) )
{
$img_result = "$idioma[9]";
}
echo "<center>$img_result<center>";
echo "<center><font size=1 face=Verdana><b>Lista de ficheros</b></font></center>";
echo "<br><center><table width=\"69%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<tr bgcolor=\"#FFCCFF\">
<td width = \"5%\"><center></center></td>
<td width = \"20%\"><b>Nombre del archivo</b></td>
<td width = \"10%\"><b><center>Tamaño</center></b></td>
<td width = \"15%\"><b><center>Creado</center></b></td>
<td width = \"7%\"><b><center>Importancia</b></center></td>
<td width = \"10%\"><b><center>Tipo</center></b></td>
</tr></center> ";