Jump to content

DharmeshPHP

New Members
  • Posts

    4
  • Joined

  • Last visited

DharmeshPHP's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Ahh I'm sorry. Here is the code I've written. <?php mysql_connect("localhost", "**", "**")or die("Failed to connect" . mysql_error()); mysql_select_db("**")or die("failed to select DB" . mysql_error()); $authcode = substr(uniqid(),7,5); $host = gethostbyaddr($_SERVER['REMOTE_ADDR']); $ip = $_SERVER['REMOTE_ADDR']; $time = time(); if(isset($_POST['submit'])) { $sql = mysql_query("SELECT * FROM `authvote`"); if (mysql_num_rows($sql) > 0) { while ($row = mysql_fetch_array($sql)) { if ((time() - $row['time']) > strtotime("+1 minute", $row['time'])) { mysql_query("DELETE FROM `votes` WHERE `auth` = '" . $row['auth'] . "'"); echo 'Yodfu have already voted. wait ' . strtotime("+1 day", $row['time']); } else { echo 'You have already voted. wait ' . strtotime("+1 minute", $row['time']); } } } else { mysql_query("INSERT INTO authvote (auth, time, host, ip) VALUES ('$authcode', '$time', '$host', '$ip')")or die(mysql_error()); echo 'sdfdsfhanks for voting. Your auth code is: ' . $authcode; } } ?> <html> <form method="POST"> <input type="submit" name="submit" value="get auth"/> </form> </html>
  2. Hey guys. So I'm re-coding my vote page for my RSPS as it's boring and outdated. I've created an auth system where users type the auth given after voting. However, I have a slight problem. I'm not quite sure on how to check if a user has voted before the 12 hour limit. When a user submits the button, the time() is stored onto the DB alongside with their auth code, ip and what not.. Could anyone help me out here? Please!
×
×
  • 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.