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
| $sql1 = 'SELECT faim,soif,moral,sante,hygiene,confort,condition_physique,forcee,habilite,points,argent FROM joueurs WHERE id='.$_SESSION['id'];
$res1 = mysql_query($sql1) or die (mysql_error());
while($row1 = mysql_fetch_array($res1))
{
$moteur -> set_var('faim_img',traitement($row1['faim']));
$moteur -> set_Var('rouge_faim',bcsub('100',$row1['faim']));
$moteur -> set_var('faim',round($row1['faim'],0));
$moteur -> set_var('soif_img',traitement($row1['soif']));
$moteur -> set_Var('rouge_soif',bcsub('100',$row1['soif']));
$moteur -> set_var('soif',round($row1['soif'],0));
$moteur -> set_var('moral_img',traitement($row1['moral']));
$moteur -> set_Var('rouge_moral',bcsub('100',$row1['moral']));
$moteur -> set_var('moral',round($row1['moral'],0));
$moteur -> set_var('sante_img',traitement($row1['sante']));
$moteur -> set_Var('rouge_sante',bcsub('100',$row1['sante']));
$moteur -> set_var('sante',round($row1['sante'],0));
$moteur -> set_var('hygiene_img',traitement($row1['hygiene']));
$moteur -> set_Var('rouge_hygiene',bcsub('100',$row1['hygiene']));
$moteur -> set_var('hygiene',round($row1['hygiene'],0));
$moteur -> set_var('confort_img',traitement($row1['confort']));
$moteur -> set_Var('rouge_confort',bcsub('100',$row1['confort']));
$moteur -> set_var('confort',round($row1['confort'],0));
$moteur -> set_var('condition_img',traitement($row1['condition_physique']));
$moteur -> set_Var('rouge_condition',bcsub('100',$row1['condition_physique']));
$moteur -> set_var('condition',round($row1['condition_physique'],0));
$moteur -> set_var('force_img',traitement($row1['forcee']));
$moteur -> set_Var('rouge_force',bcsub('100',$row1['forcee']));
$moteur -> set_var('force',round($row1['forcee'],0));
$moteur -> set_var('habilite_img',traitement($row1['habilite']));
$moteur -> set_Var('rouge_habilite',bcsub('100',$row1['habilite']));
$moteur -> set_var('habilite',round($row1['habilite'],0));
if($row1['moral'] < 50)
{$moteur -> set_Var('imagemoral','triste.jpg');}
else
{$moteur -> set_Var('imagemoral','sourire.jpg');}
}
function traitement($taille)
{
if($taille < 0)
{$taille_img = 0;}
elseif($taille > 100)
{$taille_img = 100;}
else
{$taille_img = $taille;}
return $taille_img;
}
$moteur -> parse('results','sante_tpl',true);
$moteur -> p('results'); |
Partager