este script aqui ele me da o resultado em numeros e com a barra tambem, mas gostaria que fosse em %, ou adicionar ai no script ou tirar o numero e colocar em %.
ai vai os codigos e de onde peguei ele pra saber mais como me ajudar estou mandando o endereco. CJ Dynamic Poll V1.0
-----------<?
include "config.php";
include $pollfile;
include "js_header.php";
if ($Vote) {
$ip = fopen($ipfile, "r");
$contents = fread($ip, filesize($ipfile));
$uip = $REMOTE_ADDR;
if (eregi("$uip", $contents)) {
echo "You voted already! At the next poll you may participate<br><br>"; // just incase
Pergunta
Guest - Richard -
este script aqui ele me da o resultado em numeros e com a barra tambem, mas gostaria que fosse em %, ou adicionar ai no script ou tirar o numero e colocar em %.
ai vai os codigos e de onde peguei ele pra saber mais como me ajudar estou mandando o endereco. CJ Dynamic Poll V1.0
-----------<?
include "config.php";
include $pollfile;
include "js_header.php";
if ($Vote) {
$ip = fopen($ipfile, "r");
$contents = fread($ip, filesize($ipfile));
$uip = $REMOTE_ADDR;
if (eregi("$uip", $contents)) {
echo "You voted already! At the next poll you may participate<br><br>"; // just incase
}
else{
$ip = fopen($ipfile, "a");
fputs ($ip, "<? //$REMOTE_ADDR ?>\n");
fclose ($ip);
$file = fopen($pollfile, "w+");
fputs ($file, "<?\n");
fputs ($file, "\$answer[0] = \"$answer[0]\";\n");
fputs ($file, "\$answer[1] = \"$answer[1]\";\n");
fputs ($file, "\$answer[2] = \"$answer[2]\";\n");
fputs ($file, "\$answer[3] = \"$answer[3]\";\n");
fputs ($file, "\$answer[4] = \"$answer[4]\";\n");
fputs ($file, "\$answer[5] = \"$answer[5]\";\n");
fputs ($file, "\$answer[6] = \"$answer[6]\";\n");
fputs ($file, "\$answer[7] = \"$answer[7]\";\n");
fputs ($file, "\$answer[8] = \"$answer[8]\";\n");
fputs ($file, "\$answer[9] = \"$answer[9]\";\n\n");
if ($Vote == $answer[0]){
$increment = $votes[0] + 1;
fputs ($file, "\$votes[0] = \"$increment\";\n");
}
else{
fputs ($file, "\$votes[0] = \"$votes[0]\";\n");
}
if ($Vote == $answer[1]) { $increment = $votes[1] + 1; fputs ($file, "\$votes[1] = \"$increment\";\n"); } else { fputs ($file, "\$votes[1] = \"$votes[1]\";\n"); }
if ($Vote == $answer[2]) { $increment = $votes[2] + 1; fputs ($file, "\$votes[2] = \"$increment\";\n"); } else { fputs ($file, "\$votes[2] = \"$votes[2]\";\n"); }
if ($Vote == $answer[3]) { $increment = $votes[3] + 1; fputs ($file, "\$votes[3] = \"$increment\";\n"); } else { fputs ($file, "\$votes[3] = \"$votes[3]\";\n"); }
if ($Vote == $answer[4]) { $increment = $votes[4] + 1; fputs ($file, "\$votes[4] = \"$increment\";\n"); } else { fputs ($file, "\$votes[4] = \"$votes[4]\";\n"); }
if ($Vote == $answer[5]) { $increment = $votes[5] + 1; fputs ($file, "\$votes[5] = \"$increment\";\n"); } else { fputs ($file, "\$votes[5] = \"$votes[5]\";\n"); }
if ($Vote == $answer[6]) { $increment = $votes[6] + 1; fputs ($file, "\$votes[6] = \"$increment\";\n"); } else { fputs ($file, "\$votes[6] = \"$votes[6]\";\n"); }
if ($Vote == $answer[7]) { $increment = $votes[7] + 1; fputs ($file, "\$votes[7] = \"$increment\";\n"); } else { fputs ($file, "\$votes[7] = \"$votes[7]\";\n"); }
if ($Vote == $answer[8]) { $increment = $votes[8] + 1; fputs ($file, "\$votes[8] = \"$increment\";\n"); } else { fputs ($file, "\$votes[8] = \"$votes[8]\";\n"); }
if ($Vote == $answer[9]) { $increment = $votes[9] + 1; fputs ($file, "\$votes[9] = \"$increment\";\n"); } else { fputs ($file, "\$votes[9] = \"$votes[9]\";\n"); }
$increment = $total + 1;
fputs ($file, "\$total = \"$increment\";\n");
fputs ($file, "\$ask = \"$ask\";\n");
fputs ($file, "?>");
fclose ($file);
echo "<script LANGUAGE=\"JavaScript\">window.location=\"$PHP_SELF\";</script>\n<noscript><A HREF=\"$PHP_SELF\">Continue...</A></noscript>";
}
}
if ($ask == ""){
echo "<b>$nopoll</b>";
}
else {
$ip = fopen($ipfile, "r");
$contents = fread($ip, filesize($ipfile));
$uip = $REMOTE_ADDR;
// start html code returning results.....................................
if (eregi("$uip", $contents)) {
$ask = stripslashes($ask);
echo "<b>$ask</b><br>";
echo "<small>$votedalready<br><br>$total ";
if ($total == "1"){
echo "Vote";
}
else{
echo "Votos";
}
echo "</small>\n\n";
include($pollfile);
for ($i = 0; $i < count($answer); $i++) {
$answer[$i] = stripslashes($answer[$i]);
if ($answer[$i] == "" && $votes[$i] == ""){
echo "";
}
else{
$percentage = (round(($votes[$i] / $total) * 100, 1));
echo "<br><b>$answer[$i]</b> <small>($votes[$i])</small><br>\n";
echo "<img alt=\"$answer[$i] - $votes[$i] votes ($percentage%)\" style=\"border: 1 solid #000000\" src=$imgurl height=5 width=";
echo (round(($votes[$i] / $total) * 80, 0));
echo ">";
}
}
echo "<br><br><small><A HREF=\"javascript:loadPopupPollArchive()\">$viewarchive</A></small>";
}
else {
$ask = stripslashes($ask);
echo "<b>$ask</b><br>
\n\n";
echo "<table cellpadding=0 cellspacing=0 border=0>\n";
echo " <form name=form method=post><small>\n";
for ($i = 0; $i < count($answer); $i++) {
$answer[$i] = stripslashes($answer[$i]);
if ($answer[$i] == ""){
echo "";
}
else {
echo " <tr>\n";
echo " <td>\n";
echo " <input type=radio name=Vote value=\"$answer[$i]\" id=\"$answer[$i]\">\n";
echo " </td>\n";
echo " <td>";
echo "<small><label for=\"$answer[$i]\">$answer[$i]</label></small>";
echo "</td>\n";
echo " </tr>\n";
}
}
echo "</table>\n\n";
echo "<input type=submit value=\"Vote!\">\n";
echo "</form>\n\n";
echo "<br><small><A HREF=\"http://www.cj-design.com\" TARGET=\"_blank\">CJ Dynamic Poll</A></small>";
}
}
?>
o endereco esta ai no script mesmo!!
valeu ai quem poder me ajudar não sei mexer com codigos PHP!!!
Fiquem com DEus
Link para o comentário
Compartilhar em outros sites
6 respostass a esta questão
Posts Recomendados