session_start();
$_SESSION['access'] = TRUE;
session_start();
if (! isset($_SESSION['access']))
{
echo 'Your text of error.';
exit(0);
}
unset($_SESSION['access']);
$curl = curl_init('http://www.example.com');
curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
curl_setopt($curl, CURLOPT_USERPWD, "name:password");
curl_exec($curl);