Location: PHPKode > projects > php movie db > elenchi/scheda.php
<?
	$testo="select * from movie where id=$id_film";
	$res=mysql_query($testo,$db);
	$num=mysql_num_rows($res);
	//Voto su visione
	if ((isset($salva_vis))and($visto=='yes')and($id_film>0))
	{
		$data_=date('Y-m-d');
		$testo="insert into visti(data,voto,id_film,id_utente,note)values";
		$testo.="('$data_',$voto,$id_film,$mov_id_ut,'$note')";
		mysql_query($testo,$db);
	}
	
	//Upload Immagini
	if ((isset($send_img))and($upload=='yes')and($id_film>0)and($livello==1 or $livello==10))
	{
		$testo="select * from movie where id=$id_film";
		$res=mysql_query($testo,$db);
		$num=mysql_num_rows($res);
		if ($num==1)
		{
			$path=FISICAL_PATH."/".$id_film."/";
			
			if (!is_dir($path))
			{
				mkdir($path, 0777);
			}
			
			$temp= $_FILES['userfile']['error'];
			$invia='agg_img';
			if (is_uploaded_file($_FILES['userfile']['tmp_name'])) {
    			copy($_FILES['userfile']['tmp_name'], $path.$_FILES['userfile']['name']);
				$nome=$_FILES['userfile']['name'];
				$filename=$path.$nome;
				$size=getimagesize($filename);
				$img_width=$size[0];
				$img_height=$size[1];
				$dimensione=$_FILES['userfile']['size'];
				$pos=strrpos($nome,".");
				$len=strlen($nome)-$pos-1;
				$estensione=substr($nome,($pos+1),$len);
				$senza_ext=substr($nome,0,$pos);
								
				if (($estensione=='jpeg')or($estensione=='jpg'))
				{
					$dest_file_name=$path.$senza_ext.THUMB_NAME.".jpg";
					$perc=(100*THUMB_HEIGHT)/$img_height;
					$thumb_width=$img_width*$perc/100;
					
					$dst_img=ImageCreatetruecolor($thumb_width,THUMB_HEIGHT); 

					$src_img=ImageCreateFromjpeg($filename); 
					
					ImageCopyResized($dst_img,$src_img,0,0,0,0,$thumb_width,THUMB_HEIGHT,ImageSX($src_img),ImageSY($src_img));
					
					Imagejpeg($dst_img,$dest_file_name); 
				}
				if ($estensione=='gif')
				{
					$dest_file_name=$path.$senza_ext.THUMB_NAME.".jpg";
					$perc=(100*THUMB_HEIGHT)/$img_height;
					$thumb_width=$img_width*$perc/100;
					
					$dst_img=ImageCreatetruecolor($thumb_width,THUMB_HEIGHT); 

					$src_img=ImageCreateFromgif($filename); 
					
					ImageCopyResized($dst_img,$src_img,0,0,0,0,$thumb_width,THUMB_HEIGHT,ImageSX($src_img),ImageSY($src_img));
					
					imagejpeg($dst_img,$dest_file_name); 
				}
				if (($estensione=='jpeg')or($estensione=='jpg')or($estensione=='gif'))
				{
					$testo="insert into movie_img (id_film, nome_file, descrizione, width,height) values ";
					$testo.="($id_film,'$nome','$descrizione',$img_width,$img_height)";
					//echo "<p>$testo</p>";
					mysql_query($testo, $db);
				
					$errno=mysql_errno();
					if ($errno==0)
					{	
						$dimensione=number_format($dimensione,0,",",".");
						echo "<h3>Upload Effettuato di $nome ($dimensione)</h3>";
						$id=$id_film;				
					}
					else
					{
						$error=mysql_error();
						echo "<h3>$error</h3>";
						echo "<h3>$testo</h3>";
					}
				}
				else
				{
					echo "<h3>File non corretto</h3>";
				}
			} else {
    			echo "<h3>Problemi nel trasferimento del file</h3>";
			}		
		}
	}
		
		if ($num==1)
		{
			
			//Asseganzioni variabili
			$titolo=mysql_result($res,0,'titolo');
			$id=mysql_result($res,0,'id');
			$durata=mysql_result($res,0,'durata');
			$anno=mysql_result($res,0,'anno');
			$regia=mysql_result($res,0,'regia');
			
			$trama=special_char_correct(mysql_result($res,0,'trama'));
			$recensione=special_char_correct(mysql_result($res,0,'recensione'));
			$attori=mysql_result($res,0,'attori');
			$cast=mysql_result($res,0,'cast');
			$titolo_originale=special_char_correct(mysql_result($res,0,'titolo_originale'));
			$categorie=mysql_result($res,0,'categorie');
			$supporto=mysql_result($res,0,'supporto');
			$formato=mysql_result($res,0,'id_formato');
			$data_inserimento=mysql_result($res,0,'data_ins');
			$data_modifica=mysql_result($res,0,'data_mod');
			$sceneggiatura=mysql_result($res,0,'sceneggiatura');
			$fotografia=mysql_result($res,0,'fotografia');
			$musica=mysql_result($res,0,'musica');
			$produttore=mysql_result($res,0,'produttore');
			$formato=converti_formato($formato,$db);
			$nome_cat=converti_id_cat($categorie,$db);
			//$nome_cat="";
			$cast=str_replace(chr(13).chr(10),"<br>",$cast);
			$attori=str_replace(chr(13).chr(10),"<br>",$attori);
			
			$ncd=1;
			
			$paese="";
			$studio="";
			$distributore="";
			$note="";
			$lingua="";
			//Visto
			$testo="select * from visti where id_film=$id_film and id_utente=$mov_id_ut";
			$res=mysql_query($testo,$db);
			$num=mysql_num_rows($res);
			if ($num==0)
				$visto="non visto";
			else
				$visto="visto";
			
			//thumbnail
			$testo="select nome_file from movie_img where id_film=$id limit 1";
			$res=mysql_query($testo,$db);
			$num=mysql_num_rows($res);
			if ($num==1){
				$nome_img=mysql_result($res,0,'nome_file');
				$pos=strrpos($nome_img,".");
				$len=strlen($nome_img)-$pos-1;
				$estensione=substr($nome_img,($pos+1),$len);
				$senza_ext=substr($nome_img,0,$pos);
				$percorso_tmb=LOGICAL_PATH."/".$id."/".$senza_ext.THUMB_NAME.".jpg";
				$percorso_high=LOGICAL_PATH."/".$id."/".$nome_img;	
				//echo "<td align='center' width='20%'><a href='$percorso_high'><img src=\"$percorso_tmb\" height=\"100\"></a></td>";			
			}else
				$percorso_tmb="grafica/white.gif";
			//Voto e visione
			$testo="select count(*),avg(voto) from visti where id_film=$id group by id_film";
			//echo "<p>$testo";
			$res=mysql_query($testo,$db);
			$num=mysql_num_rows($res);
			if ($num==0){
				$n_visioni=0;
				$voto="N/A";
			}else{
				$n_visioni=mysql_result($res,0,0);
				$voto=mysql_result($res,0,1);
			}
			
			
			//Parte per verifica Prestito
			$testo="select max(data_prestito),nome,data_restituzione from prestiti where id_film=$id group by id_film";
			//echo $testo;
			$res=mysql_query($testo,$db);
			$num=mysql_num_rows($res);
			if ($num==0){
				$data_ult_prest='0000-00-00';
				$nome_ult_prest="";
				$stato="presente";
			}else{
				$data_ult_prest=mysql_result($res,0,'data_prestito');
				$nome_ult_prest=mysql_result($res,0,'nome');
				$data_restituzione=mysql_result($res,0,'data_restituzione');
				if ($data_restituzione=='0000-00-00')
					$stato="prestato";	
				else
					$stato="presente";
			}
			
			OpenTable("Scheda Film");
			
			echo "<TABLE cellSpacing=1 cellPadding=0 width=\"100%\" border=0>";
  			echo "<TBODY>";
  				echo "<TR>";
    				echo "<TD id=mTagline vAlign=top bordercolor=$bordercolor1 align=left >&nbsp;</TD>";
    			echo "</TR>";
    			echo "<TR> ";
					echo "<TD colSpan=2>";
						echo "<DIV align=left>";
						echo "<FONT style=\"FONT-SIZE: 12pt; FONT-FAMILY: Tahoma\" size=3><EM><B>";
						echo $titolo;
						echo "</B></EM>&nbsp;($anno)</FONT> &nbsp;<MEDIATYPE id=mediaType>"; 
						echo "</DIV>";
        			echo "<DIV align=right></DIV></TD>";
				echo "</TR>";
    			echo "<TR> ";
      				echo "<td>&nbsp;</td>";
    			echo "</TR>";
  			echo "</TBODY>";
			echo "</TABLE>";
			echo "<TABLE style=\"MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; WORD-SPACING: 0px\" borderColor=$bordercolor2 height=577 cellSpacing=0 cellPadding=2 width=\"100%\" border=1>";
  			echo "<TBODY>";
  				echo "<TR>";
    				echo "<TD vAlign=top align=left width=\"9%\" height=214>";
      					echo "<DIV align=center><BR>";
	  	  					echo "<IMG id=mCover src=\"$percorso_tmb\" width=95 border=0>";
	   	
						echo "<BR><BR></DIV>";
      					echo "<TABLE cellPadding=1 width=112 align=center border=0>";
			        	echo "<TBODY>";
        					echo "<TR>";
          						echo "<TD bgColor=$bgcolor6><SPAN class=style13><FONT color=$textcolor1>";
		   							echo "visto / non visto";
		       					echo "</FONT></SPAN></TD>";
							echo "</TR>";
        					echo "<TR>";
          						echo "<TD bgcolor=$bgcolor1>";
            						echo "<DIV align=center>";
			
										echo "$visto";
			
									echo "</DIV>";
								echo "</TD>";
							echo "</TR>";
        					echo "<TR>";
          						echo "<TD bgColor=$bgcolor6><SPAN class=style44>cdbox id </SPAN></TD>";
							echo "</TR>";
        					echo "<TR>";
          						echo "<TD bgColor=$bgcolor5>";
            						echo "<DIV class=\"style14 style33\" align=center><FONT color=$textcolor1>";
									echo "$supporto";
									echo "</FONT></DIV>";
								echo "</TD>";
							echo "</TR>";
        					echo "<TR>";
			          			echo "<TD class=style14 bgColor=$bgcolor6><SPAN class=style19>status:</SPAN></TD>";
							echo "</TR>";
        					echo "<TR>";
          						echo "<TD bgColor=$bgcolor5>";
            						echo "<DIV align=center><SPAN class=style18>";
			
									echo "$stato";
			
									echo "</SPAN></DIV>";
								echo "</TD>";
							echo "</TR>";
        					echo "<TR>";
	          					echo "<TD bgColor=$bgcolor6><SPAN class=style13><FONT color=$textcolor1>ncd:</FONT></SPAN></TD>";
							echo "</TR>";
        					echo "<TR>";
          						echo "<TD bgColor=$bgcolor5>";
            						echo "<DIV class=\"style10 style11\" align=center><FONT color=$textcolor1><CDNUMBER id=cdnumber><SPAN class=style33>";
			
									echo $ncd;
			
									echo "</SPAN></FONT></DIV>";
								echo "</TD>";
							echo "</TR>";
        					echo "<TR>";
          						echo "<TD bgColor=$bgcolor6><SPAN class=style13><FONT color=$textcolor1>length:</FONT></SPAN></TD>";
							echo "</TR>";
        					echo "<TR>";
          						echo "<TD bgColor=$bgcolor5>";
            						echo "<DIV class=style14 align=center><FONT color=$textcolor1>";
			
									echo "$durata";
			
            						echo "min</FONT></DIV>";
								echo "</TD>";
							echo "</TR>";
        					echo "<TR>";
          						echo "<TD></TD>";
							echo "</TR>";
        					echo "<TR>";
          						echo "<TD bgColor=$bgcolor6><SPAN class=style14><FONT color=$textcolor1><EM>inserted:</EM></FONT></SPAN></TD>";
							echo "</TR>";
        					echo "<TR>";
          						echo "<TD bgColor=$bgcolor5>";
            						echo "<DIV class=style14 align=center><FONT color=$textcolor1>";
			
									echo "$data_inserimento";
			
									echo "</FONT></DIV>";
								echo "</TD>";
							echo "</TR>";
        					echo "<TR>";
          						echo "<TD bgColor=$bgcolor6><SPAN class=style14><FONT color=$textcolor1>";
									echo "<EM>Moficato:</EM></FONT></SPAN>";
								echo "</TD>";
							echo "</TR>";
        					echo "<TR>";
          						echo "<TD bgColor=$bgcolor5>";
            						echo "<DIV class=style14 align=center><FONT color=$textcolor1>";
			
									echo "$data_modifica";
			
									echo "</FONT></DIV>";
								echo "</TD>";
							echo "</TR>";
						echo "</TBODY></TABLE>";
					echo "<A onclick=\"NewWindow(this.href,'name','800','600','yes');return false;\" href=\"file:///C|/Program%20Files/eXtreme%20Movie%20Manager/moviecards/C:/Programmi/eXtreme%20Movie%20Manager/moviecards/white.gif\"></A></TD>";
    				echo "<TD vAlign=top align=left width=\"88%\" height=214>";
					
      			echo "<TABLE style=\"FONT-SIZE: 8pt; FONT-FAMILY: Tahoma\" bordercolor=$bordercolor1 height=305 cellSpacing=1 cellPadding=1 width=\"100%\" border=0>";
        		echo "<TBODY>";
        			echo "<TR>";
          				echo "<TD vAlign=top align=left bgColor=$bgcolor4 colSpan=4 height=14><STRONG><IMG height=16 src=\"grafica/data.gif\" width=72></STRONG></TD>";
					echo "</TR>";
        			echo "<TR>";
          				echo "<TD vAlign=top align=left width=\"19%\" bgColor=$bgcolor2 height=13><B>Titolo originale: </B></TD>";
          				echo "<TD id=mOTitle vAlign=top align=left width=\"37%\" bgColor=$bgcolor2 height=13>";
		  
		  					echo "$titolo";
		  
		  				echo "</TD>";
          				echo "<TD vAlign=top align=left width=\"15%\" bgColor=$bgcolor2><STRONG>Studio:</STRONG></TD>";
          				echo "<TD id=mPAA vAlign=top align=left width=\"29%\" bgcolor=$bgcolor1 rowSpan=4>";
            				echo "<DIV align=center><STUDIOTYPEE id=studiotype> </DIV>";
            				echo "<DIV align=right>";
			
								echo $studio;
			
							echo "</DIV>";
						echo "</TD>";
					echo "</TR>";
        			echo "<TR>";
          				echo "<TD vAlign=top align=left bgColor=$bgcolor2 height=13><B>Regista:</B></TD>";
          				echo "<TD id=mDIR vAlign=top align=left bgColor=$bgcolor2 height=13>";
		  					echo $regia;
		  
		  				echo "</TD>";
          				echo "<TD vAlign=top align=left bgColor=$bgcolor2 height=13>&nbsp;</TD>";
					echo "</TR>";
        			echo "<TR>";
          				echo "<TD vAlign=top align=left bgColor=$bgcolor2><B>Sceneggiatura:</B></TD>";
          				echo "<TD id=mWriter vAlign=top align=left bgColor=$bgcolor2>";
		  
		  					echo $sceneggiatura;
		  
		  				echo "</TD>";
          				echo "<TD vAlign=top align=left bgColor=$bgcolor2>&nbsp;</TD>";
					echo "</TR>";
        			echo "<TR>";
          				echo "<TD vAlign=top align=left bgColor=$bgcolor2><B>Fotografia:</B></TD>";
		  	
          				echo "<TD id=mPhtg vAlign=top align=left bgColor=$bgcolor2>$fotografia</TD>";
		  
          				echo "<TD vAlign=top align=left bgColor=$bgcolor2>&nbsp;</TD>";
					echo "</TR>";
        			echo "<TR>";
          				echo "<TD vAlign=top align=left bgColor=$bgcolor2><B>Musica:</B></TD>";
          				echo "<TD vAlign=top align=left bgColor=$bgcolor2>";
		  
		  					echo $musica;
		  
		  				echo "</TD>";
          				echo "<TD vAlign=top align=left width=\"15%\" bgColor=$bgcolor2><B>MPAA:</B></TD>";
          				echo "<TD id=mPAA vAlign=top align=left width=\"29%\" bgColor=$bgcolor2>&nbsp;</TD>";
					echo "</TR>";
        			echo "<TR>";
          				echo "<TD vAlign=top align=left bgColor=$bgcolor2 height=14><B>Produttore:</B></TD>";
          				echo "<TD id=mProd vAlign=top align=left bgColor=$bgcolor2>";
		  
		  					echo $produttore;
		  
		  				echo "</TD>";
          				echo "<TD vAlign=top align=left bgColor=$bgcolor3 height=14><B>Voto:</B></TD>";
          				echo "<TD id=mRated vAlign=top align=left bgColor=$bgcolor3 height=14><STRONG>";
							echo $voto;
						echo "</STRONG></TD>";
					echo "</TR>";
        			echo "<TR>";
          				echo "<TD vAlign=top align=left bgColor=$bgcolor2 height=13><B>Genere:</B></TD>";
          				echo "<TD id=mGenre vAlign=top align=left bgColor=$bgcolor2 height=13>";
		  	
		  					echo $nome_cat;
		  
		  				echo "</TD>";
          				echo "<TD vAlign=top align=left bgColor=$bgcolor2><B>ID sito:</B></TD>";
          				echo "<TD vAlign=top align=left bgColor=$bgcolor2></TD>";
		  			echo "</TR>";
        
        			echo "<TR>";
          				echo "<TD vAlign=top align=left bgColor=$bgcolor2 height=13><B>Anno:</B></TD>";
          				echo "<TD id=mYear vAlign=top align=left bgColor=$bgcolor2 height=13>";
		  
		  					echo "$anno";
		  
		  				echo "</TD>";
         		 		echo "<TD class=style14 vAlign=top align=left bgColor=$bgcolor2><SPAN class=style22>Sul Web:</SPAN></TD>";
          				echo "<TD class=style14 vAlign=top align=left bgColor=$bgcolor2><A class=style23 href=\"http://imdb.com/title/tt0298130/\">LINK</A></TD>";
					echo "</TR>";
        			echo "<TR>";
          				echo "<TD vAlign=top align=left bgColor=$bgcolor2 height=13><B>Paese:</B></TD>";
          				echo "<TD id=mCountry vAlign=top align=left bgColor=$bgcolor2 height=13>";
			
							echo $paese;
			
						echo "<COUNTRY id=country></TD>";
          				echo "<TD class=style14 vAlign=top align=left width=\"15%\" bgColor=$bgcolor2><SPAN class=style20>Sito ufficiale:</SPAN></TD>";
          				echo "<TD class=style14 vAlign=top align=left width=\"29%\" bgColor=$bgcolor2><A class=style21 href=\"file:///C:/Programmi/eXtreme%20Movie%20Manager/\">LINK</A></TD>";
		  			echo "</TR>";
        			echo "<TR>";
          				echo "<TD vAlign=top align=left bgColor=$bgcolor2 height=13><B>Box ID:</B></TD>";
          				echo "<TD vAlign=top align=left bgColor=$bgcolor2 height=13>";
						 	echo "$supporto";
		  
		  				echo "</TD>";
          				echo "<TD vAlign=top align=left bgColor=$bgcolor2 height=13>&nbsp;</TD>";
          				echo "<TD id=mRipper vAlign=top align=left bgColor=$bgcolor2 height=13>&nbsp;</TD>";
					echo "</TR>";
        			echo "<TR>";
          				echo "<TD vAlign=top align=left bgColor=$bgcolor2><B>Studio:</B></TD>";
          				echo "<TD id=mStudio vAlign=top align=left bgColor=$bgcolor2></TD>";
          				echo "<TD vAlign=top align=left bgColor=$bgcolor7 height=13><STRONG><FONT color=$textcolor2>Note:</FONT></STRONG></TD>";
          				echo "<TD id=mNCD vAlign=top align=left bgColor=$bgcolor7 rowSpan=2><FONT color=$textcolor2>&nbsp;</FONT></TD>";
		  			echo "</TR>";
        			echo "<TR>";
          				echo "<TD vAlign=top align=left bgColor=$bgcolor2><B>Distributore:</B></TD>";
          				echo "<TD id=mDistr vAlign=top align=left bgColor=$bgcolor2></TD>";
          				echo "<TD vAlign=top align=left bgColor=$bgcolor2 height=13>&nbsp;</TD>";
		  			echo "</TR>";
        			echo "<TR>";
          				echo "<TD vAlign=top align=left bgColor=$bgcolor2 height=13>&nbsp;</TD>";
          				echo "<TD id=mRated vAlign=top align=left bgColor=$bgcolor2 height=13>&nbsp;</TD>";
          				echo "<TD vAlign=top align=left bgColor=$bgcolor2 height=13>&nbsp;</TD>";
          				echo "<TD id=mNCD vAlign=top align=left bgColor=$bgcolor2>&nbsp;</TD>";
		  			echo "</TR>";
        			echo "<TR>";
          				echo "<TD vAlign=top align=left bgColor=$bgcolor2 height=13><B>Media:</B></TD>";
          				echo "<TD id=mMedia vAlign=top align=left bgColor=$bgcolor2 height=13>";
		  
						  	echo "$formato";
		  
		  				echo "</TD>";
          				echo "<TD vAlign=top align=left bgColor=$bgcolor3><B>Data ultimo Prestito:</B></TD>";
          				echo "<TD vAlign=top align=left bgColor=$bgcolor3>";
		  
		  					echo "$data_ult_prest";
		  
		  				echo "</TD>";
					echo "</TR>";
        			echo "<TR>";
			        	echo "<TD vAlign=top align=left bgColor=$bgcolor2 height=13><B>Lingua:</B></TD>";
          				echo "<TD id=mLang vAlign=top align=left bgColor=$bgcolor2 height=13></TD>";
          				echo "<TD vAlign=top align=left bgColor=$bgcolor3><B>Ultimo prestito:</B></TD>";
          				echo "<TD vAlign=top align=left bgColor=$bgcolor3>";
		  
		  					echo "$nome_ult_prest";
		  
		  				echo "</TD>";
					echo "</TR>";
        			echo "<TR bgcolor=$bgcolor1>";
          				echo "<TD vAlign=top align=left height=13>&nbsp;</TD>";
          				echo "<TD id=mLang vAlign=top align=left height=13>&nbsp;</TD>";
          				echo "<TD vAlign=top align=left>&nbsp;</TD>";
          				echo "<TD vAlign=top align=left>&nbsp;</TD>";
		  			echo "</TR>";
       	 			echo "<TR bgColor=$bgcolor4>";
          				echo "<TD vAlign=top align=left colSpan=4 height=14><STRONG><IMG height=16 src=\"grafica/plot.gif\" width=72><SPAN class=style26>Trama:</SPAN></STRONG></TD>";
					echo "</TR>";
		
        			echo "<TR bgColor=$bgcolor2>";
						echo "<TD id=mPlot vAlign=top align=left colSpan=4 height=13><SPAN class=style25>";
							echo "$trama";
			
						echo "</SPAN></TD>";
					echo "</TR>";
      
		        	echo "<TR>";
		
         				echo "<TD vAlign=top bordercolor=$bordercolor1 align=left width=488 bgColor=$bgcolor2 colspan=4>";
            				echo "<TABLE style=\"FONT-SIZE: 10pt; FONT-FAMILY: Tahoma\" cellSpacing=0 cellPadding=0 width=\"100%\" border=0>";
              				echo "<TBODY>";
              					echo "<TR bgColor=$bgcolor4>";
                					echo "<TD width=\"50%\" bgColor=$bgcolor4 colspan=2><B><IMG height=14 src=\"grafica/actors.gif\" width=70><A name=actors></A><SPAN class=style26>Attori:</SPAN></B></TD>";
                					echo "<TD width=\"50%\" colspan=2>&nbsp;</TD>";
								echo "</TR>";
              					echo "<TR bgColor=$bgcolor2>";
                					echo "<TD id=mActors width=\"100%\" colSpan=4>";
				
										echo $attori;
										echo $cast;
				
									echo "</TD>";
								echo "</TR>";
							echo "</TBODY></TABLE>";
						echo "</TD>";
         			echo "</TR>";
        		echo "</TBODY></TABLE>";
			
			CloseTable();
			
			
			if (!isset($offset))
				$offset=0;
			$testo="select * from movie_img where id_film=$id limit $offset,".IMG_X_PAGE;
			$res=mysql_query($testo,$db);
			$num=mysql_num_rows($res);
			$testo="select count(*) from movie_img where id_film=$id";
			$res2=mysql_query($testo,$db);
			$tot=mysql_result($res2,0,0);
			
			
			//********************************************************************
			//Gallery Film
			//********************************************************************
			if ($num>0) {
				OpenTable("Gallery");

				$offa=$offset+IMG_X_PAGE;
				$offb=$offset-IMG_X_PAGE;
				echo "<tr>";
					if ($offset>0)
						echo "<td align='left'><a href=\"$PHP_SELF?page=$page&id_film=$id&offset=$offb\"><img border='0' src=\"grafica/left.gif\"></a></td>";
					else
						echo "<td></td>";
					echo "<td></td><td align='center'></td><td></td>";	
					if ($tot>$num+$offset)
						echo "<td align='right'><a href=\"$PHP_SELF?page=$page&id_film=$id&offset=$offa\"><img border='0' src=\"grafica/right.gif\"></a></td>";
					else
						echo "<td></td>";
				echo "</tr>";
				echo "<tr>";
				for ($i=0; $i<5; $i++)
				{
					
					if ($i<$num) {
						$nome_img=mysql_result($res,$i,'nome_file');
						$pos=strrpos($nome_img,".");
						$len=strlen($nome_img)-$pos-1;
						$estensione=substr($nome_img,($pos+1),$len);
						$senza_ext=substr($nome_img,0,$pos);
						$percorso_tmb=LOGICAL_PATH."/".$id."/".$senza_ext.THUMB_NAME.".jpg";
						$percorso_high=LOGICAL_PATH."/".$id."/".$nome_img;	
						echo "<td align='center' width='20%'><a href='$percorso_high'><img border='0' src=\"$percorso_tmb\" height=\"100\"></a></td>";	
					}
					else
						echo "<td width='20%'>&nbsp;</td>";
				}
				echo "</tr>";	
				CloseTable();
			}
			
			//********************************************************************
			//Form Per Visione
			//********************************************************************
			
			if(($livello==5 or $livello==1)and $visto=="non visto"){
				OpenTable("Visto");
					echo "<form action=\"$PHP_SELF?page=$page&visto=yes&id_film=$id\" method=\"post\" name=\"FORM_VISTI\">";
					echo "<tr><td align='center' colspan='2'>Voto: ";
						echo "<select name='voto'>";
							for ($i=1;$i<11;$i++)
							{	
								echo "<option value=$i>$i</option>";
							}
						echo "</select>";
					echo "</td></tr>";
					echo "<tr><td align='center' colspan='2'>Note: <input name='note' type='text'></td></tr>";
					echo "<tr><td align='center' colspan='2'><input type='submit' name='salva_vis' value='Salva'></td></tr>";
					echo "</form>";	
				CloseTable();
			}
			
			//********************************************************************
			//Form Per Upload Immagini
			//********************************************************************
			if($livello==1 or $livello==10) {
				OpenTable("Aggiunta Immagini");
					echo "<form action=\"$PHP_SELF?page=$page&upload=yes&id_film=$id\" method=\"post\" enctype=\"multipart/form-data\" name=\"FORM_UPL\">";
					//echo "<tr><td align='left' colspan='2'><font class=\"title\"><b>Upload Immagini</b></font></td></tr>";
					echo "<tr><td align='center' colspan='2'>File: <input name='userfile' type='file'></td></tr>";
					echo "<tr><td align='center' colspan='2'>Descrizione: <input name='descrizione' type='text'></td></tr>";
					echo "<tr><td align='center' colspan='2'><input type='submit' name='send_img' value='Invia file'></td></tr>";
					echo "</form>";	
				CloseTable();
			}
		}
?>
Return current item: php movie db