Follow along with the video below to see how to install our site as a web app on your home screen.
Бележка: This feature may not be available in some browsers.
<?php
extract($HTTP_GET_VARS);
extract($HTTP_POST_VARS);
$ficdest=explode(".",basename($PHP_SELF));
$ficdest=$ficdest[0].".dat";
$ip = getenv(REMOTE_ADDR);
if(file_exists($ficdest)) {
$compteur=fopen($ficdest, "r");
$old_stats=file($ficdest);
$stats=explode("|", $old_stats[0]);
fclose($compteur);
$new_count=$stats[0];
if ($stats[3] != $ip) {
$new_count +=1;
}
$ip_hit=$ip;
$compteur=fopen($ficdest, "w");
fputs($compteur, "$new_count|$stats[1]|$stats[2]|$ip_hit|$stats[4]");
fclose($compteur);
}
else {
$nouveau_compteur=fopen($ficdest, "w");
fputs($nouveau_compteur, "1|||$ip|");
fclose($nouveau_compteur);
}
if (!empty($envoi)) {
$vote=fopen($ficdest, "r");
$old_stats=file($ficdest);
$stats=explode("|", $old_stats[0]);
fclose($vote);
$nbr_votes=$stats[1];
$moy_votes=$stats[2];
if ($stats[4] != $ip) {
$nbr_votes +=1;
$moy_votes=((($stats[1]*$stats[2])+$note)/$nbr_votes);
}
else { echo "<font face=Verdana size=2 color=red>You have already voted</font>"; }
$ip_vote=$ip;
$vote=fopen($ficdest, "w");
$new_stats=fputs($vote, "$new_count|$nbr_votes|$moy_votes|$stats[3]|$ip_vote");
fclose($vote);
}
print ("<form method=post>");
$old_stats=file($ficdest);
$stats=explode("|", $old_stats[0]);
if ($stats[2] == 5)
{
$star = "images/5star.gif" ;
}
if ($stats[2]>=1)
{
$star = "images/1star.gif" ;
}
if ($stats[2]>=1.5)
{
$star = "images/15star.gif" ;
}
if ($stats[2]>=2)
{
$star = "images/2star.gif" ;
}
if ($stats[2]>=2.5)
{
$star = "images/25star.gif" ;
}
if ($stats[2]>=3)
{
$star = "images/3star.gif" ;
}
if ($stats[2]>=3.5)
{
$star = "images/35star.gif" ;
}
if ($stats[2] >= 4)
{
$star = "images/4star.gif" ;
}
if ($stats[2] >= 4.5)
{
$star = "images/45star.gif" ;
}
if ($stats[2] >= 5)
{
$star = "images/5star.gif" ;
}
if ($stats[2]<=0)
{
$star = "images/00star.gif" ;
}
print ("<table bordercolor=#99999 cellspacing=0 border=0><td width=50% cellspacing=none cellpadding=none align=middle valign=middle border=1><font size=1 face=Verdana color=#999999>Rating: <img src=\"$star\" alt=\"Average rating: $stats[2]\"> $stats[1] Ratings</td><tr></font>");
echo"<td align=middle valign=middle><input type=radio name=note value=5><font face=arial size=2 color=#99999>Excellent";
echo"<input type=radio name=note value=4>Very Good";
echo"<input type=radio name=note value=3>Good";
echo"<input type=radio name=note value=2>Fine";
echo"<input type=radio name=note value=1>Bad";
print ("<input type=hidden name=envoi value=1> <input type=submit value=Rate style=background:#ffcc00;border-width:1;Border-color:#ffcc00;></table></form></font></td>");
?>
На ден или изпбщо за нещо да гласува 1 път?И друг въпрос:TiMaTa каза:и да с ИП сяко ИП може по 1 път да гласува![]()
Тими мисля, че иска да каже следното:TiMaTa каза:Значи за първото ти казвам ... направено е 1 ип да гласува само 1 път но може и ако не те мързина ден да отваряш файла .dat където е с Notepad и да изтриваш вътре писаниците .... :?:
А доколкото за 2рия въпрос нещо не схранах :idea:
if ($stats[2] == 5)
if ($stats[2] >= 5)
{
$star = "images/5star.gif" ;
}
if ($stats[2] >= 6)
{
$star="images/6star.gif";
}
if ($stats[2]<=0)
{
$star = "images/00star.gif" ;
}
echo"<input type=radio name=note value=4>Very Good";
echo"<input type=radio name=note value=3>Good";
echo"<input type=radio name=note value=2>Fine";
echo"<input type=radio name=note value=1>Bad";
Златен си.TiMaTa каза:Да ... то нормално да го има)) но хората сами си го пишат , ако намеря нещо такова ще ти го дам :?:
<?php
$lines = file("rateval.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;
?>
<head>
<meta charset="windows-1251">
</head>
<table align=center valign=center style="background-color: #eaeeaa; border: 2px ridge #ddffdd;">
<tr><td align=center>
<a style="color: green; font-size: 19px; text-decoration: none; " id=dum href="http://www.hscripts.com">
Специално за WT </a></td></tr>
<tr><td>
<table id="dums" align=center width=150 height=25 bgcolor="#009900" cellpadding=0 cellspacing=0 style="font-size: 13px; border: #449944 solid 2px;">
<tr width=150>
<td bgcolor="red" width=<?php echo($perc); ?>>
</td>
<td bgcolor="#F89696" width=<?php echo($rem); ?>>
</td>
<td bgcolor="#ffffff" align=center width=50 style="font-size: 12px; border: #449944 solid 4px; border-bottom-width: 1px; border-top-width: 1px; border-right-width: 1px;">
<?php echo($perc."%" ); ?>
</td>
</tr>
</table>
<script language="javascript">
document.onload = ctck();
function ctck()
{
var sds = document.getElementById("dum");
if(sds == null){alert("You are using a free package.\n You are not allowed to remove the tag.\n");}
}
</script>
<table align=center width=150 height=25 bgcolor="#009900" cellpadding=0 cellspacing=0 style="font-size: 12px; border: #449944 solid 2px;">
<tr bgcolor="#ffffff" >
<td align=center width=80>Общо гласове</td><td align=center style="color: #752824;"><?php echo($count); ?></td>
</tr>
<tr bgcolor="#ffffff">
<td align=center width=70 >Рейтинг</td><td align=center style="color: red;"><?php echo($avg); ?></td>
</tr>
</table>
</td></tr><tr><td>
<form action="rating.php" method="POST" style="font-size: 13px; margin:0px;">
<input name=fname type="hidden" value=<?php 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="Гласувай" style="border: 1px solid green; cursor: pointer;">
</form>
</td></tr></table>
Благодарим ви че гласувахте.<br>
<br>
<br>
Тук измисли си нещо да напишеш...
<html>
<head>
<meta charset="windows-1251">
</head>
<body style="margin:0px;">
<br><br><br>
<table width=50% height=50% align=center valign=center bgcolor=#addaad border=1>
<tr align=center><td align=center>
<table align=center border=1 style="margin-left: 35px; font-size: 13px; border: #449944 solid 2px;">
<tr>
<td align=center>
<?php
$name = $_POST['fname'];
$rat = $_POST['rate'];
$ser=$_SERVER['HTTP_HOST'];
$ref=$_SERVER['HTTP_REFERER'];
$host= parse_url($ref);
$fname = $name;
$rip = $_SERVER['REMOTE_ADDR'];
$lines = file("./rateval.txt");
$rated = false;
if($ser == $host[host])
{
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 && $name!='')
{
$open = fopen("rateval.txt", "a");
fwrite($open,$fname."****".$rip."####"."0000"."%%%%".$rat);
fwrite($open,"\n");
fclose($open);
}
echo("<div align=left style=\"margin-left: 25px; font-size: 13px; border: #449944 solid 1px; padding: 12px;\">");
include "message.txt";
echo("</div>");
?>
</td>
</tr>
</table>
</td></tr></table>
</body>
</html>
<?php
}
?>
File **** IpAddress #### ID%%%% Rating
/hrat/hrat.php****127.0.0.1####0000%%%%5
<?php
$lines = file("rateval.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;
?><head>
<meta charset="windows-1251">
</head>
<table width="259" align=center style="background-color: #eaeeaa; border: 2px ridge #ddffdd;" valign=center>
<tr><td align=center>
<a style="color: green; font-size: 19px; text-decoration: none; " id=dum href="http://www.hscripts.com"></a>
<form action="rating.php" method="POST" style="font-size: 13px; margin:0px;">
<input name=fname type="hidden" value=<?php echo($fname); ?>>
<select name="rate">
<option name=rate value="1">Трагичен:1</option>
<option name=rate value="2">Аматъорски:2</option>
<option name=rate value="3">Среден:3</option>
<option name=rate value="4">Недовършен:4</option>
<option name=rate value="5">Добър:5</option>
</select>
<input type="submit" value="Гласувай" style="border: 1px solid green; cursor: pointer;">
</form>
</td>
</tr>
<tr><td>
<table id="dums" align=center width=150 height=25 bgcolor="#009900" cellpadding=0 cellspacing=0 style="font-size: 13px; border: #449944 solid 2px;">
</table>
<script language="javascript">
document.onload = ctck();
function ctck()
{
var sds = document.getElementById("dum");
if(sds == null){alert("You are using a free package.\n You are not allowed to remove the tag.\n");}
}
</script>
<table align=center width=253 height=25 bgcolor="#009900" cellpadding=0 cellspacing=0 style="font-size: 12px; border: #449944 solid 2px;">
<tr bgcolor="#ffffff">
<td align=center width=96 >Средна оценка : </td>
<td width="33" align=center style="color: red;"><b><?php echo($avg); ?></b></td>
<td align=center width=97>Брой гласували : </td><td width="23" align=center style="color: red;"><b><?php echo($count); ?></b></td>
</tr>
</table>
</td></tr></table>
<html>
<head>
<meta charset="windows-1251">
</head>
<body style="margin:0px;">
<br><br><br>
<table align=center valign=center bgcolor=#addaad border=1>
<tr align=center><td align=center>
<?php
$name = $_POST['fname'];
$rat = $_POST['rate'];
$ser=$_SERVER['HTTP_HOST'];
$ref=$_SERVER['HTTP_REFERER'];
$host= parse_url($ref);
$fname = $name;
$rip = $_SERVER['REMOTE_ADDR'];
$lines = file("./rateval.txt");
$rated = false;
if($ser == $host[host])
{
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 && $name!='')
{
$open = fopen("rateval.txt", "a");
fwrite($open,$fname."****".$rip."####"."0000"."%%%%".$rat);
fwrite($open,"\n");
fclose($open);
}
echo("<div align=left style=\"font-size: 13px;\">");
echo("?????????? ?? ?? ??????????");
echo("</div>");
?>
</td></tr></table>
</body>
</html>
<?php
}
?>
File **** IpAddress #### ID%%%% Rating