Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

"Who is online" script for Ajax chat (can be integrated universally)

This is a very simple script that generates a list of users online in Ajax Chat, and it can be integrated with your website easily using an iframe. You can use notepad++ to paste this into a file named online.php, or you can alternatively download the attached file. You will need to manually configure the database connection settings (on line 2 of the script) but other than that it should work without any need for changes. It also puts the user's username in italics if [Away] is found in the username, which is designed to make it compatible with "AFK" command modifications. You can modify this as needed.


$sql = 'SELECT
$result = mysqli_query($con, $sql);
echo "Users Online: ";
while($row = mysqli_fetch_array($result))
 $away_text = "[Away]"; // This will italicized usernames that have [Away] anywhere in the username. This can be modified as needed. 
 if (strrpos ($row['userName'], $away_text, -1)){
 $string = str_replace("[Away]", "", $row['userName']);
 echo "<i>".$string. "</i>";
 else {
 echo $row['userName'];
 echo ", "; 
 if ($i != 1) {
 echo " <b>".$i." members online</b>";
 else {
 echo " <b>".$i." member online</b>";
Important: : Make sure to use a program such as notepad++ to paste the contents of this file. Otherwise, extra space will be put at the beginning of the file that will make it unexecutable. You may also download the attached file.

I have set this up to be integrated on the index using an iframe at several websites. You can use something like this to integrate this script into any place on your forum or website. Modify this as needed.

<iframe style="display:inline;" src="" height="44px" marginheight="1px" frameborder="0" width="550px" scrolling="auto" seamless>Live Chat <a href="">click here to see who is online. </a></iframe>

Attached Files
.php   online.php (Size: 741 bytes / Downloads: 350) - Our next project...

Possibly Related Threads…
Thread Author Replies Views Last Post
  Discord vs. Ajax Chat vs. IRC Darth-Apple 9 1,651 April 26th, 2020 at 6:30 PM
Last Post: Darth-Apple
  An improved Ajax Chat Darth-Apple 7 10,618 January 26th, 2014 at 8:23 PM
Last Post: Darth-Apple

Users browsing this thread: 1 Guest(s)

Makestation Theme/Design Selector

Contact Us | Makestation | Return to Top | Lite (Archive) Mode | RSS Syndication 
Proudly powered by MyBB 1.8, © 2002-2021
Forum design by Makestation Team © 2020 - a modern day time capsule | Makestation Ajax Chat Hosting