Posted by rey Wed 7th Mar 2007 13:22 - Syntax is PHP - 15 views
Download | New Post | Modify | Hide line numbers
Download | New Post | Modify | Hide line numbers
PHP parser reported no syntax errors in this post!
-
-
//For AJAX!!
-
-
$chatpage="chat.xml";
-
{
-
$send=$_POST['send'];
-
}
-
else
-
{
-
$send=3;
-
}
-
$post=0;
-
$showchat=0;
-
$json= '';
-
-
-
if ($send=='1') // If somebody SENT a message
-
{
-
$message= $_POST['message'];
-
$post=1;
-
}
-
elseif ($send=='2') // If somebody wants ALL messages
-
{
-
$showchat='all';
-
}
-
elseif ($send=='3') // If somebody wants NEW messaages
-
{
-
{
-
$last=$_SESSION['lastid'];
-
}
-
else //should never happen... but who knows
-
{
-
$last=$_POST['last_id'];
-
$_SESSION['lastid']=$last;
-
}
-
$showchat='new';
-
}
-
-
-
$user="guest";
-
$password="fottilaetispiezoindue";
-
$database="naerey";
-
$server='switch-case.org';
-
-
if ($post)
-
{
-
'woot','rofl','ouch','lol','love','<3','lmao');
-
'','',
-
'','',
-
'','',
-
'','',
-
'','',
-
'','',
-
'','',
-
'','');
-
//Smileys!
-
-
$ip_=$_SERVER['REMOTE_ADDR'];
-
$query="INSERT INTO `chat_history` values ( '', '$ip_', '$date_', '$time_', '$name', '$message')";
-
-
$query ="INSERT INTO chat_users VALUES ('$ip_', '$date_', '$time_', '$name', '1') ";
-
$query.="ON DUPLICATE KEY UPDATE date='$date_',time='$time_',posts=posts+1,name='$name' ";
-
}
-
-
-
if ($showchat=='all')
-
{
-
$query="SELECT id,name,message,time FROM ( SELECT id,name,message,time FROM ";
-
$query.="chat_history ORDER BY id DESC LIMIT 10 ) AS tmp ORDER BY id";
-
$i=0;
-
while ($i < $num)
-
{
-
$json.= "\n
$_time $_name: $_message
"; -
++$i;
-
}
-
-
$ip_=$_SERVER['REMOTE_ADDR'];
-
$query ="INSERT INTO chat_users VALUES ('$ip_', '$date_', '$time_', '$name', '1') ";
-
$query.="ON DUPLICATE KEY UPDATE date='$date_',time='$time_',name='$name' ";
-
}
-
elseif($showchat=='new')
-
{
-
$query="SELECT id,name,message,time FROM chat_history WHERE id>$last";
-
$i=0;
-
while ($i < $num)
-
{
-
if ($_name==$name)
-
{
-
$_name='You';
-
}
-
$json.= "\n
$_time $_name: $_message
"; -
++$i;
-
}
-
-
$ip_=$_SERVER['REMOTE_ADDR'];
-
$query ="INSERT INTO chat_users VALUES ('$ip_', '$date_', '$time_', '$name', '1') ";
-
$query.="ON DUPLICATE KEY UPDATE date='$date_',time='$time_'";
-
}
-
-
-
if (!$post)
-
{
-
$query="SELECT max(id) FROM chat_history";
-
$query="SELECT name FROM chat_users WHERE date='$_date' AND time>$_time";
-
$i=0;
-
while ($i < $num)
-
{
-
$users.= "\n
- .$_user.'"'.")'>$_user
"; -
++$i;
-
}
-
if (!$num) { $users.="\n
- none
"; } -
$users.="\n";
-
$_SESSION['lastid']=$id;
-
}
-
else
-
{
-
}
-
?>
PermaLink to this entry https://pastebin.co.uk/11524
Posted by rey Wed 7th Mar 2007 13:22 - Syntax is PHP - 15 views
Download | New Post | Modify | Hide line numbers
Download | New Post | Modify | Hide line numbers
Comments: 0