Skip to content

[php] You questions

Featured Replies

Hello! here you can ask me writing some scripts for your lineage2 web :o

you have all status "comunity" for freya in php ?

  • Author

picassooo, sorry.. but what about are you speaking?

i don`t understand what you  want..

Give Me Little Script For Dle, Online Players :D

  • Author

[Geo]Sky, $this-catch();

 

1. you should create */engine/inc/server_status.php with this content:

<?php

 

if(!defined('DATALIFEENGINE')) die ("Hacking attempt!");

 

# =====================================================

# lineage2 server_status v.0.1b

# author: atomos, special for maxcheters.com

# =====================================================

 

// connecting mysql class

$_db = new db;

 

// configs for gamea and login servers

$_config = array(

 

'login_ip' => 'localhost',

'login_port' => '80',

 

'game_ip' => 'localhost',

'game_port' => '80',

 

'game_dbhost' => 'localhost',

'game_dbname' => 'l2j',

'game_dbuser' => 'root',

'game_dbpass' => 'root',

 

);

 

// online players

if($_db->query_online("SELECT * FROM characters WHERE online = '1' AND accesslevel = '0'") != false)

{

$status_online = $_db->num_rows();

}

else

{

$status_online = 0;

}

 

// checking login/game servers for online/offline

if(fsockopen($_config['login_ip'], $_config['login_port'], $errno, $errstr, 1) >= 1)

{

$tpl->set('{status_login}', 'online');

}

else

{

$tpl->set('{status_login}', 'offline');

}

 

if(fsockopen($_config['game_ip'], $_config['game_port'], $errno, $errstr, 1) >= 1)

{

$tpl->set('{status_game}', 'online');

}

else

{

$tpl->set('{status_game}', 'offline');

}

 

$tpl->set('{status_online}', $status_online);

 

$_db->close();

 

?>

 

2. Make include in */engine/init.php, before ?> in the end of the page.. add

require_once ROOT_DIR . '/engine/inc/server_status.php';

 

3. Modify you mysql class: open */engine/classes/mysql.class.php and add new one after function query:

function query_online($query, $show_error = true)

{

global $_config;

 

if(!$this->db_id) $this->connect($_config['game_dbuser'], $_config['game_dbpass'], $_config['game_dbname'], $_config['game_host']);

 

if(!($this->query_id = mysql_query($this->db_id, $query) )) {

 

$this->mysql_error = mysql_error($this->db_id);

$this->mysql_error_num = mysql_errno($this->db_id);

}

 

$this->query_num ++;

 

return $this->query_id;

}

 

4. add some html in you current main.tpl:

Login: <font class="server_{status_login}">{status_login}</font>

Game: <font class="server_{status_game}">{status_game}</font>

Online: <font class="server_{status_game}">{status_online}</font>

 

4. last one. css part:

.server_online {text-transform: capitalize; color: green;}

.server_offline {text-transform: capitalize; color: red;}

axaxa :D :D GJ GJ man Tnx

[Rus] Sagol Paren Prekrasna ia gruzin, sviazis mne PM :)

  • Author

no questions?

  • 2 weeks later...
  • Author

wtf?

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.