Location: PHPKode > projects > PhpMyDVDs > phpmydvds/proprietaires.php
<?php

    /***************************************************************************
                            proprietaires.php  -  description
                                -------------------

        copyright          : (C) 2002 by Cédric Rochat
        email                : hide@address.com
    ***************************************************************************/
    /***************************************************************************
    *
    *   This program is free software; you can redistribute it and/or modify
    *   it under the terms of the GNU General Public License as published by
    *   the Free Software Foundation; either version 2 of the License, or
    *   (at your option) any later version.
    *
    ***************************************************************************/
require('util.php');

$connexion = Connexion (NOM, PASSE, BASE,SERVEUR);
if ($proprietaire) $proprietaire=urldecode($proprietaire);

if (!$IDProprietaire)
{
	$nombre_limite=$NombreEnregistrementsLimiteAdmin;
	if (!$debut)
	{
		$debut=0;
		$DonneesProprietaire=ExecRequete ("SELECT * FROM $pTable_Prefixe"."Proprietaires WHERE NomProprietaire LIKE '%$proprietaire%' OR PrenomProprietaire LIKE '%$proprietaire%' ORDER BY PrenomProprietaire ASC, NomProprietaire ASC" ,BASE);

		$Record_count=mysql_num_rows($DonneesProprietaire);
	}

	if ($debut >= $nombre_limite)
	{
		$valideprev=1;
		$debutprecedent=$debut-$nombre_limite;
	}
	else $valideprev=0;

	if (($debut+$nombre_limite) > $Record_count) $validenext=0;
	else
	{
		$validenext=1;
		$debutsuivant=$debut+$nombre_limite;
	}

	$DonneesProprietaire=ExecRequete ("SELECT * FROM $pTable_Prefixe"."Proprietaires WHERE NomProprietaire LIKE '%$proprietaire%' OR PrenomProprietaire LIKE '%$proprietaire%' ORDER BY PrenomProprietaire ASC, NomProprietaire ASC LIMIT $debut, $nombre_limite",BASE);

	switch ($Record_count)
	{
		case 0 :
 			$Record_count_text = "Aucun enregistrement n'a été trouvé";
			break;
		case 1 :
 			$Record_count_text = "<I>$Record_count </I> enregistrement  a été trouvé";
			break;
		default :
 			$Record_count_text = "<I>$Record_count </I> enregistrements  ont étés trouvés";
	}
}
else
{
	$DonneesProprietaire=ExecRequete ("SELECT $pTable_Prefixe"."DVD.IDDVD, Titre, IDZone, Appreciation, Duree, NomCategorie, $pTable_Prefixe"."DVD.IDCategorie
	FROM $pTable_Prefixe"."DVD LEFT JOIN $pTable_Prefixe"."Categories ON $pTable_Prefixe"."DVD.IDCategorie=$pTable_Prefixe"."Categories.IDCategorie
	WHERE IDProprietaire=$IDProprietaire
	ORDER BY Titre ASC" ,BASE);

	$requete=ExecRequete ("SELECT NomProprietaire, PrenomProprietaire, AdresseProprietaire, EmailProprietaire, TelephoneProprietaire, TelephonePortableProprietaire FROM $pTable_Prefixe"."Proprietaires WHERE IDProprietaire=$IDProprietaire", BASE);
	$ProprietaireData = mysql_fetch_array ($requete);

	$DVD_count=mysql_num_rows($DonneesProprietaire);

	switch ($DVD_count)
	{
		case 0 :
			$DVD_count_films = "Il n'y a aucun film";
			break;
		case 1 :
			$DVD_count_films = "Il y a <I>1</I> film";
			break;
		default :
			$DVD_count_films = "Il y a <I>$DVD_count</I> films";
	}

	if (!$numero) $numero=numero_enregistrement($IDProprietaire, 5);
	$next=next_record($numero, 5);
	$prev=prev_record($numero, 5);
}

$font_begin="<font color='#FF0A3B' face='Arial, Helvetica, sans-serif' size='2'>";
$font_end="</font>";

if (!$IDProprietaire)
{
	$pages_tot=$Record_count/$nombre_limite;
	if ($pages_tot > floor($pages_tot)) $pages_tot=floor($pages_tot)+1;
	$page_actuelle=floor($debut/$nombre_limite)+1;

	echo "  <table width='100%' border=0 cellspacing=1 cellpadding=1 align='center'>
					<tr><center><td>";
						$form = new Formulaire ("POST", "index.php?sousPage=proprietaires.php");
						$form->debutTable ("HORIZONTAL");
						$form->champTexte ("", "proprietaire", "", 30, 40);
						$form->champValider ("Recherche propriétaire", "valider");
						$form->finTable();
						$form->fin();
					echo "</td></center></tr>
					</table>
					<table width='100%' border=0 cellspacing=1 cellpadding=1>
					<tr>
						<td>
							<br>
							<b>$Record_count_text</b>
						</td>
						<td align='right'>
							<table border='0' cellspacing='0' cellpadding='0'>
								<tr>
									<td align='right'><b>"; if ($pages_tot > 1) echo "$page_actuelle/$pages_tot"; echo "</b></td>
									<td align='right'>";
										if ($valideprev == 1)
										{
											if ($proprietaire) $proprietaire=urlencode($proprietaire);
											echo "<a href='index.php?sousPage=proprietaires.php&debut=$debutprecedent&Record_count=$Record_count&proprietaire=$proprietaire'><img border='0' src='images/prev.gif'></a>";
										}
										else
										{
											if ($pages_tot > 1) echo "<img border='0' src='images/prevdis.gif'>";
										}

										if ($validenext == 1)
										{
											if ($proprietaire) $proprietaire=urlencode($proprietaire);
											echo "<a href='index.php?sousPage=proprietaires.php&debut=$debutsuivant&Record_count=$Record_count&proprietaire=$proprietaire'><img border='0' src='images/next.gif'></a>";
										}
										else
										{
											if ($pages_tot > 1) echo "<img border='0' src='images/nextdis.gif'>";
										}
									echo "</td>
								</tr>
							</table>
						</td>
					</tr>
					</table>";
		if ($Record_count!=0)
		{
		echo "
		<table width='100%' border=0 cellspacing=1 cellpadding=1>
		<tr>
			<td bgcolor='$color_frame' width='10%'><b><font face='Arial, Helvetica, sans-serif' size='2' color='$color_menu'>&nbsp;ID&nbsp;Propriétaire</b></font></td>
			<td bgcolor='$color_frame' width='10%'><b><font face='Arial, Helvetica, sans-serif' size='2' color='$color_menu'>&nbsp;Numérotation</b></font></td>
			<td bgcolor='$color_frame' width='10%'><b><font face='Arial, Helvetica, sans-serif' size='2' color='$color_menu'>&nbsp;Prénom</b></font></td>
			<td bgcolor='$color_frame' width='10%'><b><font face='Arial, Helvetica, sans-serif' size='2' color='$color_menu'>&nbsp;Nom</b></font></td>
			<td bgcolor='$color_frame' width='60%'><b><font face='Arial, Helvetica, sans-serif' size='2' color='$color_menu'>&nbsp;E-mail</b></font></td>
		</tr>
		<tr><td colspan=5><hr></td></tr>";


        $font_begin="<font color='#FF0A3B' face='Arial, Helvetica, sans-serif' size='2'>";
        $font_end="</font>";
        $Prop_count=$debut;
            while ($rowList = mysql_fetch_array ($DonneesProprietaire))
            {
                    $href_begin ="";
                    $href_end ="";
                    $Prop_count++;

                    echo "		<tr>
                                        <td width='10%'><font color='#000000' face='Arial, Helvetica, sans-serif' size='2'>$rowList[0] $font_end</td>
                                        <td width='10%'>$font_begin <B>$Prop_count</B> $font_end</td>
                                        <td width='10%'>$font_begin <a href='index.php?IDProprietaire=$rowList[0]&sousPage=proprietaires.php'>"; $rowList[2]=nbsp($rowList[2]); echo "$rowList[2]</a>$font_end</td>
                                        <td width='10%'>$font_begin <a href='index.php?IDProprietaire=$rowList[0]&sousPage=proprietaires.php'>"; $rowList[1]=nbsp($rowList[1]); echo "$rowList[1]</a>$font_end</td>
                                        <td width='60%'>$font_begin <a href='mailto:$rowList[6]?subject=DVDs'>$rowList[6]</a>$font_end</td>";
                        echo "</tr>";
            }
           	if ($Record_count!=0) echo "</table>";
            echo "<hr>";
    }
}
else
{
$AdresseProprietaire=Explode("
", $ProprietaireData[2]);
echo
"<TABLE height='100%' cellSpacing=0 cellPadding=0 width='100%' border=0>
        <TBODY>
                <TR bgColor=$color_back>
                        <TD vAlign=top>
                                <TABLE cellSpacing=0 cellPadding=0 width='100%' border=0 onKeyPress=changeUrlKeyBoard()>
                                        <TBODY>
                                                <TR>
                                                        <TD vAlign=top align=left>
                                                        	<H1>Propriétaire - $ProprietaireData[1] $ProprietaireData[0]</H1>
                                                        </TD>
														<TD align=right>"; if ($prev!=-1) echo "<A NAME=prev href=index.php?sousPage=proprietaires.php&IDProprietaire=$prev><IMG border=0 src='images/prev.gif'></A>"; else echo "<A NAME=prev href=''></A><IMG border=0 src='images/prevdis.gif'>"; if ($next!=-1) echo "<A NAME=next  href=index.php?sousPage=proprietaires.php&IDProprietaire=$next><IMG border=0 src='images/next.gif'></A>"; else echo "<A NAME=next href=''></A><IMG border=0 src='images/nextdis.gif'>"; echo "</TD>
                                                </TR>
												<TR>
													<TD>
														$ProprietaireData[1] $ProprietaireData[0]
													</TD>
												</TR>";
												$i=0;
												while ($AdresseProprietaire[$i]!="")
												{
													echo "<TR>
														<TD>
															$AdresseProprietaire[$i]
														</TD>
													</TR>";
													$i++;
												}
												echo "<TR>
													<TD>
														<A href='mailto:$ProprietaireData[3]?subject=DVDs'>$ProprietaireData[3]</A>
													</TD>
												</TR>
                                          </TBODY>
                                  </TABLE>
								<TABLE cellSpacing=0 cellPadding=0 width='100%' border=0>
										<TBODY>
                                                <TR>
                                                        <TD vAlign=top>
                                                                <TABLE width='100%' cellSpacing=0 cellPadding=0 border=0>
                                                                        <TBODY>
                                                                                <TR>
                                                                                        <TD vAlign=top><BR><B>$DVD_count_films appartenant à ce propriétaire (dans cette base de données) </B></TD>
																				</TR>";
																				if ($DVD_count!=0)
																				{
																				echo "
																				<TR>
																				</TR>
																				<TR>
                                                                                        <TD vAlign=top>
                                                                                                <BR>
																								<table width='100%' border=0 cellspacing=1 cellpadding=1>
                    																				<tr>
                    																					<td bgcolor='$color_frame' width='5%'><b><font face='Arial, Helvetica, sans-serif' size='2' color='$color_menu'>&nbsp;ID&nbsp;DVD</b></font></td>
                    																					<td bgcolor='$color_frame' width='45%'><b><font face='Arial, Helvetica, sans-serif' size='2' color='$color_menu'>&nbsp;Titre&nbsp;du&nbsp;film</b></font></td>
                    																					<td bgcolor='$color_frame' width='10%'><b><font face='Arial, Helvetica, sans-serif' size='2' color='$color_menu'>&nbsp;Durée</b></font></td>
                    																					<td bgcolor='$color_frame' width='10%'><b><font face='Arial, Helvetica, sans-serif' size='2' color='$color_menu'>&nbsp;Catégorie</b></font></td>
																										<td bgcolor='$color_frame' width='10%'><b><font face='Arial, Helvetica, sans-serif' size='2' color='$color_menu'>&nbsp;Zone(s)</b></font></td>
                    																					<td bgcolor='$color_frame' width='10%'><b><font face='Arial, Helvetica, sans-serif' size='2' color='$color_menu'>&nbsp;Appréciation</b></font></td>";
                    																					if ($DVD_count<30) echo "<td bgcolor='$color_frame' width='10%'><b><font face='Arial, Helvetica, sans-serif' size='2' color='$color_menu'>&nbsp;Affiche</b></font></td>";
                    																				echo "</tr>
                    																				<tr><td colspan=7><hr></td></tr>";
                                                                                                while ($rowDVD=mysql_fetch_array($DonneesProprietaire))
                                                                                                {
																										echo "		<tr>
																															<td width='5%'><font color='#000000' face='Arial, Helvetica, sans-serif' size='2'>$rowDVD[0] $font_end</td>
																															<td width='45%'>$font_begin <a href='index.php?IDDVD=$rowDVD[0]&sousPage=ficheDVD.php'>"; $rowDVD[1]=nbsp($rowDVD[1]); echo "$rowDVD[1]</a>$font_end</td>
																															<td width='10%'>$font_begin $rowDVD[4] $font_end</td>
																															<td width='10%'>$font_begin <a href='index.php?IDCategorie=$rowDVD[6]&sousPage=categories.php'>"; $rowDVD[5]=nbsp($rowDVD[5]); echo "$rowDVD[5]</a>$font_end</td>";
																															if ($DVD_count<30) $zonestexte = zones_texte($rowDVD[2], 'TRUE');
																															else $zonestexte = zones_texte($rowDVD[2]);
																															echo "<td width='10%'>$font_begin $zonestexte $font_end</td>";
																															echo "<td width='10%'>$font_begin $rowDVD[3] $font_end</td>";
																															if ($DVD_count<30)
																															{
																																if(file_exists("$pCoversPath"."$rowDVD[0]".".jpg")) echo "<td width='10%' valigh='top'><IMG height=85 src=$pCoversPath$rowDVD[0].jpg></td>";
																																else echo "<td width='10%' valign='top'><IMG height=85 src=images/NoImage.gif></td>";
																															}
																										echo "</tr>";
                                                                                                }
                                                                                        echo "</table>";
																						echo "
                                                                                        </TD>
                                                                                </TR>";
																				}
																		echo "
                                                                        </TBODY>
                                                                </TABLE>
                                                        </TD>
                                                </TR>
                                        </TBODY>
                                </TABLE>
                        </TD>
                </TR>
        </TBODY>
</TABLE>";
}

?>
Return current item: PhpMyDVDs