<?php
// ad.php
putenv ( "oracle_sid=www" );
putenv ( "nls_lang=american_taiwan.zht16big5" );
putenv ( "oracle_home=/home/oracle/product/7.3.2" );
putenv ( "ld_library_path=/home/oracle/product/7.3.2/lib" );
putenv ( "ora_nls=/home/oracle/product/7.3.2/ocommon/nls/admin/data" );
putenv ( "ora_nls32=/home/oracle/product/7.3.2/ocommon/nls/admin/data" );
$handle = ora_logon ( "user38@www" , "iam3849" ) or die;
$cursor = ora_open ( $handle );
ora_commitoff ( $handle );
$query = "select url, banner, alt, priority from ad where priority > 0" ;
ora_parse ( $cursor , $query ) or die;
ora_exec ( $cursor );
$i = $pricount = 0 ;
while( ora_fetch ( $cursor )) {
$ad [ $i ][ 0 ] = ora_getcolumn ( $cursor , 0 );
$ad [ $i ][ 1 ] = ora_getcolumn ( $cursor , 1 );
$ad [ $i ][ 2 ] = ora_getcolumn ( $cursor , 2 );
$ad [ $i ][ 3 ] = ora_getcolumn ( $cursor , 3 );
$pricount += $ad [ $i ][ 3 ];
$i ++;
};
ora_close ( $cursor );
ora_logoff ( $handle );
srand ((double) microtime ()* 1000000 );
$pri = rand ( 1 , $pricount );
$pricount = 0 ;
for(
| 对此文章发表了评论 |
