JewGold Posted January 31, 2009 Share Posted January 31, 2009 I'm developing a simple image board, allowing users to post pictures alongside messages. There are two problems I'm having, both of which deal with MySQL and time functions. The first problem revolves around banning users. When the user is banned, his or her IP address is stored in the database, alongside the length of the ban and the date on which the ban was administered. How a database entry can be deleted after a x number of days? Is this even possible in MySQL? or is this something for a cron job? This would also serve as my spam filter, restricting IP address to post x number of times per minute. My second problem is thread updating. I have two timestamp columns in one table, is it possible to update one and leave the other as is? It seems whenever I run a update query all the timestamp values get updated to now(). I just want one of them to get updated, is this possible? Thanks for any help. Link to comment https://forums.phpfreaks.com/topic/143235-mysql-time-functions-regarding-banningspam-filter-and-timestamps/ Share on other sites More sharing options...
redarrow Posted January 31, 2009 Share Posted January 31, 2009 For a start, you should only let users that are logged in, upload any think at all. You need also to ban user's uploads, via there id, not the ip address, but it does not heart to have there ip in the database as well. if you want to delete all entry's that are older then a set date, then your need to use a cron to open a page and delete them entry's at a set time via the cron. Link to comment https://forums.phpfreaks.com/topic/143235-mysql-time-functions-regarding-banningspam-filter-and-timestamps/#findComment-751190 Share on other sites More sharing options...
JewGold Posted January 31, 2009 Author Share Posted January 31, 2009 Ah ok I found the answer to my second problem - limit As for the deleting entry after a certain time period your right redarrow, that has to be done via cron. There are no user accounts, I'm still deciding on whether or not to include them. Regardless I would still have to tightly secure user uploading. Link to comment https://forums.phpfreaks.com/topic/143235-mysql-time-functions-regarding-banningspam-filter-and-timestamps/#findComment-751196 Share on other sites More sharing options...
redarrow Posted January 31, 2009 Share Posted January 31, 2009 look up interval to delete the correct rows via there date http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html not sure if you can use delete and interval together be nice to no theo Link to comment https://forums.phpfreaks.com/topic/143235-mysql-time-functions-regarding-banningspam-filter-and-timestamps/#findComment-751201 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.