Modification de mon mini site de rencontre

Résolu/Fermé
maravilloss - 21 mai 2010 à 00:37
avion-f16 Messages postés 19246 Date d'inscription dimanche 17 février 2008 Statut Contributeur Dernière intervention 21 avril 2024 - 22 mai 2010 à 12:45
Bonjour, moi c'est maravilloss et j'aimerais faire un petit site de rencontre avec php adodb
je vous laisse mon code pour que vous puissiez m'aider en suivant mes demandes :
-avoir des suggessions d'ais
-ajouter des amis
-rechercher des amis

mon code !!!!
<?php
////exemple adodb

session_start();

//Sécurisation des fichiers avant leur inclusion inclure

$filename = "fonctions/fonctions_gene.php"; // inclusion des fonctions de traitements
if (file_exists($filename)) require_once($filename);
$filename = "fonctions/fonction_valide.php";
if (file_exists($filename)) require_once($filename);
$file_adodb = "adodb/adodb.inc.php";
if (file_exists($file_adodb)) require_once($file_adodb);
$file_conf = "config/config.php";
if (file_exists($file_conf)) require_once($file_conf);
$filename = "lib/tb_album_photo.php";
if (file_exists($filename)) require_once($filename);
$filename = "lib/tb_ami.php";
if (file_exists($filename)) require_once($filename);
$filename = "lib/tb_appartenir.php";
if (file_exists($filename)) require_once($filename);
$filename = "lib/tb_message.php";
if (file_exists($filename)) require_once($filename);
$filename = "lib/tb_photo.php";
if (file_exists($filename)) require_once($filename);
$filename = "lib/tb_user.php";
if (file_exists($filename)) require_once($filename);
$filename = "lib/tb_comment.php";
if (file_exists($filename)) require_once($filename);

$champ=array();

$user=new tb_user();

////

if(!empty($_POST['enregistrement'])){
$nom=trim($_POST['nom']);
$prenom=trim($_POST['prenom']);
$mail=trim($_POST['mail']);
$login=trim($_POST['login']);
$motpass=$_POST['motpass'];
$motpass1=$_POST['motpass1'];
$datnais=$_POST['annee']."-".$_POST['mois']."-".$_POST['jour'];
$lieunais=$_POST['lieunais'];




$user_ins=$user->insert('',$nom,addslashes($prenom),'',$mail,$motpass,$login,'',$datnais,$lieunais,'','','','','','','','','','','','','','','','','','','','','');

$_SESSION['user_login']=$login;
$_SESSION['user_pwd']=$motpass;
$_SESSION['user_nom']=$nom;
$_SESSION['user_prenom']=$prenom;


$redir="<script language='javascript'>document.location=('main.php?page=in')</script>";
echo $redir;

}else $mess_erreur="<strong><font color='red'>Mot de passes différents.</font></strong>";


if(isset($_POST['connect'])){
$email=trim($_POST['email']);

$user_sel=$user->select_email($email);
//$user_sel=$user->select0('user_email',$email);

if($user_sel->Recordcount()!=0){
$pwd=$_POST['passwd'];
if ($user_sel->fields['user_motpass']==$pwd){
$_SESSION['user_login']=$user_sel->fields['user_login'];
$_SESSION['user_pwd']=$user_sel->fields['user_motpass'];
$_SESSION['user_nom']=$user_sel->fields['user_nom'];
$_SESSION['user_prenom']=$user_sel->fields['user_prenom'];

$redir="<script language='javascript'>document.location=('main.php')</script>";
echo $redir;
} else $mess_erreur="<strong><font color='red'>Vérifiez votre mot de passe.</font></strong>";
}$mess_erreur="<strong><font color='red'>Vérifiez votre email.</font></strong>";
}

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Document sans titre</title>
<style type="text/css">
<!--
.Style1 {
font-size: 12px;
color: #000000;
}
-->
</style>
</head>

<body>
<table width="89%" border="1" align="center">

