开发者

Redirect Users Based on Server Traffic

开发者 https://www.devze.com 2023-01-25 09:42 出处:网络
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 th

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

精彩评论

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