All pastes #184930 Raw Edit

Quelqu'un

public text v1 · immutable
#184930 ·published 2006-09-28 13:06 UTC
rendered paste body
//Affichage du sondage. 
    $query = doquery ("SELECT * FROM {{table}} ORDER BY id DESC LIMIT 0,1", "sondage");
    $vote = mysql_fetch_array($query);
   
    if (!empty($vote['question']))
    {
	$question = '<img  width="16px" height="15px" alt="" src="images/login/question.gif" style="vertical-align: middle;"/> <span class="marron2"><b>'.stripslashes($vote['question']).'</b></span><br /><br />';
	$bouton = '<div style="text-align: center" ><input type="image" src="images/login/bouton_voter.gif" class="no_bordure" title="Voter" name="sondage"/></div>';
	}else
	{
	$question = '<span class="marron2"><b>Aucun sondage</b></span>';
	$bouton = '';
	}
	
	$id = $vote['id'];
	
	$sondage = '
	'.$question.'';
    if (!isset($_POST["sondage_x"])) 
	{
	  if(!empty($vote['reponse1']))
        {
        $sondage .= '<input type="radio" value="1" name="reponse" checked> '.stripslashes($vote['reponse1']).'<br />';
        }
        if(!empty($vote['reponse2']))
        {
        $sondage .= '<input type="radio" value="2" name="reponse"> '.stripslashes($vote['reponse2']).'<br />';
        }
        if(!empty($vote['reponse3']))
        {
        $sondage .= '<input type="radio" value="3" name="reponse"> '.stripslashes($vote['reponse3']).'<br />';
        }
        if(!empty($vote['reponse4']))
        {
        $sondage .= '<input type="radio" value="4" name="reponse"> '.stripslashes($vote['reponse4']).'<br />';
        }

   $sondage .= '<br />'.$bouton.'</div></form>';
   }else 
   {

 $save_vote = doquery("UPDATE {{table}} SET resultat1= 'ajouter1', resultat2= 'ajouter2', resultat3= 'ajouter3', resultat4= 'ajouter4' WHERE id='".$vote['id']."'", "sondage");

   $insert_ip = doquery("INSERT INTO {{table}} SET numero='".$vote['id']."', ip='".$_SERVER['REMOTE_ADDR']."'", "sondage_ip");

   $sondage = 'Vote enregistré ('.$_POST['reponse'].')</div></form>';
}