Tampoco se eliminan los usuarios que uno quiere eliminar.
Dejo el codigo por las dudas.
Código
<?php include("connect.php"); $usuario=$_SESSION['usuario']; $tid=$_GET["id"]; $id=$_SESSION["id"]; $msg1=""; $to_delete=""; $items_removed=0; { /////////////////////////// A REQUEST TO DELETE SOME CONTACTS /////////////// for($i=1;$i<=$_REQUEST["cnt"];$i++) { { if ($to_delete!="") { $to_delete.="," ; } //To insert comma?? $to_delete.= $_REQUEST["checkbox" . $i]; //Add another item to delete $items_removed++; } } //End For if ($to_delete=="") { $msg1=" No se puede eliminar ningun usuario de la lista de contactos "; } else { $del_str=" Delete from dm_contacts where dm_contact_id IN (" . $to_delete .")"; $msg1= ($items_removed > 1)?$items_removed . " Usuarios que han sido removidos de tu lista de contactos":$items_removed . " El usuario ha sido removido de tu lista"; } /////////////////////////////CONTACTS HAVE BEEN REMOVED ///////////////////// } $contact_count=$rs0[0]; $rs0_query=mysql_query("SELECT * FROM dm_contacts, members WHERE dm_contacts.dm_contact_id=members.id" ); ?> <script language="javascript"> function validate(form) { if((form.username.value=="")) { alert('Por favor especifica un nombre de usuario'); form.username.focus(); return false; } return true; } </script> <table width="100%" border="0" cellpadding="0" cellspacing="0" > <tr> <td colspan="3" valign="top"><table width="90%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td class="titlestyle"> Añadir a mi lista de contactos</td> </tr> </table></td> </tr> <tr> <td><table width="100%" border="0" align="center" cellpadding="2" cellspacing="5" class="onepxtable"> <form name="form1" method="post" action="addcontact.php" onSubmit="return validate(this);"> <tr valign="top"> <td width="40%" align="right" class="innertablestyle"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr align="right"> <td width="60%"><font class="normal"><strong><font class='normal'> </font></strong></font></td> <td><font class="normal"><strong><font class='normal'>Username</font></strong></font></td> </tr> </table></td> <td width="6"> </td> <td width="60%"><font face="Arial, Helvetica, sans-serif" size="2"> <input type="text" name="username"> </font></td> </tr> <tr valign="top"> <td align="right" class="innertablestyle"> </td> <td> </td> <td><input type="submit" name="Submit2" value="Add User"></td> </tr> </form> </table></td> </tr> </table> </td> </tr> <tr> <td height="25" colspan="3" valign="middle"> <div align="center"><font class='red'> </font></div></td> </tr> <tr> <td valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td valign="top"> <table width="90%" border="0" align="center" cellpadding="0" cellspacing="0" class="onepxtable"> <tr > <td valign="top"> <table width="100%" border="0" align="center" cellpadding="2" cellspacing="0" class="innertablestyle"> <tr> <td height="25" class="titlestyle"> Mis contactos</td> </tr> <tr> <td height="25" valign="middle"><font class='normal'>Tu lista de contactos tiene <strong><font class='red'><?php echo $contact_count; ?></font></strong><?php if( $contact_count>1) { echo " usuarios"; } else { echo " usuario"; } ?></font><font class='red'><br> </font></td> </tr> <tr> <td height="25" valign="middle"><font class='normal'>To remove a user from my contacts list just check the check box and click the remove button below.</font></td> </tr> <tr> <td valign="top"> <script language="javascript"> //<!-- function select_all() { for (var i=0;i<document.form2.elements.length;i++) { var e =document. form2.elements[i]; if ((e.name != 'check_all') && (e.type=='checkbox')) { e.checked = document.form2.check_all.checked; } } } function validate_rem(form) { var checked='no'; for (var i=0;i<form.elements.length;i++) { var e =form.elements[i]; if (e.checked==true) { checked='yes'; } } if(checked=='no') { alert('Por favor elige al menos un contacto a eliminar'); return false; } return true; } //--> </script> <form name="form2" method="post" action="mostrarcontactos.php" onSubmit="return validate_rem(this);"> <table width="100%" border="0" align="center" cellpadding="2" cellspacing="1"> <tr class="subtitle"> <td width="10" align="right"> <input name="check_all" type="checkbox" id="check_all" onClick="select_all();" value="yes"></td> <td height="25"><b><font class='normal'>Usuario</font></b></td> <!--td><b><font class='normal'>Company Name </font></b></td> <td><b><font class='normal'>Phone</font></b></td> <td><b><font class='normal'>Fax</font></b></td--> </tr> <?php $cnt=0; { $cnt++; ?> <tr> <td width="10" align="right" ><font class='normal'> <input type="checkbox" name="checkbox<?php echo $cnt;?>" value="<?php echo $rs0["dm_uid"];?>"> </font></td> <td ><font class='normal'><a href="replyuser.php?type=contact&tid=<?php echo $rs0["dm_contact_id"];?>" ><?php echo $rs0["usuario"];?></a> </font></td> </tr> <?php } ?> <tr > <td colspan="2" align="left"> <input type="hidden" name="cnt" value="<?php echo $cnt; ?>"> <input type="submit" name="Submit3" value="Remove"> </td> <!--td> </td> <td> </td> <td> </td--> </tr> </table> </form></td> </tr> </table></td> </tr> </table></td> </tr> <tr> <td> </td> </tr> </table></td> </tr> </table>
el dm_uid-> es la id del usuario de la sesion
el dm_contacts_id-> es la id del contacto añadido.
Gracias de antemano