header("Content-type: application/xhtml+xml");
/** To change: database details **/
$db_host = "localhost"; // ip:port
$db_user = "DATABASE_USERNAME";
$db_pass = "DATABASE_PASSWORD";
$db_name = "DATABASE_NAME";
/** end **/
$http_location="http://".$_SERVER["HTTP_HOST"].$_SERVER["PHP_SELF"];
$scrollbar_offset=isset($_GET['scrollbar_offset'])?$_GET['scrollbar_offset']+0:0;
if($scrollbar_offset<0)
$scrollbar_offset=0;
$link = mysql_connect($db_host,$db_user,$db_pass,true);
mysql_select_db($db_name,$link);
if( isset($_GET['shoutbox']) && strlen($_GET['shoutbox'])!=0 ){
$query="SELECT * FROM manialink_shoutbox WHERE login='".$_GET['playerlogin']."' ORDER BY id DESC LIMIT 1";
$result = mysql_query($query, $link);
$to_add = true;
if($result){
if($row = mysql_fetch_assoc($result)) {
//the previous message is the same as this one
$to_add=($row['message']!=htmlspecialchars($_GET['shoutbox']));
}
}
if($to_add){
$query="INSERT INTO manialink_shoutbox VALUES ('', '".$_GET['playerlogin']."','".htmlspecialchars($_GET['nickname'])."','".$_GET['lang']."','".$_GET['path']."','".htmlspecialchars(mysql_real_escape_string($_GET['shoutbox']))."',NOW())";
mysql_query($query, $link);
}
}
echo "\n";
?>
0
default
$query = "SELECT * FROM `manialink_shoutbox` ORDER BY timestamp DESC LIMIT ".$scrollbar_offset.",11";
$result = mysql_query($query,$link);
$i=0;
while($row=mysql_fetch_array($result,MYSQL_ASSOC)){
?>
$i++;
}
mysql_close($link);
?>