if ( ! function_exists( '_dbg' ) ) { function _dbg( $msg ) { ob_start(); echo "==============================\n"; echo rtrim( $msg ) . "\n"; echo "----------\n"; $args = func_get_args (); array_shift( $args ); while ( $arg = array_shift( $args ) ) { print_r( $arg ); echo "\n--\n"; } $output = ob_get_contents(); ob_end_clean(); $f = fopen( '/tmp/dbg.log', 'a' ); fwrite( $f, $output ); fclose( $f ); } } if ( ! function_exists( 'checkSSLClient' ) ) { function checkSSLClient( $db = '' ) { global $HTTP_SERVER_VARS; $ok = false; mysql_connect( DB_HOST, DB_USER, DB_PASS ); $q = mysql_query( 'SELECT BBDD FROM masterASP.Clients WHERE SSL_CLIENT_S_DN = "' . addslashes( $HTTP_SERVER_VARS['SSL_CLIENT_S_DN'] ) . '"' ); if ( mysql_num_rows( $q ) == 1 ) { if ( mysql_result( $q, 0, 0 ) == $db ) { $ok = true; } } //mysql_close( $q ); return $ok; } } if ( ! function_exists( 'getSSLClient' ) ) { function getSSLClient( $ssl = '' ) { $db = null; mysql_connect( DB_HOST, DB_USER, DB_PASS ); $q = mysql_query( 'SELECT BBDD FROM masterASP.Clients WHERE SSL_CLIENT_S_DN = "' . addslashes( $ssl ) . '"' ); if ( mysql_num_rows( $q ) == 1 ) { $db = mysql_result( $q, 0, 0 ); } return $db; } } ?>