Location: PHPKode > projects > php movie db > elenchi/scheda_prog.php
<STYLE type=text/css>.style10 {
	FONT-WEIGHT: bold; FONT-SIZE: 10px; FONT-FAMILY: Arial, Helvetica, sans-serif
}
.style11 {
	FONT-SIZE: 11px; FONT-FAMILY: Arial, Helvetica, sans-serif
}
.style13 {
	FONT-WEIGHT: bold; FONT-SIZE: 11px; FONT-STYLE: italic; FONT-FAMILY: Arial, Helvetica, sans-serif
}
.style14 {
	FONT-WEIGHT: bold; FONT-SIZE: 11px; FONT-FAMILY: Arial, Helvetica, sans-serif
}
.style18 {
	FONT-WEIGHT: bold; FONT-SIZE: 11px; COLOR: #ffffff; FONT-FAMILY: Arial, Helvetica, sans-serif
}
.style19 {
	COLOR: #ffffff; FONT-STYLE: italic
}
.style20 {
	FONT-WEIGHT: bold; FONT-SIZE: 9px; FONT-FAMILY: Arial, Helvetica, sans-serif
}
.style21 {
	FONT-SIZE: 9px; FONT-FAMILY: Arial, Helvetica, sans-serif
}
.style22 {
	FONT-WEIGHT: bold; FONT-SIZE: 9px
}
.style23 {
	FONT-SIZE: 9px
}
.style24 {
	FONT-WEIGHT: bold; FONT-STYLE: italic
}
.style25 {
	FONT-SIZE: 10pt
}
.style26 {
	COLOR: #dfdfdf
}
.style30 {
	FONT-WEIGHT: bold; FONT-SIZE: 11px; COLOR: #999999; FONT-FAMILY: Arial, Helvetica, sans-serif
}
.style31 {
	FONT-WEIGHT: bold; COLOR: #efefef
}
.style32 {
	COLOR: #efefef
}
.style33 {
	FONT-SIZE: 12px
}
.style37 {
	FONT-SIZE: 10px; FONT-FAMILY: Arial, Helvetica, sans-serif
}
.style38 {
	FONT-SIZE: 11px
}
.style40 {
	FONT-WEIGHT: bold; FONT-SIZE: 10pt
}

.style44 {
	FONT-WEIGHT: bold; FONT-SIZE: 11px; COLOR: #ffffff; FONT-STYLE: italic; FONT-FAMILY: Arial, Helvetica, sans-serif
}
</STYLE>


<?
	$testo="select * from programmi where id=$id_prog";
	$res=mysql_query($testo,$db);
	$num=mysql_num_rows($res);
		
	//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,'nome');
			$id=mysql_result($res,0,'id');
			$id_cat=mysql_result($res,0,'id_cat');
			$supporto=mysql_result($res,0,'supporto');
			$voto=mysql_result($res,0,'voto');
			$ncd=mysql_result($res,0,'ncd');
			$id_produttore=mysql_result($res,0,'id_produttore');
			$versione=mysql_result($res,0,'versione');
			$id_piattaforma=mysql_result($res,0,'id_piattaforma');
			
			$data_inserimento=mysql_result($res,0,'data_ins');
			$data_modifica=mysql_result($res,0,'data_mod');
			$nome_cat=converti_id_cat($id_cat,$db,'prog');
			//$nome_cat="";
			$percorso_tmb="grafica/white.gif";
			//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);
			}
			*/
			
			
			OpenTable("Scheda Programma");
			?>
			<TABLE cellSpacing=1 cellPadding=0 width="100%" border=0>
  			<TBODY>
  <TR>
    <TD id=mTagline vAlign=top borderColor=#ffffff align=left 
      >&nbsp;</TD>
    </TR>
    			<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;</FONT> &nbsp;<MEDIATYPE id=mediaType>"; 
						echo "</DIV>";
        			echo "<DIV align=right></DIV></TD>";
			?>
				</TR>
    			<TR> 
      				<td>&nbsp;</td>
    			</TR>
  			</TBODY>
			</TABLE>
			<TABLE style="MARGIN-TOP: 0px; MARGIN-BOTTOM: 0px; WORD-SPACING: 0px" 
