conn.php

来自「极限网络智能办公系统 Office Automation V3.0官方100%源」· PHP 代码 · 共 53 行

PHP
53
字号
<?php
 
function openconnection( )
{
	global $MYSQL_SERVER;
	global $MYSQL_USER;
	global $MYSQL_PASS;
	global $MYSQL_DB;
	if ( !( $C = @mysql_pconnect( $MYSQL_SERVER, $MYSQL_USER, $MYSQL_PASS, MYSQL_CLIENT_COMPRESS ) ) )
	{
		$C = mysql_connect( $MYSQL_SERVER, $MYSQL_USER, $MYSQL_PASS );
	}
	if ( !$C )
	{
		printerror( "不能连接到MySQL数据库,请检查:1、MySQL服务是否启动;2、MySQL被防火墙阻止;3、连接MySQL的用户名和密码是否正确。" );
		exit( );
	}
	$result = mysql_select_db( $MYSQL_DB, $C );
	if ( !$result )
	{
		printerror( "数据库 ".$MYSQL_DB."不存在" );
	}
	return $C;
}

function exequery( $C, $Q )
{
	$cursor = mysql_query( $Q, $C );
	if ( !$cursor )
	{
		printerror( "<b>SQL语句:</b> ".$Q );
	}
	return $cursor;
}

function printerror( $MSG )
{
	echo "<fieldset>";
	echo "  <legend><b>错误</b></legend>";
	echo "<b>#".mysql_errno( ).":</b> ".mysql_error( )."<br>";
	global $SCRIPT_FILENAME;
	echo $MSG."<br>";
	echo "<b>文件:</b> ".$SCRIPT_FILENAME;
	echo "</fieldset>";
}

include_once( "inc/oa_config.php" );
if ( !$connection )
{
	$connection = openconnection( );
}
?>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?