DJTim666 Posted June 21, 2007 Share Posted June 21, 2007 Hi, I have recently started a project, and I need to limit user input. I need to make it so the user can only make 1 guess per day. It will collect all the users/guesses for one day, then at the end of the day(12 AM) I will drop all the guesses so they can start guessing again. So I just need to know how to make it so they can only make 1 guess. Any help is greatly appreciated. -- DJ P.S. All the info is stored in a DB, here is th code I attempted. <?php include ("database.php"); $guess = stripslashes($_GET['guess']); $ranNumber = rand(1, 9999); $winRand = "A78Ghj39eki384"; $username = stripslashes($_GET['user']); $sql = mysql_query("SELECT `username` FROM `users` WHERE username='$username'") or die(mysql_error()); //there is code in here if ($sql >= 1){ echo "Sorry, but you may only guess once per day."; //more code after this ?> Quote Link to comment https://forums.phpfreaks.com/topic/56485-limiting-input/ Share on other sites More sharing options...
pocobueno1388 Posted June 21, 2007 Share Posted June 21, 2007 Make a row in your user table called "guess" and make it so they can only guess if the guess row is set to "n"...meaning they haven't guessed. Then when they do guess, update the guess row to "y". Then when you make your cron file to set all the guesses back, just make the cron set everyones "guess" row to "n" again. Quote Link to comment https://forums.phpfreaks.com/topic/56485-limiting-input/#findComment-278977 Share on other sites More sharing options...
teng84 Posted June 21, 2007 Share Posted June 21, 2007 heres what to do ?? if your talking about registered user then create a field that will determine if they have guessed and condition it to another page having the time and date if not registered user get the ip address and do the same thing above ASTIG!!! Quote Link to comment https://forums.phpfreaks.com/topic/56485-limiting-input/#findComment-278980 Share on other sites More sharing options...
pocobueno1388 Posted June 21, 2007 Share Posted June 21, 2007 IP addresses can be changed, that wouldn't be a good method to use. Quote Link to comment https://forums.phpfreaks.com/topic/56485-limiting-input/#findComment-279023 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.