Checking for collisions on server

I am developing a resource booking application - multiple users, multiple resources. I need to make sure that users do not book the same resource at the same time. The client-side collision checker won’t do the trick as another user’s booking will not be visible until scheduler is refreshed. Unless I’m missing something?
I suspect I need to check for collisions on the server side and I have found the topic viewtopic.php?f=24&t=27563&p=87143
very useful in this regard.

However, the function to check for collisions is potentially very complex - especially if a new event collides with a recurring event, or a recurring event collides with a user event.

So my question is - is there sample code to achieve this? I’m using the Connector and PHP.
Or is there a better way to achieve this - e.g. if I use Live Update, will the client-side collision checker solve the problem?
I will also be providing an app to book a resource from Smartphone so it is even more important to check for collisions on the server side because in initial version, user will not be able to see which resources are available.
Any suggestions appreciated. :bulb:
Thanks.

Or is there a better way to achieve this - e.g. if I use Live Update, will the client-side collision checker solve the problem?

It will in most cases ( chances of conflict is very small - two users creating new event with lesser than 1 second delay ), but it is requires complicated setup, and it will be possible to cheat and create not-allowed event ( through direct js code manipulations )

As for server side checks - you can use php helper class, which will give you info about any other events for defined time span ( including correct processing of recurring istances )

viewtopic.php?f=6&t=18421

Thanks very much Stanislav. This is very helpful.
Will take me a while to work it all out :wink: