Forum Moderators: coopster
php code for the script:
------------------------
<?
include("dbConfig.php");
$x = 0;
$y = 350;
do{
$sql = "SELECT url, title, date, FROM `links` ORDER BY id DESC LIMIT ".$x.", ".$y.";";
$rs = mysql_query($sql);
echo mysql_error();
$nr = mysql_num_rows($rs);
while($row = mysql_fetch_row($rs)){
echo "<a target=\"blank\" href=\"".$row[0]."\">".$row[1]."</a> ".$row[2]."\n<br>\n";
}
if($nr !=0){echo "<p><a href=\"#dump\">DUMP YOUR LINK</a></p>";
}
$x = $x + 350;
$y = $y + 350;
} while($nr!=0);
mysql_close();
?>
mysql:
-------
CREATE TABLE `links` (
`id` int(11) NOT NULL auto_increment,
`url` varchar(160) NOT NULL default '',
`title` varchar(100) NOT NULL default '',
`date` date NOT NULL default '0000-00-00',
PRIMARY KEY (`id`)
) TYPE=MyISAM;
a couple things
to add a column to a table in mysql you would use ALTER TABLE [dev.mysql.com]
the problem with stopping everything from a certain IP is that an IP does not uniquely identify a single user. The ip could be from AOL and you could ban all of AOL, which would be a fair number of folks.
Some other criteria for identifying "spam" is likely needed.
You could grab the IP using $_SERVER['REMOTE_ADDR'] and then, as I said, adding that to the insert statement.
You would need to find what is mentioned in the action portion of the form and look in that script for the insert.