if ( count($userpass) == 2 ){ #this part work not for all. #print_r($userpass);die; #<- this can help find out right username and password list($name, $password) = explode(':', $userpass); $_SERVER['PHP_AUTH_USER'] = $name; $_SERVER['PHP_AUTH_PW'] = $password;