<?php require_once('Connections/config.php'); ?>
<?php
function GetIP()
{
if(!empty($_SERVER["HTTP_CLIENT_IP"]))
$cip = $_SERVER["HTTP_CLIENT_IP"];
else if(!empty($_SERVER["HTTP_X_FORWARDED_FOR"]))
$cip = $_SERVER["HTTP_X_FORWARDED_FOR"];
else if(!empty($_SERVER["REMOTE_ADDR"]))
$cip = $_SERVER["REMOTE_ADDR"];
else
$cip = "无法获取!";
return $cip;
}
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
} $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}$colname_ip_dir = "-1";
if (isset($_GET['GetIP()'])) {
$colname_ip_dir = $_GET['GetIP()'];
}
mysql_select_db($database_config, $config);
$query_ip_dir = sprintf("SELECT * FROM ip_manag WHERE address = %s", GetSQLValueString($colname_ip_dir, "text"));
$ip_dir = mysql_query($query_ip_dir, $config) or die(mysql_error());
$row_ip_dir = mysql_fetch_assoc($ip_dir);
$totalRows_ip_dir = mysql_num_rows($ip_dir);
?>
<HTML>
<HEAD>
<title>检测操作系统和浏览器类型</title>
<meta http-equiv="Content-Type" content="text/html; charset=gbk" />
</HEAD>
<body><table width="200" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>机构部门</td>
<td>IP地址</td>
<td>使用人</td>
</tr>
<tr>
<td><?php echo $row_ip_dir['agency']; ?></td>
<td><?php echo $row_ip_dir['address']; ?></td>
<td><?php echo $row_ip_dir['name']; ?></td>
</tr>
</table></bady>
</html>
<?php
mysql_free_result($ip_dir);
?>
不知那里错了,现在不显示信息MySQLPHP函数检测
<?php
function GetIP()
{
if(!empty($_SERVER["HTTP_CLIENT_IP"]))
$cip = $_SERVER["HTTP_CLIENT_IP"];
else if(!empty($_SERVER["HTTP_X_FORWARDED_FOR"]))
$cip = $_SERVER["HTTP_X_FORWARDED_FOR"];
else if(!empty($_SERVER["REMOTE_ADDR"]))
$cip = $_SERVER["REMOTE_ADDR"];
else
$cip = "无法获取!";
return $cip;
}
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
} $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}$colname_ip_dir = "-1";
if (isset($_GET['GetIP()'])) {
$colname_ip_dir = $_GET['GetIP()'];
}
mysql_select_db($database_config, $config);
$query_ip_dir = sprintf("SELECT * FROM ip_manag WHERE address = %s", GetSQLValueString($colname_ip_dir, "text"));
$ip_dir = mysql_query($query_ip_dir, $config) or die(mysql_error());
$row_ip_dir = mysql_fetch_assoc($ip_dir);
$totalRows_ip_dir = mysql_num_rows($ip_dir);
?>
<HTML>
<HEAD>
<title>检测操作系统和浏览器类型</title>
<meta http-equiv="Content-Type" content="text/html; charset=gbk" />
</HEAD>
<body><table width="200" border="1" align="center" cellpadding="0" cellspacing="0">
<tr>
<td>机构部门</td>
<td>IP地址</td>
<td>使用人</td>
</tr>
<tr>
<td><?php echo $row_ip_dir['agency']; ?></td>
<td><?php echo $row_ip_dir['address']; ?></td>
<td><?php echo $row_ip_dir['name']; ?></td>
</tr>
</table></bady>
</html>
<?php
mysql_free_result($ip_dir);
?>
不知那里错了,现在不显示信息MySQLPHP函数检测
你的程序并无实际意义