3raser Posted November 16, 2009 Share Posted November 16, 2009 <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> Quote Link to comment https://forums.phpfreaks.com/topic/181667-solved-why-doesnt-hits-display/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.