Jump to content

Recommended Posts

Posted

Hello Ladies. I want to share my create Max Online PHP Script. I think many of you search this and can't find. So let's start:

 

create maxonline.sql and write

 

/*
MySQL Data Transfer
Source Host: localhost
Source Database: l2jdb
Target Host: localhost
Target Database: l2jdb
Date: 21.08.2010 14:10:39
*/

SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for maxonline
-- ----------------------------
DROP TABLE IF EXISTS `maxonline`;
CREATE TABLE `maxonline` (
  `MaxOnline` text
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

-- ----------------------------
-- Records 
-- ----------------------------
INSERT INTO `maxonline` VALUES ('1');

 

Next execute this sql file in Navicat.

 

now create in root directory of site maxonline.php and write

 

<?php 
$mysql_host="localhost";    // MySQL Host             [localhost] 
$mysql_port="3306";            // MySQL Port                              [3306] 
$mysql_db="l2jdb";            // MySQL Database    [l2jdb] 
$mysql_login="root";        // MySQL User                             [root]     
$mysql_password="master";        // MySQL Password                            [root] 
$link = mysql_connect($mysql_host, $mysql_login, $mysql_password) or die("<br>Could not connect: " .mysql_error()); 
@mysql_select_db($mysql_db, $link); 
?> 
<? 
$sql = mysql_query("SELECT count(*) FROM characters WHERE online = 1") or die("Invalid query: " .mysql_error()); 
    $playsonline = mysql_result($sql, 0, 0);

$sql = mysql_query("SELECT maxonline FROM maxonline") or die("Invalid query: " .mysql_error()); 

    $playsmaxonline = mysql_result($sql, 0, 0); 

if($playsmaxonline < $playsonline)
{ mysql_query("UPDATE maxonline SET maxonline='$playsonline'") or die("Invalid query: " .mysql_error());  }



?> 
<?php echo $playsmaxonline; ?>

 

then include this file in your template :)

 

Credits to me

  • 3 weeks later...
  • 5 months later...
  • 3 weeks later...
Posted

Why do you need a whole table just to get the max online users? Why just using plain text on it.

Like GetOnlinePlayers example: 20 and set it like 20/500 (max online: 500).

No offence just saying :) because too many database connection first will slow the database + will slow the website.

 

Oups now see it old topic :S

  • 4 months later...
Posted

To be honest, this script is a nightmare from performance standpoint. Getting online player count EVERY time, when the page loads? I don't think so. It's much better to make it a cron job and execute it every minute or so. Only 60 queries per hour. And as ~LoL~ZozOQ stated: don't use mysql for this task. A plain text file would do just fine.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Posts

    • Website: https://l2aurum.com/  Discord: https://discord.gg/l2aurum   Hello Everyone,  finally, the moment has arrived: I'm launching my own server, L2Aurum!   L2Aurum x300 Closed Beta Test - Start: 17.02.2025  [20:00 GMT+2] Grand Opening 21.02.2025 [20:00 GMT+2]     Experience Rates: x300 Skill Points Rates: x300 Adena Drop: x300 Premium Accounts: x2 Drop Rates: x1 Spoil Rates: x1 Quest Rates: x1 Only one account per player, no dualboxing allowed. Everything is earned through gameplay, no pay-to-win mechanics. No server wipes—your progress is permanent. Fair play is a priority, with no room for corruption. All players are treated equally, no special favors.     Buffs slots: 26+4, all buffs in NPC and Scheme System. Custom Armors: Aurum Apella Armor Custom Weapons: Aurum Weapon Custom Accessories: +300 P.Def & M.Def Tattoos: Mage & Fighter & Custom Shirts Custom Jewels: New Grand Bosses Auto Farm is FREE for everyone. Status Noblesse: Barakiel. Player Spawn Protection: 10 seconds. Geodata e Panthodes: ENABLED. All Commands are visible in .menu. System 2 Bishop Per Party: ENABLED. Boss Protect - Anti-Zerg: ENABLED.     Siege Duration: 2 hours (120 minutes). Siege Period: Every 7 days. Castle Reward: 100E Per Castle. Available Castles: Rune Aden Giran Giran Siege: Every Friday 20:00 GMT +2. Aden Siege: Every Saturday 20:00 GMT +2. Rune Siege: Every Sunday 20:00 GMT +2. Main Clan: 40 Members max. Royal Clan: 12 Members max. Knight Clan: 7 Members max. Alliance: You can have only 1.     Epic Boss Valakas: Monday 22:30 (GMT+2) Zaken: Tuesday | Thursday 22:30 (GMT+2) Queen Ant: Monday | Wednesday 22:30 (GMT+2) Baium: Friday 22:30 (GMT+2) Antharas: Saturday 22:30 (GMT+2) Orfen: Tuesday | Thursday | Saturday 18:30 (GMT+2) Core: Monday | Wednesday | Friday | Sunday 18:30 (GMT+2)   Raid Boss  Flame Of Splendor Barakiel Last Hit: Every Day Respawn 3-4 hours Ember: Every Day Respawn 3-4 hours Lilith: Every Day Respawn 3-4 hours Anakim: Every Day Respawn 3-4 hours Queen Shyeed: Every Day Respawn 3-4 hours Golkonda: Every Day Respawn 3-4 hours Shuriel: Every Day Respawn 3-4 hours Varka's Hero Shadith: Every Day Respawn 3-4 hours Ketra's Hero Hekaton: Every Day Respawn 3-4 hours Varka's Mos: Every Day Respawn 3-4 hours Chief Horus: Every Day Respawn 3-4 hours Ketra's Tayer: Every Day Respawn 3-4 hours Chief Brakki: Every Day Respawn 3-4 hours Sailren: Every Day Respawn 02:00   🥳🥳🥳🥳 I would like to chat personally with all of you over on our Discord and discuss any suggestions or feedback you might have.      Website: https://l2aurum.com/  Discord: https://discord.gg/l2aurum
    • DISCORD : https://discord.com/users/325653525793210378 utchiha_market telegram : https://t.me/utchiha_market SELLIX STORE : https://utchihamkt.mysellix.io/ Join our server for more products : https://discord.gg/uthciha-services https://campsite.bio/utchihaamkt
    • DISCORD : https://discord.com/users/325653525793210378 utchiha_market telegram : https://t.me/utchiha_market SELLIX STORE : https://utchihamkt.mysellix.io/ Join our server for more products : https://discord.gg/uthciha-services https://campsite.bio/utchihaamkt
    • DISCORD : https://discord.com/users/325653525793210378 utchiha_market telegram : https://t.me/utchiha_market SELLIX STORE : https://utchihamkt.mysellix.io/ Join our server for more products : https://discord.gg/uthciha-services https://campsite.bio/utchihaamkt
    • DISCORD : https://discord.com/users/325653525793210378 utchiha_market telegram : https://t.me/utchiha_market SELLIX STORE : https://utchihamkt.mysellix.io/ Join our server for more products : https://discord.gg/uthciha-services https://campsite.bio/utchihaamkt
  • Topics

×
×
  • Create New...