Its possible to execute a php function one time for unique user ? or by user order ?
I mean, if two different user connected in the same time, is possible to execute a php function only for user 1, when finish then execute for user 2…
Some one know how ?
What are you trying to accomplish with this script? A webpage doesn’t see it as "user 1 came, and then user 2 came", it sees it as "user came". If 50 people go to a webpage, the webpage will not know that 50 people are there, it treats each one as unique.
You can do a small trick.
At the beginning of the function create a file and lock the file. And delete the file at the end of the function execution.
Before the function create the file, check if the file is exists, if the file exists, delete the file, if the file is used by other function then the new execution wont be able to delete the file. rest is up to you 😉
web page means accesssing different people from different location. may be it is a single person or it may be thousands of people.Then is it possible to run individual function?.
Actually, what I have understood is OP Native language is not English.
That is why his question was little off-track.
He mean "Whether it is possible to run a function once at a time. i.e, in multi-threading system one function can be run more than once, but in this case op does not want his function to run while one instance is already running."
yes johny10151981, exactly!
because in this function my server connect to another server by an account, so the remote server don’t allow multiple connections of one account…
So when an user run my function then my server connect, but if another user run this function in the same time then my server can’t connect because it’s already connected!
And the real problem is i can’t connect one time and do many things.. so i most connect and disconnect for each user run my function.