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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Posts

    • Creature EnterWorld Invalid NPC or spawn entry.
    • 10-15-2025 - OUR TOPIC IS RELEVANT! CONTACT US BY THE CONTACTS BELOW
    • SELLING EMPTY TELEGRAM BOTS WITH AGE Registration date: November 2024 High-quality & clean bots — no subscribers, no bans, created on fresh IPs. y rested and reliable — perfect for: — Telegram search ranking — any technical or marketing tasks Delivery options: tdata, by phone number, ownership transfer, or via tokens. Current price list: From 3 pcs — $3 each From 20 pcs — $2.5 each From 60 pcs — $2.3 each From 100 pcs — $2.2 each From 400 pcs — $1.9 each Over 15,000+ bots available — ready for instant delivery. Contact on Telegram: @SMMTG6
    • Telegram Bot TOP Search Promotion | SEO Optimization for Bots | SMMTG.PRO We promote Telegram bots to the TOP of search results — by keywords, topics, and countries. What’s included: • Promotion to the TOP of Telegram search • Bot optimization for Telegram algorithms • Competitor analysis and keyword selection • Testing and securing stable ranking Delivery time: 2–3 days per bot Pricing: Starts from $40 per bot (final cost depends on competition level and target country) We work with 50+ countries: Russia • Ukraine • USA • Israel • Uzbekistan • Turkey • China • Thailand • Europe • India Training is also available: Telegram bot SEO optimization Techniques & insights for reaching TOP search positions Real-world cases and recommendations Contact: Telegram — @SMMTG6 Our SMM panel: SMMTG.PRO
    • SMMTG.PRO — TELEGRAM SERVICES PROVIDER PRICE LIST ★ Premium Subscribers for Bots Russia — from $5.6 / 1,000 subs Ukraine — from $5.6 / 1,000 subs USA — from $6.4 / 1,000 subs Israel — from $6.4 / 1,000 subs Uzbekistan — from $6.4 / 1,000 subs Turkey — from $6.4 / 1,000 subs China — from $6.4 / 1,000 subs Thailand — from $6.4 / 1,000 subs Europe — from $6.4 / 1,000 subs India — from $6.4 / 1,000 subs Other countries — from $13 / 1,000 subs OTHER SERVICES Telegram Boost — from $42 / 1,000 votes Premium Subscribers for Channels — from $2.9 / 1,000 Telegram Stars — from $16.9 / 1,000 stars Regular Subscribers for Channels — from $0.19 / 1,000 Regular Subscribers for Bots — from $0.25 / 1,000 Post Reactions — from $0.14 / 1,000 reactions Post Views — from $0.07 / 1,000 views EXCLUSIVE SERVICES ★ Telegram Search TOP Ranking | SEO Optimization ★ Aged Telegram Bots (registered accounts) — from $1.9 / bot ★ Telegram SEO & Search Training PAYMENT METHODS Heleket — any cryptocurrency CrystalPay — RUB | KZT | SBP | CryptoBot & more Payeer — multiple payment options ➤ Website (24/7): SMMTG.PRO ➤ Telegram Channel: t.me/+e_DKWnC5AFw0ZDhi ➤ 24/7 Support: @SMMTG6
  • Topics

×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock