I have this script to syubmit game servers for their status. Well I have had a bunch of people submitting server with hateful names that are not real, I wish to show the IP address of the person who submitted it below the server. I have this script, and where it says echo "$ip"; I would like it to save their ip and put it into my database, then show it at my site. my site is http://www.wow-database.net/index.php and as you can see, the last one it the ones I do not want.
<?php
include "./header.php";
/*
CREATE TABLE `servers` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`sname` VARCHAR(30) NOT NULL,
`sip` VARCHAR(16) NOT NULL,
`website` VARCHAR(50),
`lport` INT(5) NOT NULL,
`sport` INT(5) NOT NULL,
`comment` TEXT NOT NULL,
PRIMARY KEY(`id`)
);
*/
$dbh=mysql_connect ("localhost", "yukisho_servers", "") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("yukisho_servers");
echo "<a href='index.php'>Home</a> | ";
echo "<a href='info.html'>Terms of Use</a> | ";
echo "<a href='http://www.wow-database.net/' target='_blank'>GamersLeague</a>";
echo "<a href='./addnew.php'>Add A New Server</a>";
echo "<br>";
echo "<a href='./refresh.php'>Refresh Me!</a>";
echo "<table border='2' bordercolor='black'>";
echo "<tr>";
echo "<td>";
echo "<strong>Current Servers:</strong><br><br>";
$sql = "SELECT * FROM `servers`";
if(!($getServers = mysql_query($sql))) {
echo "ERROR! Cannot retrieve servers.<br>".mysql_error();
} else {
while($s = mysql_fetch_object($getServers)) {
echo "Name: " . $s->sname;
echo "<br>";
$checkLogin = @fsockopen($s->sip, $s->lport, $errno, $errstr, 3);
if(!$checkLogin) {
echo "Server Status: <img src=\"/images/offline.gif\"><br>";
} else {
echo "Server Status: <img src=\"/images/online.gif\"><br>";
}
echo "Website: <a href='$s->website' target='_blank'>$s->website</a>";
echo "<br>";
echo "Registration: <a href='$s->sreg' target='_blank'>Register</a>";
echo "<br>";
echo "Comments: " . $s->comment;
echo "<br>";
echo "<a href='wow://$s->sip:$s->sport' target='_blank'>Connect</a>";
echo "<br>";
echo "$ip";
echo "<br>";
}
}
if(isset($_POST['addServer'])) {
$sql = "INSERT INTO `servers` ( `sname` , `sip` , `website` , `lport` , `sport` , `comment` ) VALUES ('".$_POST['sName']."', '".$_POST['sIP']."', '".$_POST['website']."', '".$_POST['lPort']."', '".$_POST['sPort']."', '".$_POST['comment']."')";
if(!mysql_query($sql)) {
echo "ERROR! Server not added.<br>".mysql_error();
} else {
echo "Server added successfully.";
}
}
echo "</td>";
echo "</tr>";
echo "<br>";
echo "<br>";
echo "<br>";
echo "<tr>";
echo "<td>";
echo "<center>";
echo "<form method=\"POST\" action=\"addnew.php\">";
echo "<input type=\"submit\" name=\"B1\" value=\"Add A New Server\">";
echo "</form>";
echo "</center>";
echo "</td>";
echo "</tr>";
echo "<tr>";
echo "<td>";
echo "<center>";
echo "Need Help Connecting?";
echo "<br>";
echo "Download WoWLauncher <a href='./WoWLauncher.rar'>Here</a>";
echo "</center>";
echo "</td>";
echo "</tr>";
echo "</table>";
include "./footer.php";
?>