开发者

Redirect Users Based on Server Traffic

I have a PHP script that finds out the number of users on each of my servers and inputs it into a MySQL database. I want the user to be redirected to the page with the least users on it, defined by the MySQL database.

How can this be done?

Thanks in advance, Callu开发者_如何学Gom


You could use a query on your db that sorts on the number of users.

SELECT ServerColumn FROM Table ORDER BY NumberOfUsersColumn ASC;

That would retrieve the servers ordered by their serverload (as defined in your db).

As for the redirection part you can take a look at http://php.net/manual/en/function.header.php

And use the "Location" header.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