» »

Vote script(php)-problem?

Vote script(php)-problem?

AlexUS ::

Hello
Naredu sem eno skripto za glasovanje.
Problem pa je ta, da ko sem skripto testiral v PHPEd programu mi je delal kot bi moralo, a ko sem jo dal na net, mi je vrglo ven error.
Pa tudi štet noče glasov.

Izpiše mi pa tole:

Warning: fopen(plus.txt): failed to open stream: Permission denied in /home/dat1/public_html/votes.php on line 38
Warning: fputs(): supplied argument is not a valid stream resource in /home/dat1/public_html/votes.php on line 40
Warning: fclose(): supplied argument is not a valid stream resource in /home/dat1/public_html/votes.php on line 41
Warning: fopen(neg.txt): failed to open stream: Permission denied in /home/dat1/public_html/votes.php on line 45
Warning: fputs(): supplied argument is not a valid stream resource in /home/dat1/public_html/votes.php on line 46
Warning: fclose(): supplied argument is not a valid stream resource in /home/dat1/public_html/votes.php on line 47

kaj moram spremeniti?
Modrost ni debelost, debela je norost.

ziher ::

Datotekama plus.txt in neg.txt določi da nista read-only.

AlexUS ::

plus.txt in neg.txt nista označena z read-only, niti z hidden.
Saj ne smeta bit, ker se v njih zapisuje št. glasovanja.
Pol se pa iz obeh naredijo procenti za odgovore.

Ka mi je za narediti?
Modrost ni debelost, debela je norost.

Zgodovina sprememb…

  • spremenilo: AlexUS ()

rokpok ::

Če server teče ne unix okolju, bo rešitev chmod.
Rad bi bil pingvin.

AlexUS ::

chmod +plus.txt
chmod +neg.txt
?

tu je del skripte, v kateri prikaže error:
if(isset($_POST['vote'])){
if (!empty($_POST['vote'])){
$vote = $_POST['vote'];
if($vote == "yes") {
$votegd = "plus.txt";
$votebd = "neg.txt";
$abab = "Da";
$baba = "Ne";
} elseif($vote == "no") {
$votegd = "neg.txt";
$votebd = "plus.txt";
$abab = "No";
$baba = "Yes";
} else {
echo "Sorry there was an error.";
}
$fp = fopen($votegd,"r");
$numa = fgets($fp,9999);
fclose($fp);
$fp = fopen($votegd,"w");
$numa += 1;
fputs($fp, $numa);
fclose($fp);
$fpb = fopen($votebd,"r");
$numb = fgets($fpb,9999);
fclose($fpb);
$fpb = fopen($votebd,"w");
fputs($fpb, $numb);
fclose($fpb);
$a = $numa;
$b = $numb;
$num = $a + $b;
$numaa = round($a/$num * 100);
$numbb = round($b/$num * 100);
$anumaa = round($a/$num * 300);
$anumbb = round($b/$num * 300);
$numnum = $a + $b;
Modrost ni debelost, debela je norost.

AlexUS ::

No pa sem le zrihtu.
Preko "file meneger" sem lepo označu .txt datoteke, ter spremenil permission na 777.
Tako da zdej pa dela!

lp
Modrost ni debelost, debela je norost.


Vredno ogleda ...

TemaSporočilaOglediZadnje sporočilo
TemaSporočilaOglediZadnje sporočilo
»

problem z phpjem

Oddelek: Izdelava spletišč
304015 (3428) snow
»

EZ portal problem!

Oddelek: Izdelava spletišč
91245 (1165) roli
»

zapis v datoteko

Oddelek: Izdelava spletišč
5915 (793) sopex
»

php poll

Oddelek: Izdelava spletišč
5894 (828) bodom
»

PHP help!

Oddelek: Programiranje
251602 (1440) rc-car

Več podobnih tem