|
La Communauté Webmaster 
| Pages: [1] |
 |
|
|
|
Auteur |
Sujet: PHP Version 4.3.3 : Probleme (Lu 965 fois) |
|
 |
PHP Version 4.3.3 : Probleme
« sur: le 20-09-2003 a 19:42:27 » |
|
sbwebdesign
Membre récent

Hors-Ligne
Messages: 1

Je suis un lama!
|
Bonjour tout le monde !
Voila, je sais pas pour quelle raison ca ne fonctionne pas, mais selon ma logique, c'est un probleme lors de l'installation de PHP4 sur un webhost.
Voila j'explique tout...
Je vous donne deux URL. Chacune d'elle sont hébergé chez un hébergeur différent.
Je vais vous montrez mon probleme avec l'exemple d'un system de vote.
Premiere URL là ou le script fonctionne
Deuxième URL là ou le script ne fonctionne pas
Pour voir le problême, il faut tout simplement appuyer sur "Votez"
Voici le script de la page "vote.php"
<?php function head() { include('config.php'); echo "<table width=\"140\" border=\"0\" cellpadding=\"1\" cellspacing=\"1\"> <tr><td bgcolor=\"$tableborder\"> <table width=\"140\" border=\"0\" cellpadding=\"0\" cellspacing=\"\" align=\"center\"> <tr><td bgcolor=\"$bgcolor\">"; } function foot () { echo "</td></tr></table></td></tr></table>"; } function record($REMOTE_ADDR) { include('config.php'); $fp=fopen("$ip_file", "a+"); fputs ($fp,$REMOTE_ADDR."][".time()."\n"); fclose($fp); } function check($REMOTE_ADDR) { include('config.php'); global $valid; $ip=$REMOTE_ADDR; $data=file("$ip_file"); $now=time(); foreach ($data as $record) { $subdata=explode("][",$record); if ($now < ($subdata[1]+3600*$timeout)) { if ($ip == $subdata) { $valid=0; break; }}}} //##################### Sauvegarde ############################## function save($answer){ global $answer; include('config.php'); $data=file($datafile); $subdata=explode("][",$data[$answer]); $subdata[2]+=1; $data[$answer]=implode("][", $subdata); $data[$answer]=$data[$answer]."\n"; $fp=fopen($datafile,"w+"); $a=0; do{ fputs($fp,$data[$a]); $a++; }while($a<count($data)); fclose($fp); } //########################## Form ############################ function form($PHP_SELF){ include('config.php'); head(); echo "<font size=\"$fontsize\" face=\"$font\" color=\"$textcolor\"><form method=\"post\" action=\"$PHP_SELF\"><p align=\"center\">"; $data=file($datafile); $question=$data; $nb_options=count($data)-1; echo "<b>$question</b></p>"; for($nb=1;$nb <= $nb_options; $nb++){ $option=explode("][","$data[$nb]"); echo "<input type=\"radio\" name=\"answer\" value=\"$nb\"> "; echo "$option<br>"; } echo "<input type=\"hidden\" name=\"save\" value=\"yes\">"; echo "<p align=\"center\"><input type=\"submit\" name=\"Submit\" value=\"Votez\"></form></font>"; echo "<font size=\"$fontsize\" face=\"$font\" color=\"$textcolor\"><a href=\""; echo $PHP_SELF; echo "?action=results\">Résultats</font></p><br>"; foot(); } //################## Résultats ######################## function results(){ include('config.php'); head(); $data=file($datafile); $nb_answers=count($data); $votes=0; $a=1; do{ $subdata=explode("][",$data[$a]); $votes += $subdata[2]; $a++; }while($a < $nb_answers); $a=1; $b="answerv"; $v=100/$votes; echo "<p align=\"center\"><font size=\"$fontsize\" face=\"$font\" color=\"$textcolor\"><b>$data ($votes votes)</b><br><br>"; do{ $subdata=explode("][",$data[$a]); $av = $subdata[2] * $v; echo "<font size=\"$fontsize\" face=\"$font\" color=\"$textcolor\">$subdata -"; printf(" %01.1f", $av); echo"%<br>"; $p2v = 100-$av; echo "<img src=\"$subdata[1]\" width=\"$av\" height=\"10\"><img src=\"$image\" width=\"$p2v\" height=\"10\"><br>"; $a++; } while ($a < $nb_answers); echo "<br>"; foot(); } //###################### Moteur #################################### check($REMOTE_ADDR); if ($valid=="0"){ results();} elseif ($action=="results") { results(); } elseif ($save=="yes" && $valid!="0") { save($Answer); record($REMOTE_ADDR); results();} elseif ($action=="save" && !empty($valid)) { results(); } elseif ($action!="save" && $valid!="0"){ form($PHP_SELF); } ?>
|
|
Voila ... Tout ce que je sais, c'est que le PHP chez l'hébergeur là ou le script ne fonctionne pas, c'est qu'il vient tout juste d'être installé.
J'espere que quelqu'un sait comment remedier à cela :/
Merci
P.S: J'ai posté le code simplement pour montrer quel fonction il utilise. Le code source n'a rien à voir avec le probleme.
Simon |
|
|
|
|
| Pages:
[1] |
|
|
|
| |
|
|