borderColor=#cccccc height=577 cellSpacing=0 cellPadding=2 width="100%" 
border=1>
  <TBODY>
  <TR>
    <TD vAlign=top align=left width="9%" height=214>
      <DIV align=center><BR>
	  <?	
	  	echo "<IMG id=mCover src=\"$percorso_tmb\" width=95 border=0>";
	   ?>	
		<BR><BR></DIV>
      <TABLE cellPadding=1 width=112 align=center border=0>
        <TBODY>
        <TD bgColor=#c8c85b><SPAN class=style44>cdbox id </SPAN></TD></TR>
        <TR>
          <TD bgColor=#80802b>
            <DIV class="style14 style33" align=center><FONT 
            color=#ffffff>
			<?
			echo "$supporto";
			?></FONT></DIV></TD></TR>
        <TR>
          <TD bgColor=#c8c85b><SPAN class=style13><FONT 
            color=#ffffff>ncd:</FONT></SPAN></TD></TR>
        <TR>
          <TD bgColor=#80802b>
            <DIV class="style10 style11" align=center><FONT 
            color=#ffffff><CDNUMBER id=cdnumber><SPAN 
            class=style33>
			<?
				echo $ncd;
			?>
			</SPAN></FONT></DIV></TD></TR>
        
        <TR>
          <TD></TD></TR>
        <TR>
          <TD bgColor=#c8c85b><SPAN class=style14><FONT 
            color=#ffffff><EM>inserted:</EM></FONT></SPAN></TD></TR>
        <TR>
          <TD bgColor=#80802b>
            <DIV class=style14 align=center><FONT 
            color=#ffffff>
			<?
				echo "$data_inserimento";
			?>
			</FONT></DIV></TD></TR>
        <TR>
          <TD bgColor=#c8c85b><SPAN class=style14><FONT 
            color=#ffffff><EM>
			Moficato:
			</EM></FONT></SPAN></TD></TR>
        <TR>
          <TD bgColor=#80802b>
            <DIV class=style14 align=center><FONT 
            color=#ffffff>
			<?
				echo "$data_modifica";
			?>
			</FONT></DIV></TD></TR></TBODY></TABLE><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>
    <TD vAlign=top align=left width="88%" height=214>
      <TABLE style="FONT-SIZE: 8pt; FONT-FAMILY: Tahoma" borderColor=#ffffff 
      height=305 cellSpacing=1 cellPadding=1 width="100%" border=0>
        <TBODY>
        <TR>
          <TD vAlign=top align=left bgColor=#dfdfdf colSpan=4 
            height=14><STRONG><IMG height=16 src="grafica/data.gif" 
            width=72></STRONG></TD></TR>
        <TR>
          <TD vAlign=top align=left width="19%" bgColor=#efefcf 
            height=13><B>Titolo originale: </B></TD>
          <TD id=mOTitle vAlign=top align=left width="37%" bgColor=#efefcf 
          height=13>
		  <?
		  	echo "$titolo";
		  ?>
		  </TD>
          </TR>
        <TR>
          <TD vAlign=top align=left bgColor=#efefcf 
          height=13><B>Voto:</B></TD>
          <TD id=mDIR vAlign=top align=left bgColor=#efefcf height=13>
		  <?
		  	echo $voto;
		  ?>
		  </TD>
          </TR>
		  <TR>
          <TD vAlign=top align=left bgColor=#efefcf 
height=13><B>Piattaforma:</B></TD>
          <TD id=mGenre vAlign=top align=left bgColor=#efefcf 
          height=13>
		  <?
		  	echo $id_piattaforma;
		  ?>
		  </TD>
          </TR>
        <TR>
          <TD vAlign=top align=left bgColor=#efefcf 
height=13><B>Produttore:</B></TD>
          <TD id=mGenre vAlign=top align=left bgColor=#efefcf 
          height=13>
		  <?
		  	echo $id_produttore;
		  ?>
		  </TD>
          </TR>
        <TR>
          <TD vAlign=top align=left bgColor=#efefcf 
height=13><B>Genere:</B></TD>
          <TD id=mGenre vAlign=top align=left bgColor=#efefcf 
          height=13>
		  <?
		  	echo $nome_cat;
		  ?>
		  </TD>
          </TR>
        
        
        <TR>
          <TD vAlign=top align=left bgColor=#efefcf height=13><B>Box 
ID:</B></TD>
          <TD vAlign=top align=left bgColor=#efefcf height=13>
		  <?
		  	echo "$supporto";
		  ?>
		  </TD>
          </TR>
        
        </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 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 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 src=\"$percorso_tmb\" height=\"100\"></a></td>";	
					}
					else
						echo "<td width='20%'>&nbsp;</td>";
				}
				echo "</tr>";	
				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