Jump to content

Recommended Posts

<html>
<head><title>Dooms day vote - What do you think will happen?...</title>
<style>

body {
     text-align:center;
     font-family:arial;
}

h1 {
   color:red;
}
</style>

<body>

<h1>Dooms day vote</h1>

<?php

$vote = $_GET['vote'];
$ip = $_SERVER['REMOTE_ADDR'];

//prosses of getting the numbers for users

        $construct = "SELECT * FROM votes WHERE ip='$ip'";
        $run = mysql_query($construct);

        $foundnum = (mysql_num_rows($run));

$count_my_page1 = ("yescount.txt");
$hits1 = file($count_my_page1);
$fp1 = fopen($count_my_page1 , "w");
fputs($fp1 , "$hits[0]");
fclose($fp1);

$count_my_page = ("nocount.txt");
$hits = file($count_my_page);
$fp = fopen($count_my_page , "w");
fputs($fp , "$hits[0]");
fclose($fp);

if ($foundnum ==1)
   die("Already voted! Stats: <b>". $hits[0] ."</b> voted yes! <b>". $hits1[0] ."</b> voted no!");

if (!$vote) 
   die("<a href='index.php?vote=yes'>It's going to happen! RUN!</a> || <a href='index.php?vote=no'>It's not going to happen! DUH!</a>");

if ($vote =="yes") {
  
$count_my_page1 = ("yescount.txt");
$hits1 = file($count_my_page1);
$hits1[0] ++;
$fp1 = fopen($count_my_page1 , "w");
fputs($fp1, "$hits1[0]");
fclose($fp1);
echo "A total of ".$hits1[0]." people have voted it's going to happen!";

$write_their_vote = mysql_query("INSERT INTO votes VALUES ('$ip')") or die(mysql_error());
   }

if ($vote =="no") {
   $count_my_page = ("nocount.txt");
$hits = file($count_my_page);
$hits[0] ++;
$fp = fopen($count_my_page , "w");
fputs($fp , "$hits[0]");
fclose($fp);
echo "A total of ".$hits[0]." people have voted it's not going to happen!";

$write_their_vote = mysql_query("INSERT INTO votes VALUES ('$ip')") or die(mysql_error());
   }

?>
</body>
</html>		

Link to comment
https://forums.phpfreaks.com/topic/181667-solved-why-doesnt-hits-display/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.