codice:
<?php
//$pathServer = "./";
//$pathUploads = $pathServer."uploadsImg/";
$pathServer = "";
$pathUploads = $pathServer."uploadsImg/";
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>PhotoMosaic</title>
<link rel="stylesheet" type="text/css" href="<?php echo $patHServer;?>css/zindex.css" />
<link rel="stylesheet" href="<?php echo $patHServer;?>css/lightbox.css" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript" src="<?php echo $patHServer;?>css/lightbox.js"></script>
<script language="javascript" type="text/javascript">
function cellOnclick(elemento)
{
document.getElementById("ID_IMG").value=elemento.id;
document.forms["myForm"].submit();
}
//****PROVA SCRIPT PER FAR APPARIRE L'IMMAGINE SUBITO****\\
//****FINE PROVA SCRIPT****\\
</script>
</head>
<body>
<?php $pathBackground = $pathServer."defaultImg/BackgroundImage.jpg";?>
<div id = "div2" style="background-image: url(<?php echo $pathBackground;?>);" align="center" ></div>
<div id = "div3" align="center">
<table cellpadding="0px" cellspacing="0px" align="center" border = "1" bordercolor="lightgray">
<?php
for($i = 0; $i < 77; $i++)
{
?>
<tr>
<?php
for($j = 0; $j < 102; $j++)
{
$filePng = $pathUploads.$i."_".$j.".png";
$fileJpg = $pathUploads.$i."_".$j.".jpg";
$fileGif = $pathUploads.$i."_".$j.".gif";
$fileJpeg = $pathUploads.$i."_".$j.".jpeg";
$fileTif = $pathUploads.$i."_".$j.".tif";
$fileTiff = $pathUploads.$i."_".$j.".tiff";
if(file_exists ($filePng) || file_exists ($fileJpg) || file_exists ($fileGif) || file_exists ($fileJpeg) || file_exists ($fileTif) || file_exists ($fileTiff))
{
echo "<td id=\"td1\" width=\"8\" height=\"8\"></td>";
}
else
{
echo "<td id = \"".$i.$j."\"><img src =\"".$pathServer."defaultImg/vuoto.png\" width=\"8\" height=\"8\" /></td>";
}
}
?>
</tr>
<?php
}
?>
</table>
</div>
<div id="div1" align="center">
<table cellpadding="0px" cellspacing="0px" border="1" align="center" bordercolor="lightgray">
<?php
for($i = 0; $i < 77; $i++)
{
?>
<tr>
<?php
for($j = 0; $j < 102; $j++)
{
$filePng = $pathUploads.$i."_".$j.".png";
$fileJpg = $pathUploads.$i."_".$j.".jpg";
$fileGif = $pathUploads.$i."_".$j.".gif";
$fileJpeg = $pathUploads.$i."_".$j.".jpeg";
$fileTif = $pathUploads.$i."_".$j.".tif";
$fileTiff = $pathUploads.$i."_".$j.".tiff";
$extension = "";
if(file_exists ($filePng)) $extension = ".png";
if(file_exists ($fileJpg)) $extension = ".jpg";
if(file_exists ($fileJpeg)) $extension = ".jpeg";
if(file_exists ($fileTif)) $extension = ".tif";
if(file_exists ($fileTiff)) $extension = ".tiff";
if(file_exists ($fileGif)) $extension = ".gif";
if(strlen($extension) > 0)
{
$nome=$pathUploads.$i."_".$j.$extension;
mysql_connect("localhost", "root", "");
//die("Connessione non riuscita: " . mysql_error());
mysql_select_db("photo_mosaic");
//die("Selezione database fallita!");
$query = "SELECT * FROM up_immagini where nome_file = '$nome'";//Query per ottenere l'elenco dei files
$risultato = mysql_query($query);
//die("Query non valida: " . mysql_error());
//Se ci sono file nel DB
if($risultato)
{
while($tmp = mysql_fetch_array($risultato))
{
if($tmp[pagamento_eff]==1 && $tmp[up_accettato]==1)
{
echo "<td id = \"".$i.$j."\"><a href=\"".$pathUploads.$i."_".$j.$extension."\" rel=\"lightbox\" title=\"$tmp[dedica] \"><img id =\"".$i."_".$j."\" src =\"".$pathUploads.$i."_".$j.$extension."\" width=\"8\" height=\"8\" /></a></td>";
}
else if(($tmp[pagamento_eff]==1 && $tmp[up_accettato]==0)||$tmp[pagamento_eff]==0)
{
echo "<td id = \"".$i.$j."\"><img id =\"".$i."_".$j."\" src =\"".$pathServer."vuoto.png\" width=\"8\" height=\"8\" /></td>";
}
}
}
}
else
{
echo "<td id = \"".$i.$j."\"><img id =\"".$i."_".$j."\" onClick=\"cellOnclick(this);\" src =\"".$pathServer."vuoto.png\" width=\"8\" height=\"8\" /></td>";
}
}
?>
</tr>
<?php
}
?>
</table>
</div>
<form name="myForm" action="provascript.php" method="get">
<input type="hidden" id="ID_IMG" name="imgId"></input>
</form>
</body>
</html>