hej udvikleren
jeg har været inde på denne sids
Linkfor at downloade en afstemnings boks.
jeg har lagt filern e ind på min side men når jeg så stemmer får jeg disse fejl.
arning: fopen(./rate.txt) [function.fopen]: failed to open stream: Permission denied in /home/a7747720/public_html/rating.php on line 47
Warning: fwrite(): supplied argument is not a valid stream resource in /home/a7747720/public_html/rating.php on line 48
Warning: fclose(): supplied argument is not a valid stream resource in /home/a7747720/public_html/rating.php on line 50
hvad har jeg gjort galt
mine php filer ser sådan ud
index.php
<?php
include("./header.txt");
$lines = file("./rate.txt");
$count = 0;
$ratc = 0;
$fname = $_SERVER['SCRIPT_NAME'];
foreach ($lines as $line_num => $line)
{
$firstPos = strpos($line,'****');
$id = substr($line,0,$firstPos);
if($id == $fname)
{
$firstPos = strpos($line,'%%%%');
$rat = substr($line,$firstPos+4,$line.length-1);
$count = $count+1;
$ratc = $ratc+$rat;
}
}
if($count==0)
{
$avg = 0;
}else{
$avg = round($ratc/$count*100)/100;
}
$perc = round( (100/5)*$avg);
$rem = 100-$perc;
?>
<div align=center valign=center >
<table id="dums" align=center width=150 height=25 bgcolor="#009900" cellpadding=0 cellspacing=0 class=border2>
<tr width=150>
<td bgcolor="red" width=<? echo($perc); ?>>
</td>
<td bgcolor="#F89696" width=<? echo($rem); ?>>
</td>
<td bgcolor="#ffffff" align=center width=50 class=border">
<? echo($perc."%" ); ?>
</td>
</tr>
</table>
<table align=center width=150 height=25 bgcolor="#009900" cellpadding=0 cellspacing=0 class=border>
<tr bgcolor="#ffffff" >
<td align=center width=80>Total Votes</td><td align=center style="color: #752824;"><? echo($count); ?></td>
</tr>
<tr bgcolor=#ffffff>
<td align=center width=70 >Avg Rating</td><td align=center style="color: red;"><? echo($avg); ?></td>
</tr>
</table>
<form action="/rating.php" method="POST" >
<input name=fname type="hidden" value=<? echo($fname); ?>>
<input name=rate type="radio" value="1">1
<input name=rate type="radio" value="2">2
<input name=rate type="radio" value="3">3
<input name=rate type="radio" value="4">4
<input name=rate type="radio" value="5" checked>5
<input type="submit" value="Rate It" style="border: 1px solid green; cursor: pointer;">
</form>
<a class="link" href="http://www.xantus-webdevelopment.com">Tool by - © Xantus WEBdevelopment</a>
</div>
rating.php
<?
include "header.txt";
?>
<table align=center border=1 style="margin-left: 5px;" class=border2>
<tr>
<td align=center>
<?
$name = $_POST['fname'];
$rat = $_POST['rate'];
$fname = $name;
$rip = $_SERVER['REMOTE_ADDR'];
$lines = file("./rate.txt");
$rated = false;
foreach ($lines as $line_num => $line)
{
$firstPos = strpos($line,$rip);
if(!($firstPos === false))
{
$secPos = strpos($line,$fname);
if(!($secPos === false))
{
$rated=true;
break;
}
}
}
if($rated === false)
{
$open = fopen("./rate.txt", "a");
fwrite($open,$fname."****".$rip."####"."0000"."%%%%".$rat);
fwrite($open,"\n");
fclose($open);
}
echo("<table align=center valign=middle class=thanks width=* height=*><tr><td>");
include "message.txt";
echo("</td></tr></table>");
?>
</td>
</tr>
</table>
<?php
include "footer.txt";
?>
håber i vil hjælpe mig