Well, I have the code below, and its probably not very nice, but it works if someone submits only one line, such as
but if there are line breaks;123.123.123.1 123.123.123.2 123.123.123.3 123.123.123.4 123.123.123.5
it doesnt work.123.123.123.1
123.123.123.2
123.123.123.3
123.123.123.4
123.123.123.5
It also skips the first explode from the post data.
Can anyone help me with these two probelms, thanks
Page for example( http://greyfyre.info/Submit.php )
PHP Code:$counterMax = substr_count($_POST['IP']," ");
for ( $counter = 0; $counter <= $counterMax; $counter += 1) {
$sql = mysql_connect($GLOBALS["dbhost"], $GLOBALS["dbuser"], $GLOBALS["dbpass"]);
$dbHandle = mysql_select_db($GLOBALS["dbname"]);
$IP = explode(' ',$_POST['IP']);
$EMAIL = mysql_real_escape_string($_POST['EMAIL']);
$REASON = mysql_real_escape_string($_POST['REASON']);
$LOG = mysql_real_escape_string($target_path);
$SPARE = gethostbyaddr($_SERVER['REMOTE_ADDR']);
$NewIP = mysql_real_escape_string($IP[$counter]);
$sql = "INSERT INTO `$DB` ( `IP` , `Email` , `Reason` , `Log` , `spare` )
VALUES (
'$NewIP', '$EMAIL', '$REASON', '$LOG', '$SPARE'
);";
$result = mysql_query($sql);
mysql_close($sql);
if (is_resource($rows)) {
} else {
echo mysql_error();
}
}




Reply With Quote