La vraie sagesse est de ne pas sembler sage.

Membre
|
Bonjour, je voulais adapté le script images du jour pour faire un " membre du jour ".
Mais se fut une catastrophe, c'est donc ver vous que je me tourne.
Je voudrais utiliser mes champs id et pseudo de ma table membre mais que se qui on 1 au champ valide.
Ça donnerait ça en requête mysql :
$reponse = mysql_unbuffered_query('SELECT id, pseudo FROM membre WHERE valide=\'1\'');
$donnees = mysql_fetch_assoc($reponse);
Sur la page, je souhaiterais qu'il y ait :
<a href="cdv' . $donnees['idPseudo'] . '.html" onclick="window.open(this,\'profil\',\'toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,copyhistory=no,width=520,height=570\');return false;">' . $donnees['pseudo'] . '</a>
Soyez-gentil ! Aidez-moi. x)
|

Admin
|
Bonjour,
Essaye:
<?php
$r1 = mysql_fetch_array(mysql_query('SELECT count(id) as nb FROM membre'));
$count = $r1['nb']-1;
$jour = intval(date('Ymd'))-1;
$valid = true;
while($valid===false)
{
$jour++;
srand($jour);
$r2 = mysql_fetch_array(mysql_query('SELECT id, pseudo, valide FROM membre where id="'.rand(0, $count).'"'));
if($r2['valide']=='1')
{
$valid=true;
}
}
echo '<a href="cdv' . $r2 ['id'] . '.html" onclick="window.open(this,\'profil\',\'toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,copyhistory=no,width=520,height=570\');return false;">' . $r2 ['pseudo'] . '</a>';
?>
Cordialement
|
La vraie sagesse est de ne pas sembler sage.

Membre
|
Merci de m'avoir répondu. =)
J'ai une erreur ( pas sur toute la page, uniquement là où je l'ai placé ).
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/a6045756/public_html/index.php on line 32
Edit : Je sais pas si ça a de l'importance mais mon champ valide est de type ENUM.
|

Membre
|
while($valid===false) ses while($valid==false) ou while($valid=false)
https://guerredesgangs.net & http://www.bazinio.ca & http://www.thestreet2.ca
|
La vraie sagesse est de ne pas sembler sage.

