22: How to get the user's real IP
PHP Code:--------------------------------------------------------------------------------
?
function Iptype1 () {
if (getenv ("Http_client_ip")) {
Return getenv ("Http_client_ip");
}
else {
return "None";
}
}
function Iptype2 () {
if (getenv ("Http_x_forwarded_for")) {
Return getenv ("Http_x_forwarded_for");
}
else {
return "None";
}
}
function Iptype3 () {
if (getenv ("REMOTE_ADDR")) {
Return getenv ("REMOTE_ADDR");
}
else {
return "None";
}
}
function IP () {
$ip 1 = iptype1 ();
$ip 2 = iptype2 ();
$ip 3 = Iptype3 ();
if (Isset ($ip 1) && $ip 1!= "None" && $ip 1!= "Unknown") {
return $IP 1;
}
ElseIf (Isset ($ip 2) && $ip 2!= "None" && $ip 2!= "Unknown") {
return $IP 2;
}
ElseIf (Isset ($ip 3) && $ip 3!= "None" && $ip 3!= "Unknown") {
return $IP 3;
}
else {
return "None";
}
}
Echo IP ();
?>
--------------------------------------------------------------------------------
23: How to read all records in three days from the database
First, there is a datetime field in the table to record the time,
Format is ' 2003-7-15 16:50:00 '
SELECT * from ' xltxlm ' WHERE to_days (now ())-to_days (' Date ') <= 3;
24: How to remotely link the MySQL database
In the Add user's MySQL table there is a host field, modified to "%", or specifies the IP address that allows the connection, so that you can call it remotely.
$link =mysql_connect ("192.168.1.80:3306", "Root", "");
25: Exactly how to use
Click here
Special characters in regular expressions
26: With Apache, the homepage appears garbled
Method One:
Adddefaultcharset Iso-8859-1 changed to adddefaultcharset off
Method Two:
Adddefaultcharset GB2312