steviez Posted September 13, 2008 Share Posted September 13, 2008 Hi, I am making a new file hosting script for my site and need to reset my users bandwidth every 15-30 days. I store the last reset time in the database using php time() but im not sure how to make the code work to reset at the time i say. Any help would be great. Thanks Link to comment https://forums.phpfreaks.com/topic/124069-help-with-user-bandwidth-reset/ Share on other sites More sharing options...
dapaintballer331 Posted September 13, 2008 Share Posted September 13, 2008 Make a cron job via cpanel or command line, to execute php /path/to/your/phpfile.php at a certain date/time every x days Link to comment https://forums.phpfreaks.com/topic/124069-help-with-user-bandwidth-reset/#findComment-640525 Share on other sites More sharing options...
steviez Posted September 13, 2008 Author Share Posted September 13, 2008 im not using cron due to me not having access to it, i want to do it via php but im not sure how to make the code. Link to comment https://forums.phpfreaks.com/topic/124069-help-with-user-bandwidth-reset/#findComment-640532 Share on other sites More sharing options...
pugboy Posted September 13, 2008 Share Posted September 13, 2008 Try: http://onlinecronjobs.com/ Link to comment https://forums.phpfreaks.com/topic/124069-help-with-user-bandwidth-reset/#findComment-640534 Share on other sites More sharing options...
steviez Posted September 13, 2008 Author Share Posted September 13, 2008 i dont want to use cron, just php. Link to comment https://forums.phpfreaks.com/topic/124069-help-with-user-bandwidth-reset/#findComment-640539 Share on other sites More sharing options...
pugboy Posted September 13, 2008 Share Posted September 13, 2008 The problem is, if you don't run it with a program, you have to visit it manually or include a reset function on some pages. Link to comment https://forums.phpfreaks.com/topic/124069-help-with-user-bandwidth-reset/#findComment-640542 Share on other sites More sharing options...
DarkWater Posted September 13, 2008 Share Posted September 13, 2008 cron doesn't actually do anything for this, steviez, it just allows you to execute the PHP code at certain intervals. It's still PHP. Link to comment https://forums.phpfreaks.com/topic/124069-help-with-user-bandwidth-reset/#findComment-640544 Share on other sites More sharing options...
steviez Posted September 13, 2008 Author Share Posted September 13, 2008 I am wanting to include the code in the overall header of the script Link to comment https://forums.phpfreaks.com/topic/124069-help-with-user-bandwidth-reset/#findComment-640549 Share on other sites More sharing options...
DarkWater Posted September 13, 2008 Share Posted September 13, 2008 So you are basically want to delete files older than 30 days? Link to comment https://forums.phpfreaks.com/topic/124069-help-with-user-bandwidth-reset/#findComment-640551 Share on other sites More sharing options...
steviez Posted September 13, 2008 Author Share Posted September 13, 2008 no, i want to reset users bandwidth after say 30 days Link to comment https://forums.phpfreaks.com/topic/124069-help-with-user-bandwidth-reset/#findComment-640552 Share on other sites More sharing options...
DarkWater Posted September 13, 2008 Share Posted September 13, 2008 Okay, so wait. You just want to give them more bandwidth but leave their files on the server? Link to comment https://forums.phpfreaks.com/topic/124069-help-with-user-bandwidth-reset/#findComment-640554 Share on other sites More sharing options...
steviez Posted September 13, 2008 Author Share Posted September 13, 2008 Hi, I am making a new file hosting script for my site and need to reset my users bandwidth every 15-30 days. I store the last reset time in the database using php time() but im not sure how to make the code work to reset at the time i say. Any help would be great. Thanks As i say here i want to reset the bandwidth of each user after 30 days and everything else stays as is. Link to comment https://forums.phpfreaks.com/topic/124069-help-with-user-bandwidth-reset/#findComment-640555 Share on other sites More sharing options...
networkthis Posted September 13, 2008 Share Posted September 13, 2008 are you only allowing them so much "bandwidth" every 30 days..... example 50 Mb per 30 days and you simply want to reset that every 30 days???? Link to comment https://forums.phpfreaks.com/topic/124069-help-with-user-bandwidth-reset/#findComment-640565 Share on other sites More sharing options...
steviez Posted September 13, 2008 Author Share Posted September 13, 2008 Yes thats 100% correct. sorry for all the confusion Link to comment https://forums.phpfreaks.com/topic/124069-help-with-user-bandwidth-reset/#findComment-640570 Share on other sites More sharing options...
steviez Posted September 13, 2008 Author Share Posted September 13, 2008 anyone know how to do this? Link to comment https://forums.phpfreaks.com/topic/124069-help-with-user-bandwidth-reset/#findComment-640655 Share on other sites More sharing options...
steviez Posted September 13, 2008 Author Share Posted September 13, 2008 Would this do it? <?php $member = sql_row("SELECT * FROM members"); $resetTime = strtotime('-30 days'); $nowtime = time(); $lastReset = $member['bandwidth_last_reset']; if (($nowtime - $lastReset) > $resetTime) { echo $member['username']; } ?> Link to comment https://forums.phpfreaks.com/topic/124069-help-with-user-bandwidth-reset/#findComment-640665 Share on other sites More sharing options...
seany123 Posted September 13, 2008 Share Posted September 13, 2008 how do you stop people using bandwidth? using database? Link to comment https://forums.phpfreaks.com/topic/124069-help-with-user-bandwidth-reset/#findComment-640671 Share on other sites More sharing options...
steviez Posted September 13, 2008 Author Share Posted September 13, 2008 their bandwidth is stored in the database and when they are over the set limit they cant use anymore until its reset. Link to comment https://forums.phpfreaks.com/topic/124069-help-with-user-bandwidth-reset/#findComment-640672 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.