Membre
|
D'accord. =)
tete.php
<?php
$reponse = mysql_query('SELECT * FROM bannIp WHERE ip="' . $_SERVER['REMOTE_ADDR'] . '"') OR die(mysql_error());
$result = mysql_num_rows($reponse);
if((int) $result != 0)
{
setcookie('lol', 1, (time() + 365*24*3600));
echo 'Vous avez été banni du site.';
exit;
}
if(isset($_COOKIE['lol']) && $_COOKIE['lol'] == 1)
{
echo 'Vous avez été banni du site.';
exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" >
<head>
<title>Web Forum</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="title" content="Web Forum" />
<meta name="description" content="Le forum du web !" />
<meta name="keywords" content="web; forum; noutan; script; de; spadox; jeu; video; com; wforum; site; home; forums; inscription; connexion; membres; cdv; outils; amis; equipe; chat; charte; stats, moderation; don; contact; topic; message; admin; discussions; generales; blabla; communautée; suggestion; &; reclammation; actualites; bd; mangas; ecriture; gaming; zone; metiers; mode; musique; paranormale; messagerie; mp; rediger; arcitcle; signature; avatar; presentation; " />
<meta name="language" content="fr" />
<meta name="subject" content="Forum de discutions générale" />
<meta name="robots" content="All" />
<meta name="abstract" content="Un forum n'est rien sans communauté, une communauté doit avoir un forum. Ceux qui était sur Spadox, venait ici." />
<meta name="MSSmartTagsPreventParsing" content="true" />
<meta name="identifier-url" content="http://web-forum.host22.com" />
<meta name="abstract" content="Le forum du web !" />
<meta name="author" content="Noutan" />
<meta name="revisit-after" content="15" />
<meta name="copyright" content="Web Forum" />
<meta name="owner" content="noutan.af@gmail.com" />
<link id="theme" rel="stylesheet" type="text/css" href="style.css" title="theme" />
<link rel="icon" type="image/png" href="favicon.png" />
<script type="text/javascript" src="js.js"></script>
</head>
<body>
<div id="wrapper">
<div id="bg">
<div id="header"></div>
<div id="page">
<div id="container">
<!-- banner -->
<div id="banner"></div>
<!-- end banner -->
<!-- horizontal navigation -->
<div id="nav1">
<ul>
<li id="current" style="border:none">
<a href="index.html">Home</a>
</li>
<li>
<a href="liste-forums.html">Forums</a>
</li>
<?php
//Si lutilisateur est connecte, on lui donne un lien pour modifier ses informations, pour voir ses messages et un pour se deconnecter
if(isset($_SESSION['m']['pseudo']))
{
// On compte le nombre de messages non lus et dont le destinataire est le membre actuellement connecté
$nbr_non_vus = mysql_unbuffered_query("SELECT COUNT(*) AS nbre FROM mp WHERE destinataire='".$_SESSION['m']['pseudo']."' AND vu='0' AND (efface='0' OR efface='2')")or die(mysql_error());
// On en fait un array
$dd = mysql_fetch_assoc($nbr_non_vus);
?>
<li><a href="option.html">Mon Compte</a></li>
<?php
if($nbTopic == 0) // S'il y a 0 messages, on ne fait pas clignoter
{ ?>
<li><a href="mp.php">Messagerie <?php echo'(' . $dd['nbre'] . ')'; ?></a></li>
<?php }
else // Sinon, on le fait clignoter
{ ?>
<li><a href="mp.php">Messagerie <span style="text-decoration:blink;"><?php echo'(' . $dd['nbre'] . ')'; ?></span></a></li>
<?php }
?>
<li><a href="deconnexion.html">Déconnexion</a></li>
<?php
}
else
{
//Sinon, on lui donne un lien pour sinscrire et un autre pour se connecter
?>
<li><a href="inscription.html">Inscription</a></li>
<li><a href="connexion.html">Connexion</a></li>
<?php
}
?>
</ul>
</div>
<!-- end horizontal navigation -->
<!-- content -->
<div id="content">
<div id="center">
index.php
<?php
include('base.php');
include('tete.php');
?>
<div id="bloc2">
<h3>Home</h3>
<div class="texte">
<p>Bienvenue sur Web Forum, le forum du web ! Discuter sur de nombreux aux thèmes variés. De nombreuses fonctions et des outils... =)<br />Passez un bon moment sur Web Forum.<br />
</p></div>
</div>
<br /><center><script type="text/javascript"><!--
google_ad_client = "ca-pub-9546370164086950";
/* Index */
google_ad_slot = "1094467383";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></center><br />
<div id="bloc2">
<h3>Tags Cloud</h3>
<div class="texte">
<center><DIV id="tag_cloud" style="text-align: justify; margin: 0px; padding: 0px; width: 550px; font-weight: bold;"><DIV id="txdiv" style="width: 550px; z-index: 2;"> <A href="http://wforum-site.com/connecte.html" title="Voir la suite" class="tag" id="tag0" style="font-size: 20pt; text-decoration: underline; margin: 2px; color: rgb(148, 184, 0); font-family: Arial,sans-serif; padding: 3px;">Voir la suite</A> <A href="http://wforum-site.com/moderation.html" title="Modération" class="tag" id="tag1" style="font-size: 20pt; text-decoration: underline; margin: 2px; color: rgb(148, 184, 0); font-family: Arial,sans-serif; padding: 3px;">Modération</A> <A href="http://wforum-site.com/inscription.html" title="Inscription" class="tag" id="tag2" style="font-size: 20pt; text-decoration: underline; margin: 2px; color: rgb(3, 155, 171); font-family: Arial,sans-serif; padding: 3px;">Inscription</A> <A href="http://wforum-site.com/amis.html" title="Amis" class="tag" id="tag3" style="font-size: 20pt; text-decoration: underline; margin: 2px; color: rgb(224, 33, 90); font-family: Arial,sans-serif; padding: 3px;">Amis</A> <A href="http://wforum-site.com/contact.html" title="[Contact]" class="tag" id="tag4" style="font-size: 20pt; text-decoration: underline; margin: 2px; color: rgb(148, 184, 0); font-family: Arial,sans-serif; padding: 3px;">[Contact]</A> <A href="http://wforum-site.com/liste-forums.html" title="Forums" class="tag" id="tag5" style="font-size: 20pt; text-decoration: underline; margin: 2px; color: rgb(3, 155, 171); font-family: Arial,sans-serif; padding: 3px;">Forums</A> <A href="http://wforum-site.com/stats.html" title="Stats" class="tag" id="tag6" style="font-size: 20pt; text-decoration: underline; margin: 2px; color: rgb(148, 184, 0); font-family: Arial,sans-serif; padding: 3px;">Stats</A> <A href="http://wforum-site.com/charte.html" title="Charte" class="tag" id="tag7" style="font-size: 20pt; text-decoration: underline; margin: 2px; color: rgb(247, 114, 0); font-family: Arial,sans-serif; padding: 3px;">Charte</A> <A href="http://wforum-site.com/equipe.html" title="L'équipe" class="tag" id="tag8" style="font-size: 20pt; text-decoration: underline; margin: 2px; color: rgb(148, 184, 0); font-family: Arial,sans-serif; padding: 3px;">L'équipe</A> <A href="http://wforum-site.com/chat.html" title="T'chat" class="tag" id="tag9" style="font-size: 20pt; text-decoration: underline; margin: 2px; color: rgb(3, 155, 171); font-family: Arial,sans-serif; padding: 3px;">T'chat</A> <A href="http://wforum-site.com/index.html" title="Home" class="tag" id="tag10" style="font-size: 20pt; text-decoration: underline; margin: 2px; color: rgb(247, 114, 0); font-family: Arial,sans-serif; padding: 3px;">Home</A> <A href="http://wforum-site.com/help.html" title="Nous aidez" class="tag" id="tag11" style="font-size: 20pt; text-decoration: underline; margin: 2px; color: rgb(224, 33, 90); font-family: Arial,sans-serif; padding: 3px;">Nous aidez</A> <A href="http://wforum-site.com#" class="tag" id="tag12" style="font-size: 20pt; text-decoration: underline; margin: 2px; color: rgb(148, 184, 0); font-family: Arial,sans-serif; padding: 3px;"/> <A href="http://wforum-site.com/connexion.html" title="Connexion" class="tag" id="tag13" style="font-size: 20pt; text-decoration: underline; margin: 2px; color: rgb(148, 184, 0); font-family: Arial,sans-serif; padding: 3px;">Connexion</A> <A href="http://wforum-site.com/xnews.html" title="News" class="tag" id="tag14" style="font-size: 20pt; text-decoration: underline; margin: 2px; color: rgb(3, 155, 171); font-family: Arial,sans-serif; padding: 3px;">News</A> </DIV></DIV><script type="text/javascript"> var mo_eff_col1="103CB5"; var mo_eff_col2="FFFFFF"; </script><script src="http://www.tag-cloud-generator.com/FR/js/fx1.js" type="text/javascript"></script>
</center>
<div class="separate"></div>
<?php
$r1 = mysql_fetch_array(mysql_query('SELECT count(id) as nb FROM membre'));
$count = $r1['nb']-1;
$jour = intval(date('Ymd'))-1;
$valid = true;
while($valid===false)
{
$jour++;
srand($jour);
$r2 = mysql_fetch_array(mysql_query('SELECT id, pseudo, valide FROM membre where id="'.rand(0, $count).'"'));
if($r2['valide']=='1')
{
$valid=true;
}
}
echo '<a href="cdv' . $r2 ['id'] . '.html" onclick="window.open(this,\'profil\',\'toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,copyhistory=no,width=520,height=570\');return false;">' . $r2 ['pseudo'] . '</a>';
?>
<br />
<br />
</div>
</div>
<?php
include('pied.php');
?>
pied.php
</div>
<div id="right">
<div id="sidebar">
<h3>Interactif</h3>
<ul class="vmenu">
<li><a href="amis.html">Amis</a></li>
<li><a href="charte.html">Charte</a></li>
<li><a href="chat.html">T'chat</a></li
<li><a href="equipe.html">L'équipe</a></li>
<li><a href="xnews.html">News</a></li>
<li><a href="stats.html">Stats</a></li>
<li><center>----------</center></li>
<li><a href="help.html">Nous aidez</a></li>
<li><a href="moderation.html">Modération</a></li>
</ul>
<h3>Forums</h3>
<ul class="vmenu">
<?php
$reponse = mysql_unbuffered_query('SELECT id, titre FROM forum WHERE statut=\'0\' ORDER BY titre ASC');
while($donnees = mysql_fetch_assoc($reponse))
{
echo '
<li><a href="forum-' . $donnees['id'] . '-1.html">' . $donnees['titre'] . '</a></li>
';
}
?>
</ul>
<h3>Membres connectés</h3>
<ul class="vmenu">
<?php
$reponse = mysql_unbuffered_query('
SELECT
connectes.idPseudo,
membres.pseudo AS `pseudo`
FROM connectes
INNER JOIN membres
ON membres.id = connectes.idPseudo
WHERE idPseudo > 0
ORDER BY pseudo ASC
LIMIT 0, 10
');
while($donnees = mysql_fetch_assoc($reponse))
{
echo '
<li><a href="cdv-' . $donnees['idPseudo'] . '.html" onclick="window.open(this,\'profil\',\'toolbar=no,location=no,directories=no,status=no,scrollbars=yes,resizable=yes,copyhistory=no,width=520,height=570\');return false;">' . $donnees['pseudo'] . '</a></li>
';
}
$reponse = mysql_unbuffered_query('SELECT COUNT(*) AS nb FROM connectes WHERE acces > 0');
$donnees = mysql_fetch_assoc($reponse);
?>
</ul>
<div style="font-weight:bold;margin-top:20px"><img src="images/puce_base.gif" /> <a href="connecte.html">Voir la suite</a> <?php echo '(' . $donnees['nb'] . ' membres connectés)'; ?></div>
<div style="text-align:center;margin:20px 0">
<script type="text/javascript"><!--
google_ad_client = "ca-pub-9546370164086950";
/* MenuDroit */
google_ad_slot = "8904967793";
google_ad_width = 120;
google_ad_height = 600;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
<br /><br /><a href="#"><img src="images/up.png" /></a><br /><strong>Up</strong>
</div>
</div>
</div>
<div class="clear" style="height:40px"></div>
</div>
<!-- end content -->
</div>
<!-- end container -->
</div>
<div id="footerWrapper">
<div id="footer">
<p style="padding-top:10px">
<!--
KEEP THE FOLLOWING CODE IN RESPECT WITH COPYRIGHT OR MAKE
A $10 DONATION AT WWW.DOTEMPLATE.COM IF YOU WANT TO REMOVE IT
-->
<b>Copyright © Web Forum <a href="contact.html">[Contact]</a> - <a href="http://www.dotemplate.com" shape="rect">Web template</a> created with doTemplate
<br />
Inspiré de <a href="http://www.singe4.com/">Spadox</a> et de <a href="http://www.jeuxvideo.com/">jeuxvideo.com</a></b><br />
<br /><i><span id="date_heure"></span><script type="text/javascript">window.onload = date_heure('date_heure');</script> - <?php echo round(chrono()-$debut,6); ?> secondes.</i>
</p>
</div>
</div>
</div>
</div>
</body>
</html>
Voilà. =)
|