你好,欢迎访问远方教程PC版!
广告位招租

php零基础入门第四章:基于HTTP的Oracle登录

[日期:2014-11-14]   来源:远方教程  作者:远方教程   阅读:2807次[字体: ] 访问[旧版]
 捐赠远方教程 

  本章导读

  4.4 基于HTTP 的Oracle 登录

  将以下代码加在PHP 页面代码之前以确认Oracle 登录。注意你必须正确设定$ SID。
<?
if(!isset($PHP_AUTH_USER))
{
Header("WWW-authenticate: basic realm=&#92;"$SID&#92;"");
Header("HTTP/1.0 401 Unauthorized");
$title="Login Instructions";
echo "<blockquote>
You are not authorized to enter the site
</blockquote> &#92;n";
exit;
}
else
{
if (!($conn=ora_logon("$PHP_AUTH_USER@$SID",$PHP_AUTH_PW)))
{
Header("WWW-authenticate: basic realm=&#92;"$SID&#92;"");
Header("HTTP/1.0 401 Unauthorized");
$title="Login Instructions";
echo "<blockquote>
You are not authorised to enter the site
</blockquote> &#92;n";
exit;
}
}
?>

图片展示
 
相关评论
站长推荐