1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
|
<?php
define('ZONE','membres');
define('FRAME','gauche');
require_once('../includes/config.inc.php');
if($_SESSION['sature'])
{
redirect('accueil.php');
}
$dossier=intval($_GET['dossier']);
$choix=$_GET['choix'];
if($sent)
{
cleanForm(array('dossier','choix'));
if($choix == 'Supprimer')
{
sqlQuery("DELETE FROM $_connexion[prefix]dossier WHERE id='$dossier' AND id_membre='$auth[id]'",__FILE__,__LINE__);
sqlQuery("DELETE FROM $_connexion[prefix]contact WHERE id_source='$auth[id]' AND id_dossier='$dossier'",__FILE__,__LINE__);
redirect($phpSelf);
}
}
if($choix == 'delete')
{
$idcontact=intval($_GET['idcontact']);
sqlQuery("DELETE FROM $_connexion[prefix]contact WHERE id='$idcontact' AND id_source='$auth[id]' AND id_dossier='$dossier'",__FILE__,__LINE__);
if(mysql_affected_rows())
{
sqlQuery("UPDATE $_connexion[prefix]dossier SET nbr_contacts=nbr_contacts-1 WHERE id='$dossier' AND id_membre='$auth[id]'",__FILE__,__LINE__);
redirect($phpSelf.'?dossier='.$dossier);
}
}
$result=sqlQuery("SELECT id,nom,nbr_contacts FROM $_connexion[prefix]dossier WHERE id_membre='$auth[id]' ORDER BY nom",__FILE__,__LINE__);
$Dossiers=storeResult($result);
if($dossier)
{
$result=sqlQuery("SELECT t1.id,id_cible,pseudo,naissance,sexe,region,pays,commentaire,t3.id AS id_photo,id_dossier,t4.date AS last_connect FROM $_connexion[prefix]contact t1,$_connexion[prefix]membre t2 LEFT JOIN $_connexion[prefix]photo t3 ON t1.id_cible=t3.id_membre AND profil='oui' LEFT JOIN $_connexion[prefix]connecte t4 ON t1.id_cible=t4.id_membre WHERE id_cible=t2.id AND id_source='$auth[id]' AND id_dossier='$dossier'",__FILE__,__LINE__);
}
else
{
$result=sqlQuery("SELECT t1.id,id_cible,pseudo,naissance,sexe,region,pays,commentaire,t3.id AS id_photo,id_dossier,t4.date AS last_connect FROM $_connexion[prefix]contact t1,$_connexion[prefix]membre t2 LEFT JOIN $_connexion[prefix]photo t3 ON t1.id_cible=t3.id_membre AND profil='oui' LEFT JOIN $_connexion[prefix]connecte t4 ON t1.id_cible=t4.id_membre WHERE id_cible=t2.id AND id_source='$auth[id]' AND t4.date > '".date('Y-m-d H:i:s',$time-60*5)."'",__FILE__,__LINE__);
}
$Contacts=storeResult($result);
include($documentRoot.'/includes/header_membres.inc.php');
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="3" height="20"><img src="../images/frametopleft.gif" border="0" width="3" height="20" alt=""></td>
<td style="background-image: url(../images/frametopbgr.gif);"><span class="blanc"> Gestion de vos contacts</span></td>
<td width="2" height="20"><img src="../images/frametopright.gif" border="0" width="2" height="20" alt=""></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="fondbleu6" width="1"></td>
<td><div class="contenu">
<form name="formulaire" method="post" action="<?php echo $phpSelf; ?>">
<input type="hidden" name="sent" value="1">
<table class="cadre" border="0" cellpadding="5" cellspacing="1" width="100%">
<tr>
<td class="fondbleu2" width="30%">Dossier en cours :</td>
<td class="fondblanc" width="70%"><select name="dossier" onchange="javascript:document.location.href='<?php echo $phpSelf; ?>?dossier='+this.value;">
<option value="0">Actuellement en ligne</option>
<?php
foreach($Dossiers as $enreg)
{
?>
<option value="<?php echo $enreg['id']; ?>" <?php initSelectValue('dossier',$enreg['id'],$dossier); ?> ><?php echo $enreg['nom'].' ('.$enreg['nbr_contacts'].')'; ?></option>
<?php
}
unset($Dossiers);
?>
</select>
<a href="ajouter_dossier.php">Nouveau</a></td>
</tr>
<?php if($dossier): ?>
<tr>
<td class="fondblanc" colspan="2" align="center">
<input class="bouton" type="button" value="Modifier" onclick="javascript:document.location.href='modif_dossier.php?id='+document.formulaire.dossier.value;">
<input class="bouton" type="submit" name="choix" value="Supprimer" onclick="javascript:if(!confirm('Etes-vous sûr de vouloir supprimer ce dossier et tous les contacts qu\'il contient ?')) return false;">
</td>
</tr>
<?php endif; ?>
<?php
foreach($Contacts as $enreg)
{
?>
<tr>
<td class="fondbleu2" width="30%" align="center" valign="middle"><a href="profil.php?id_membre=<?php echo $enreg['id_cible']; ?>"><img src="<?php if($enreg['id_photo']) echo '../images/photos/profil/photo_'.$enreg['id_photo'].'.jpg'; else echo '../images/cadre'.(($enreg['sexe'] == 'F')?'fille':'garcon').'.gif'; ?>" border="0"></a><br>
<a href="modif_contact.php?id=<?php echo $enreg['id']; ?>"><img class="absmiddle" src="../images/edit.gif" border="0" width="20" height="20" alt="Modifier ce contact" title="Modifier ce contact"></a>
<a href="<?php echo $phpSelf; ?>?dossier=<?php echo $enreg['id_dossier']; ?>&choix=delete&idcontact=<?php echo $enreg['id']; ?>" onclick="javascript:if(!confirm('Etes-vous sûr de vouloir supprimer ce contact ?')) return false;"><img class="absmiddle" src="../images/delete.gif" border="0" width="20" height="20" alt="Supprimer ce contact" title="Supprimer ce contact"></a>
</td>
<td class="fondblanc" width="70%" valign="top">
<b>Pseudo :</b> <?php echo $enreg['pseudo']; ?> (<?php if(!is_null($enreg['last_connect']) && strtotime($enreg['last_connect']) > ($time-60*5)) echo '<span class="vert"><b>connecté</b></span>'; else echo '<span class="rouge"><b>déconnecté</b></span>'; ?>)<br>
<b>Age :</b> <?php echo calculerAge($enreg['naissance']); ?> ans (né<?php if($enreg['sexe'] == 'F') echo 'e'; ?> le <?php echo dateFormat($enreg['naissance']); ?>)<br>
<b>Sexe :</b> <?php echo ($enreg['sexe'] == 'F')?'Féminin':'Masculin'; ?><br>
<b>Région :</b> <?php echo $enreg['region'].' ('.$_pays[$enreg['pays']].')'; ?><br><br>
<b>Commentaire :</b> <?php if(empty($enreg['commentaire'])) echo 'N/A'; else echo '<br><br>'.nl2br($enreg['commentaire']); ?>
</td>
</tr>
<?php
}
unset($Contacts);
?>
</table>
</form>
</div></td>
<td class="fondbleu6" width="1"></td>
</tr>
<tr>
<td class="fondbleu6" width="1" height="9"></td>
<td height="9" style="background-image: url(../images/framebtmbgr.gif);"></td>
<td class="fondbleu6" width="1" height="9"></td>
</tr>
</table>
</td>
</tr>
</table>
<?php
include($documentRoot.'/includes/footer_membres.inc.php');
?> |
Partager