Re: Cycle through multiple servers....
| From: | Jason Wong | Date: | Thu, 23 Jan 2003 18:00:05 +0000 |
| Subject: | Re: Cycle through multiple servers.... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-132874@lists.php.net to get a copy of this message | ||
On Friday 24 January 2003 00:24, Christopher Ditty wrote:
> Hello all. I have a few servers that I need to check during a login
> process. If the first server fails to connect, then I need to do server #2
> and so on. Below is the code that I am using, but I am unable to get it to
> work like it should. Can anyone offer some advice on how this should be
> accomplushed?
>
> Thanks
>
> CDitty
>
>
> function sConnect($serverID){
> $ds = ldap_connect($serverID);
> return $ds;
> }
Is that above function relevant? You've defined it but it's not being used in
the code below?
> $i = 0;
> do{
> ldapConnect($config['ldapServer'][$i]);
> $i++;
> }while(!$ds && ($i < (count($config['ldapServer']) + 1)));
Anyway you can try something like:
foreach ($config['ldapServer'] as $key => $value) {
if (ldapConnect($value)) { // if successfully connected
$server = $value;
break;
}
}
echo "Connected to server $server";
--
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
/*
I have that old biological urge,
I have that old irresistible surge,
I'm hungry.
*/