我在向数据库写入IP时遇到问题。
如果我在$ip=$_SERVER['REMOTE_ADDR'];
之后打印$ ip,我获得54.231.128.128。但是,如果我将ip插入数据库,它会插入203223.这是我的代码。
<?php include "db.php";
session_start();
$toemail=$_POST["toemail"];
$report=$_POST["report"];
$ip=$_SERVER['REMOTE_ADDR'];
$fromemail=$_SESSION['nahid'];
$date=(time());
$tatus="Active";
if(!$_POST['submit']) {
echo "Please fill out the form";
} else {
// $query_auto = "INSERT INTO form (date, time) VALUE ('DATE: Auto CURDATE()', CURDATE() )";
mysql_query("INSERT INTO report(`id`, `from`, `msg`, `to`, `date`, `ip`, `status`)
VALUES(NULL,'$fromemail','$report','$toemail','$date', '$ip', '$tatus')") or die(mysql_error());
header('Location: report_congratulations.php');
}
?>