xcmir Posted July 25, 2008 Share Posted July 25, 2008 I have an auction website, and after a certain period of time the auction automaticly closes. (Im using PHP probid). How does that work??? Is there a function embeded in some page(for example index.php) and everytime a user visits the page it excutes a code to check wheater auctions are still valid, if not,close the auction.??If it works like that, does that mean if no one ever visits index.php then the auction would never close???? Or does it work some other way? Currently I have a programmer working for me however I am alittle worried about his abilities as he said he cannot seem to figure out how cron jobs work and is asking for access to "scheduled tasks" in Plesk...is that a resonible request or does he have no idea what he is doing??? Help apperiated, thank you. Quote Link to comment https://forums.phpfreaks.com/topic/116548-how-does-cron-jobs-work/ Share on other sites More sharing options...
samshel Posted July 25, 2008 Share Posted July 25, 2008 I would say this can be done by cron jobs..so the request from your developer can be valid. but instead of giving access you fetch the list of scheduled tasks and pass it on to him... besides this..the method you suggested may also be implemented, dont have idea about probid... Quote Link to comment https://forums.phpfreaks.com/topic/116548-how-does-cron-jobs-work/#findComment-599288 Share on other sites More sharing options...
xcmir Posted July 25, 2008 Author Share Posted July 25, 2008 Hi, as the server I'm on is temporary, is there another way to get around this?? Quote Link to comment https://forums.phpfreaks.com/topic/116548-how-does-cron-jobs-work/#findComment-599304 Share on other sites More sharing options...
samshel Posted July 25, 2008 Share Posted July 25, 2008 what actually is the problem? are the auctions not closed when they need to? Quote Link to comment https://forums.phpfreaks.com/topic/116548-how-does-cron-jobs-work/#findComment-599306 Share on other sites More sharing options...
xcmir Posted July 25, 2008 Author Share Posted July 25, 2008 The auction closes when it needs to, Im just wondering how that works. My programmer is writing another script for me,which automaticly transfers payment from the buyer to the sellers account when the time period of 14 days is up. however the payments are not automaticly sending. He cannot seem to figure out how to solve this and is suggesting I give him access to scheduled tasks..However my argument is: "If a auction can automaticly close after a certain period without scheduled tasks, why cant you get the payment to automaticly transfer into a different account??, both systems use the same logic dont they????" Quote Link to comment https://forums.phpfreaks.com/topic/116548-how-does-cron-jobs-work/#findComment-599318 Share on other sites More sharing options...
cooldude832 Posted July 25, 2008 Share Posted July 25, 2008 You have to think of the auction as not a real thing but a row in a table in a databaste (or multiple rows) The ability to apply a status condition to the auction (such as opened/closed) is based on its DATETME values in the database. Closed is nothing more than a textual representation for a saying (this DATETME is expired). The closing of the auctions occurs purely on the visual basis of the user's ability to alter it nothing magically happens at the second it is over. Quote Link to comment https://forums.phpfreaks.com/topic/116548-how-does-cron-jobs-work/#findComment-599322 Share on other sites More sharing options...
xcmir Posted July 25, 2008 Author Share Posted July 25, 2008 Hi, so what is it that causes the auction to close when end time is up??? No user has done any modifications to the field values in mysql... Quote Link to comment https://forums.phpfreaks.com/topic/116548-how-does-cron-jobs-work/#findComment-599329 Share on other sites More sharing options...
samshel Posted July 25, 2008 Share Posted July 25, 2008 as already mentioned, there can be 2 ways to do it... 1) the one which you mentioned in first post. 2) scheduled tasks. Tell your programmer to prepare the script and run it manually for testing, once it seems to work well, then you can set the scheduled task..he does not need access. scheduled task is a normal PHP script, which is fired at given time intervals, but for development and testing you can fire them manually at given intervals..no need of access to cron.. hope it is clear. Quote Link to comment https://forums.phpfreaks.com/topic/116548-how-does-cron-jobs-work/#findComment-599343 Share on other sites More sharing options...
JonnoTheDev Posted July 25, 2008 Share Posted July 25, 2008 If this was my application then the closing of auctions would definatly be an event trigger. This could be a function in a common include file throughout the site that is run every time a page request is made. This would as other have said check a date time field in a database and set a flag value to indicate the auction is over. If you used a cron job (scheduled task) for this then auctions may not close at the correct time. Lets say you had a cron running every 5 minutes then an aution due to close in 1 minute may remain open for another 4. The idea of using the same method to transfer monies in my opinion is not good at all. So I click on index.php and it triggers a cash transfer between you and the user - wooo bad! What if I close my browser as the script is running? This should definately be a script run via a scheduled cron in a secure area of your webserver. Not in the web root for sure! If your programmer is any good then he should set up the program to report on any errors that may occur with transactions so you can take action. Hope this helps. Quote Link to comment https://forums.phpfreaks.com/topic/116548-how-does-cron-jobs-work/#findComment-599532 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.