snwspeck Posted December 21, 2010 Share Posted December 21, 2010 Basically I am writing my own voting system but I have a few problems and I would like to address them all in one post rather than three. First: The first thing I need help with is using CURL to check if a user actually voted at the remote top list website. Two: I need maybe a source script of a 10 digit hash generator that will display the hash generated and will insert it into the database This is currently what my hash generator looks like but I need someone to help me change it so that it will echo the actual hash generated and inserts it into the database, <?php function gen_md5_password($len = 6) { return substr(md5(rand().rand()), 0, $len); } ?> Three: I need some sort of way to tell the database that if they hash is not used within 24 hours, it will just dump or delete. Link to comment https://forums.phpfreaks.com/topic/222309-voting-system-with-verification/ Share on other sites More sharing options...
nafetski Posted December 21, 2010 Share Posted December 21, 2010 You won't find yourself having unique tokens with that function. Look into http://php.net/manual/en/function.uniqid.php Link to comment https://forums.phpfreaks.com/topic/222309-voting-system-with-verification/#findComment-1150019 Share on other sites More sharing options...
The Letter E Posted December 21, 2010 Share Posted December 21, 2010 Basically I am writing my own voting system but I have a few problems and I would like to address them all in one post rather than three. First: The first thing I need help with is using CURL to check if a user actually voted at the remote top list website. Two: I need maybe a source script of a 10 digit hash generator that will display the hash generated and will insert it into the database This is currently what my hash generator looks like but I need someone to help me change it so that it will echo the actual hash generated and inserts it into the database, <?php function gen_md5_password($len = 6) { return substr(md5(rand().rand()), 0, $len); } ?> Three: I need some sort of way to tell the database that if they hash is not used within 24 hours, it will just dump or delete. I'm only going to reply with some theory for you to think about: 1. I would recommend using AJAX instead of CURL 2. I would go with nafetski's suggestion for your 'uniqid', If you really want to get crazy you can MD5 hash your uniqid 3. There are two ways I would go about achieving your last request: a. Using a chron that you can run every hour/day/year...etc and deletes all hashes older than 24 hours b. Put something in the script that uses the hash that deletes it before use if it's 24hours old for the hash stuff you will be working with the date() function most likely, although there are other options you can look into. Link to comment https://forums.phpfreaks.com/topic/222309-voting-system-with-verification/#findComment-1150027 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.