Recent Posts
PHP | 6 sec ago
None | 9 sec ago
None | 12 sec ago
C# | 15 sec ago
None | 1 min ago
None | 1 min ago
None | 1 min ago
None | 1 min ago
None | 2 min ago
None | 2 min ago
Sitereport
Find cool info about any domain on the internet?
visit sitereport
Free Subdomains
Want a pastebin.com sub-domain for your community?
learn more...
What is pastebin?
Pastebin is a website that hosts all your text & code on dedicated servers for easy sharing.
learn more...
By Flippz on the 10th of Feb 2010 12:58:08 AM
Download |
Raw |
Embed |
Report
<?php
$userId=$_REQUEST["userId"];
include('config.inc.php');
include('database.inc.php');
$randomUserId=0;
$result =mysql_query("SELECT * FROM chats WHERE userId = $userId ");
while ($row=mysql_fetch_array($result))
{
$randomUserId=$row["randomUserId"];
}
if ($randomUserId == 0)
{
$result=mysql_query("SELECT * FROM users WHERE id <> $userId AND inchat like 'N' ORDER BY RAND() LIMIT 1");
while ($row=mysql_fetch_array($result))
{
$randomUserId=$row["id"];
}
if ($randomUserId != 0)
{
mysql_query("INSERT INTO chats (userId,randomUserId) values($userId, $randomUserId) ");
mysql_query("INSERT INTO chats (userId,randomUserId) values($randomUserId, $userId) ");
mysql_query("UPDATE users SET inchat='Y' WHERE id = $userId ");
mysql_query("UPDATE users SET inchat='Y' WHERE id = $randomUserId ");
}
}
echo $randomUserId;
mysql_close($con);
?>
Submit a correction or amendment below.
Make A New Post