PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I apologize if this is a really simple question, but I've been Googling and trial-and-erroring for a week now with no results. Before I pull out my last hair, can somebody help me with this?
I have a voting script that allows only one vote per ip per day. I want to change this to one vote per week. I've been trial-and-erroring myself crazy, and still can't change this, nor do I even know where to look.
I'm pretty sure the answer is somewhere in the section pasted below. Can someone help?
function dbget_exec_SetUserOff($current_id){
if(!dbsec_no_injection("$current_id,0")) return false;
db_exec("UPDATE pv_sessions_simple SET offline='0',time_end=NOW() WHERE id='$current_id' OR TO_DAYS(NOW())-TO_DAYS(time_start)>1");
return 0;
}
return 1;
Last edited by dsdc on Fri Feb 11, 2005 11:27 am, edited 4 times in total.
That was one of my first attempts. It however, just kept people from voting more than once for a couple of hours. People can still vote again after that.
this doesn't feel like the code to me. I mean, there's one query that deals with the user's ip. A different query that deals with date stuff, and another that seems to do voting (yet doesn't store ip).. this doesn't make much sense.