PHP code newbie
Posted: Wed Feb 27, 2013 10:24 am
HI all
I am trying to figure out how to modify an existing script I have to enter in multiple numbers.
I currently have a page that I can enter a spammers IP address, My address as the submitter, attack notes field, selection for blacklist or whitelist, and date added.
Here is my code
What I need to do is in the ipaddress field is instead of submitting just 1 singular ip, I would like to add a whole c class to insert into the database.
So say some spammer is connecting via 192.168.1.6 30 minutes later he will usually send out a message from 192.168.1.78 and another hour later change his ip yet again to another one within his subnet.
So I need to figure out what I need to do to do either an auto increment adding type code to enter say 192.168.1.* to enter all 254 addresses.
The database field is currently set to 15 char to accommodate a normal looking ip address.
If I am posting this in the wrong section I am truly sorry
Thanks for any suggestions
Alex
I am trying to figure out how to modify an existing script I have to enter in multiple numbers.
I currently have a page that I can enter a spammers IP address, My address as the submitter, attack notes field, selection for blacklist or whitelist, and date added.
Here is my code
Code: Select all
<?php
echo "attacknotes:".$_POST['attacknotes']."<br>";
echo "b_or_w:".$_POST['b_or_w']."<br>";
$con = mysql_connect("localhost","user","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("rbldns", $con);
$dateadd = date("Y-m-d H:i:s");
$dateupdated = date("Y-m-d H:i:s");
$sql="INSERT INTO ips (ipaddress, reportedby, attacknotes, b_or_w, dateadded, updated)
VALUES
('$_POST[ipaddress]','$_POST[reportedby]','$_POST[attacknotes]','$_POST[b_or_w]','$dateadd','$dateadd')";
echo $sql;
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($con);
?>So say some spammer is connecting via 192.168.1.6 30 minutes later he will usually send out a message from 192.168.1.78 and another hour later change his ip yet again to another one within his subnet.
So I need to figure out what I need to do to do either an auto increment adding type code to enter say 192.168.1.* to enter all 254 addresses.
The database field is currently set to 15 char to accommodate a normal looking ip address.
If I am posting this in the wrong section I am truly sorry
Thanks for any suggestions
Alex