// disable all warning, because they might interfere with header()
$eLevel = error_reporting(0);
// set environment variables for Oracle
PutEnv( "ORACLE_HOME=/u01/app/oracle/product/7.3.4");
PutEnv( "ORACLE_SID=CIS");
// construct Oracle username
$username = 'ops$' . 'username';
// try to log into Oracle
$connHandle = ora_logon($username . '@cisora', 'password');
// check if connect was successful
if ($connHandle <= 0) {
// connect was not successful, wrong username and/or password
// be nice and ask again
Header( "WWW-authenticate: basic realm=\"Oracle Realm\"");
Header( "HTTP/1.0 401 Unauthorized");
printf( "Invalid username/password");
exit;
}
// use connHandle to get a cursor
$cursor = ora_open($connHandle);
if (!$cursor) {
printf("Could not get cursor!\n");
exit;
}
?>