Codice PHP:
include("../web/core.php");
include("../web/config.php");
connectdb();
$uip = getip();
$action = $_GET["action"];
$sid = $_GET["sid"];
$page = $_GET["page"];
$who = $_GET["who"];
$uid = getuid_sid($sid);
$sid = $_GET["sid"];
$site = $_GET["site"];
$theme = mysql_fetch_array(mysql_query("SELECT theme FROM ibwf_users WHERE id='".$uid."'"));
$sitename = mysql_fetch_array(mysql_query("SELECT value FROM ibwf_settings WHERE name='sitename'"));
$sitename = $sitename[0];
if(($action != "") && ($action!="terms"))
{
$uid = getuid_sid($sid);
if((islogged($sid)==false)||($uid==0))
{
echo '<card id="main" title="upload">';
echo '<p align="center">';
echo 'You are not logged in<br/>';
echo 'Or your session has been expired<br/><br/>';
echo '<a href="index.php">Home</a>';
echo '</p>';
echo '</card>';
echo '</wml>';
exit();
}
}
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html"/>
<meta http-equiv="Cache-Control" content="no-cache" forua="true"/>';
echo "<title>$sitename Upload Files</title>";
echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"../themes/$theme[0]\">";
echo "</head>";
echo "<body bgcolor=\"#FFFFFF\" text=\"#000000\" link=\"#0000FF\" vlink=\"#800080\">";
if ($upload="upload"&&$superdat_name){
if (!eregi("\.(mid|gif|bmp|mid|midi|3gp|mp3|wav|jar|jad|jpeg|jpg|sis|mmf|amr|png|wbmp)$",$superdat_name)){
print "<b>Unsupported File Extention!</b>";
}else{
$superdat_name = preg_replace(
'/[^a-zA-Z0-9\.\$\%\'\`\-\@\{\}\~\!\#\(\)\&\_\^]/'
,'',str_replace(array(' ','%20',"'"),array('_','_', ""),$superdat_name));
if(strlen($superdat_name)>53){ print "<b>Nome del file è troppo lungo!</b>";
}else{
if (empty($superdat)) {
print "<b>Nessun file specificato!!!</b>";
}else{
copy("$superdat", "files/$superdat_name") or
die("Couldn't copy file.");
$ok = array("image/png","image/bmp","image/jpeg", "image/jpg", "image/gif");
if(!in_array($_FILES["file"]["type"], $ok))
exit("Estensione file non consentita!");
$date=(date("D, j F Y"));
$fsize=round($superdat_size/1024,1);
$text = "&&$superdat_name&&$fsize KB&&$date&&$REMOTE_ADDR&&";
$fz = "$fsize KB";
if("$text"!="$check[1]"){
$mysql=mysql_query("INSERT INTO ibwf_uploads SET id='', uid='".$uid."', filename='".$superdat_name."', filesize='".$fsize." KB', date='".$date."', uip='".$REMOTE_ADDR."'");
echo mysql_error();
}
echo "<b>$superdat_name</b> il tuo file è stato caricato con successo";
}
}
}
}
?>
<?php
echo "<FORM align=\"center\" ACTION=\"uploadd.php?sid=$sid&site=$site\" METHOD=\"POST\" ENCTYPE=\"multipart/form-data\">";
?>
<b>Seleziona file da caricare :</b><br/>
<input align="center" type="file" name="superdat"><br/>
<input align="center" type="hidden" name="upload" value="upload"/>
<INPUT align="center" TYPE=SUBMIT NAME="submit" VALUE="Upload File!"><br/><br/></small><br/> <b><u>I file da caricare devono avere questi formati:</u></b><br/>
.jpg, .jpeg, .gif, .png, .bmp, wbmp, .mid, .midi, .mpg, .mmf, .amr, .mp3, .wav, .wmv , .avi, .3gp, .sis, .jar, .jad, .zip, .rar, .txt<br/><br/>
----------
<?php echo "<br/><small><a href=\"index.php?sid=$sid&site=$site\">Files Caricati</a></small>"; ?>
</FORM>
<?php
if($site=="wap"){
echo "<br/><br/><a href=\"../wap/index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
}else{
echo "<br/><br/><a href=\"../web/index.php?action=main&sid=$sid\"><img src=\"../images/home.gif\" alt=\"\"/>Home</a>";
}
?>
</body>
</html>
Vorrei mettere un foglio di stile interno..