<tr>
<td>album</td>
</tr>
<tr>
<td height="599"><table width="99%" border="1" align="center">
<tr>
<th width="60%" rowspan="2" scope="col"><form id="form1" name="form1" method="post" action="">
<table width="96%" border="1">
<tr>
<th height="229" valign="top" scope="col"><table width="49%" border="1">
<tr>
<th scope="col">Inscris-toi a <span class="Style1">RENCONTRE</span></th>
</tr>
</table>
<table width="100%" border="1">
<tr>
<td colspan="4" align="left"><?php echo $mes1;?></td>
</tr>
<tr>
<td width="36%" align="left">Nom:</td>
<th colspan="3" align="left">
<input name="nom" type="text" id="nom" value="<?php echo $_POST['nom'] ?>" width="190"/> </th>
</tr>
<tr>
<td align="left">Prenom:</td>
<td colspan="3" align="left">
<input name="prenom" type="text" id="prenom" value="<?php echo $_POST['prenom'] ?>" width="190"/></td>
</tr>
<tr>
<td align="left">Adresse mail:</td>
<td colspan="3" align="left">
<input type="text" name="mail" id="mail" width="190"/></td>
</tr>
<tr>
<td height="26" align="left">login:</td>
<td align="left">
<input type="text" name="login" id="login" width="190" autocomplete="off"/> </td>
</tr>
<tr>
<td align="left">Mot de passe:</td>
<td align="left">
<input type="password" name="motpass" id="motpass" width="190" autocomplete="off"/>
</label></td>
</tr>
<tr>
<td align="left">Confirmez-le :</td>
<td colspan="3" align="left">
<input type="password" name="motpass1" id="motpass1" width="190"/> </td>
</tr>
<tr>
<td height="26" align="left">Date de naissance:</td>
<td colspan="3" align="left">
<select name="jour" id="jour">
<?php for ($i=1;$i<32;$i++) {echo '<option value ="'.$i.'">'.$i.'</option>';} ?>
</select>   
<select name="mois" id="mois">
<?php for ($i=1;$i<13;$i++) {echo '<option value ="'.$i.'">'.$i.'</option>';} ?>
</select>   
<select name="annee" id="annee">
<?php for ($i=1970;$i<1996;$i++) {echo '<option value ="'.$i.'">'.$i.'</option>';} ?>
</select></td>
</tr>
<tr>
<td height="26" align="left">Lieu de naissance:</td>
<td align="left"><input type="text" name="lieunais" id="lieunais" width="190"/></td>
</tr>
<tr>
<td colspan="4" align="center">En cliquant sur ce bouton, tu déclares avoir lu et approuvé<br /> <a href="#">la politique de vie privée</a> de rencontre.com</td>
</tr>
<tr>
<td colspan="4" align="center"><label>
<input name="enregistrement" type="submit" id="enregistrement" value="Enregistre-toi !" />
</label></td>
</tr>
</table></th>
</tr>
</table>
</form>
</th>
<th width="40%" height="187" scope="col"><table width="76%" border="1" align="center">
<tr>
<th scope="col">titre</th>
</tr>
<tr>
<td height="136"> </td>
</tr>
</table></th>
</tr>
<tr>
<th height="72" scope="col"> </th>
</tr>
<tr>
<td height="278"> pub</td>
<td rowspan="2"><form id="form2" name="form2" method="post" action="">
<table width="98%" border="1" align="center">
<tr>
<th height="182" scope="col"><table width="100%" border="1" align="center">
<tr>
<th height="42" colspan="2" scope="col"><table width="58%" border="1">
<tr>
<th scope="col">Connexion</th>
</tr>
</table></th>
</tr>
<tr>
<td colspan="2"><?php echo $mess_erreur; ?></td>
</tr>
<tr>
<td width="37%" align="left">E-mail</td>
<td align="left">
<input type="text" name="email" id="email" width="180" autocomplete="off"/>
</td>
</tr>
<tr>
<td align="left">Mot de passe</td>
<td align="left">
<input type="password" name="passwd" id="passwd" width="180" autocomplete="off"/>
</td>
</tr>

<tr>
<td height="25" colspan="2" align="center"><span class="Style1">Mot de passe oublier?</span></td>
</tr>
<tr>
<td height="23" colspan="2" align="center"><label>
<input type="submit" name="connect" id="connect" value="Connexion" />
</label></td>
</tr>
</table></th>
</tr>
</table>
</form>
</td>
</tr>
<tr>
<td height="23"> </td>
</tr>
</table></td>
</tr>
<tr>
<td>footer</td>
</tr>
</table>
</body>
</html>






A voir également:

2 réponses

avion-f16 Messages postés 19246 Date d'inscription dimanche 17 février 2008 Statut Contributeur Dernière intervention 21 avril 2024 4 497
21 mai 2010 à 18:20
Bonjour,

Si j'ai bien compris, tu demandes un script tout cuit, avec les fonctionnalités que tu demandes ?!
0
maravilloss
22 mai 2010 à 00:41
bonjours ,
nop pas du tout je veux que tu m'aides a codé une partie , sinon j'ai deja fais assez de rubrique , il me reste le nombre de visite sur le profile d'un utilisateur et ajouter des amis...
si tu peux m'aider a ces niveux là sa me ferra plaisir !!!!
0
avion-f16 Messages postés 19246 Date d'inscription dimanche 17 février 2008 Statut Contributeur Dernière intervention 21 avril 2024 4 497
22 mai 2010 à 12:45
Pour la gestion des amis, tu peux faire une table contenant deux champs :
id1 : id du premier membre
id2 : id du second membre

Pour savoir si deux membres sont déjà amis, il te suffira de compter le nombre de résultats de cette requête (1 = déjà amis ; 0 = pas encore amis) :
<?php
$idMembre1 = 1;
$idMembre2 = 2;

$sql = 'SELECT COUNT(*) AS nb FROM amis WHERE (id1='.$idMembre1.' AND id2='.$idMembre2.') OR (id1='.$idMembre2.' AND id2='.$idMembre1.')';

$pdo = new PDO('mysql:host=localhost;dbname=db_test','root','');
$req = $pdo->query($sql);
$data = $req->fetch();
$req->closeCursor();
$nb = $data['nb'];

if($nb > 0) {
    echo 'Déjà amis';
} else {
    echo 'Pas encore amis';
}
?>
0