|
You last visited: Today at 08:40
Advertisement
[HELP]SCRIPT PHP PLAYERS ONLINE
Discussion on [HELP]SCRIPT PHP PLAYERS ONLINE within the Dekaron Private Server forum part of the Dekaron category.
11/24/2009, 11:14
|
#1
|
elite*gold: 0
Join Date: Jun 2008
Posts: 472
Received Thanks: 277
|
[HELP]SCRIPT PHP PLAYERS ONLINE
Not know much about PHP I'M WITH A DOUBT AS AGENT IN AN ONLINE PLAYERS SYNTAX WHAT IT IN TIME FOR YOU TO READ THE DATABASE NOT READ NAMES OF FILES CONTAINING "[" SO READ NAMES normally someone can tell me?
EXAMPLE: READING THIS filesdir [DEV], [GM] ...
BELOW IS THE FILE:
PHP Code:
<style type="text/css">
<!--
body,td,th {
font-family: Verdana, Geneva, sans-serif;
color: #FFFF00;
font-weight: bold;
}
body {
background-color: #000;
}
-->
</style><center>
<h1 class="style1"> Players Online </h1>
</style><center>
<?php
$mssql = array(
'host' => "11111",
'user' => "sa",
'pass' => "11111"
);
echo "<center><br><br>";
echo "<table border='1'>
<tr>
<td align='center'>Character Name</td>
<td align='center'>Level</td>
<td align='center'>Map</td>
<td align='center'>Login</td>
</tr>";
$con = mssql_connect($mssql['host'],$mssql['user'],$mssql['pass']);
$result1 = mssql_query("SELECT user_no FROM account.dbo.USER_PROFILE WHERE login_flag = '1100'",$con);
while($row1 = mssql_fetch_row($result1)) {
$result2 = mssql_query("SELECT character_name,wLevel,wMapIndex,login_time FROM character.dbo.user_character WHERE user_no = '".$row1[0]."' ORDER by login_time DESC",$con);
$row2 = mssql_fetch_row($result2);
echo "<tr>
<td align='left'>".$row2[0]."</td>
<td align='center'>".$row2[1]."</td>
<td align='center'>".$row2[2]."</td>
<td align='center'>".$row2[3]."</td>
</tr>";
}
echo "</table></center>";
?>
THANKS.
|
|
|
11/24/2009, 14:10
|
#2
|
elite*gold: 0
Join Date: May 2008
Posts: 863
Received Thanks: 197
|
Don't understand what you want  Have you used translator?
|
|
|
11/24/2009, 14:24
|
#3
|
elite*gold: 0
Join Date: Jun 2008
Posts: 472
Received Thanks: 277
|
Quote:
Originally Posted by gedimazs
Don't understand what you want  Have you used translator?
|
this friend and a php script called playersonline.php when I click it appears all the players who are online on my server including [GM] the question is:
which syntax or code does not appear to use the more [GM] know there is a syntax for this but do not know where to find and place can help?
|
|
|
11/24/2009, 14:34
|
#4
|
elite*gold: 20
Join Date: Jan 2008
Posts: 1,346
Received Thanks: 355
|
Quote:
Originally Posted by arthurvalenca
this friend and a php script called playersonline.php when I click it appears all the players who are online on my server including [GM] the question is:
which syntax or code does not appear to use the more [GM] know there is a syntax for this but do not know where to find and place can help?
|
lol i don't understand what you're talking about either. but if i get what i think you're asking than, there isn't any specific code for getting the [GM] chars. it's just selecting getting all chars that are online.
|
|
|
11/24/2009, 14:39
|
#5
|
elite*gold: 0
Join Date: Jun 2008
Posts: 472
Received Thanks: 277
|
Quote:
Originally Posted by bottomy
lol i don't understand what you're talking about either. but if i get what i think you're asking than, there isn't any specific code for getting the [GM] chars. it's just selecting getting all chars that are online.
|
look my image.
thanks.
|
|
|
11/24/2009, 14:49
|
#6
|
elite*gold: 20
Join Date: Jan 2008
Posts: 1,346
Received Thanks: 355
|
i get what you want now. just add a WHERE character_name <> '[' or something like that i think.
PHP Code:
$result2 = mssql_query("SELECT character_name,wLevel,wMapIndex,login_time FROM character.dbo.user_character WHERE character_name <> '[' AND user_no = '".$row1[0]."' ORDER by login_time DESC",$con);
im not sure if it gonna just check first letter [ or if it gonna check exactly.
EDIT: yeh it gonna check for exactly [ so do this instead
PHP Code:
$result2 = mssql_query("SELECT character_name,wLevel,wMapIndex,login_time FROM character.dbo.user_character WHERE character_name NOT LIKE '[%' AND user_no = '".$row1[0]."' ORDER by login_time DESC",$con);
|
|
|
11/24/2009, 15:50
|
#7
|
elite*gold: 0
Join Date: Jun 2008
Posts: 472
Received Thanks: 277
|
Quote:
Originally Posted by bottomy
i get what you want now. just add a WHERE character_name <> '[' or something like that i think.
PHP Code:
$result2 = mssql_query("SELECT character_name,wLevel,wMapIndex,login_time FROM character.dbo.user_character WHERE character_name <> '[' AND user_no = '".$row1[0]."' ORDER by login_time DESC",$con);
im not sure if it gonna just check first letter [ or if it gonna check exactly.
EDIT: yeh it gonna check for exactly [ so do this instead
PHP Code:
$result2 = mssql_query("SELECT character_name,wLevel,wMapIndex,login_time FROM character.dbo.user_character WHERE character_name NOT LIKE '[%' AND user_no = '".$row1[0]."' ORDER by login_time DESC",$con);
|
dont work.
|
|
|
11/24/2009, 16:28
|
#8
|
elite*gold: 22
Join Date: Jan 2008
Posts: 743
Received Thanks: 450
|
try this way:
PHP Code:
function getgm($gm){
$gmstatus = $gm[0].$gm[1].$gm[2].$gm[3];
if($gmstatus == '[GM]') { Return 'GameMaster'; } else { Return 'User'; }
}
/* her your other code MSSQL ... */
while($row1 = mssql_fetch_row($result1)) { $result2 = mssql_query("SELECT character_name,wLevel,wMapIndex,login_time FROM character.dbo.user_character WHERE user_no = '".$row1[0]."' ORDER by login_time DESC",$con); $row2 = mssql_fetch_row($result2);
if (getgm($row2->character_name) == 'User') {
echo "<tr> <td align='left'>".$row2[0]."</td> <td align='center'>".$row2[1]."</td> <td align='center'>".$row2[2]."</td> <td align='center'>".$row2[3]."</td>
</tr>";
} }
|
|
|
11/24/2009, 16:41
|
#9
|
elite*gold: 20
Join Date: Dec 2007
Posts: 1,451
Received Thanks: 840
|
So u want to retieve GMs from mssql? I can't understand what you want, cuz ur english sucks REALLY bad.
Try this:
PHP Code:
<?php
/* -------------{The get all GMs page by Zombe}------------- */
$MSSQLserverIP = 'localhost'; // IP goes here
$MSSQLusername = 'sa'; // MSSQL username goes here
$MSSQLpassword = 'password'; // MSSQL password goes here
// Don't edit below if you don't know what you are doing.
$link = mssql_connect ("$MSSQLserverIP", "$MSSQLusername", "$MSSQLpassword");
$result = mssql_query("SELECT * FROM character.dbo.user_character WHERE character_name LIKE '_GM%'",$link);
while ($record = mssql_fetch_array($result))
{
echo "$record[character_name]<br>";
}
?>
EDIT: Ohhh, you want to EXCLUDE gms?
ok, do this:
find where it says
PHP Code:
$result2 = mssql_query("SELECT character_name,wLevel,wMapIndex,login_time FROM character.dbo.user_character WHERE user_no = '".$row1[0]."' ORDER by login_time DESC",$con);
And replace it with
PHP Code:
$result2 = mssql_query("SELECT character_name,wLevel,wMapIndex,login_time FROM character.dbo.user_character WHERE user_no = '".$row1[0]."' AND character_name NOT LIKE _GM% ORDER by login_time DESC",$con);
then no gms will show up.
|
|
|
11/24/2009, 18:31
|
#10
|
elite*gold: 0
Join Date: Feb 2008
Posts: 185
Received Thanks: 57
|
Quote:
Originally Posted by Zombe
So u want to retieve GMs from mssql? I can't understand what you want, cuz ur english sucks REALLY bad.
Try this:
PHP Code:
<?php
/* -------------{The get all GMs page by Zombe}------------- */
$MSSQLserverIP = 'localhost'; // IP goes here
$MSSQLusername = 'sa'; // MSSQL username goes here
$MSSQLpassword = 'password'; // MSSQL password goes here
// Don't edit below if you don't know what you are doing.
$link = mssql_connect ("$MSSQLserverIP", "$MSSQLusername", "$MSSQLpassword");
$result = mssql_query("SELECT * FROM character.dbo.user_character WHERE character_name LIKE '_GM%'",$link);
while ($record = mssql_fetch_array($result))
{
echo "$record[character_name]<br>";
}
?>
EDIT: Ohhh, you want to EXCLUDE gms?
ok, do this:
find where it says
PHP Code:
$result2 = mssql_query("SELECT character_name,wLevel,wMapIndex,login_time FROM character.dbo.user_character WHERE user_no = '".$row1[0]."' ORDER by login_time DESC",$con);
And replace it with
PHP Code:
$result2 = mssql_query("SELECT character_name,wLevel,wMapIndex,login_time FROM character.dbo.user_character WHERE user_no = '".$row1[0]."' AND character_name NOT LIKE _GM% ORDER by login_time DESC",$con);
then no gms will show up.
|
That will work but it will exclude any regular player names such as "GGMll" or "sGMres" for example.
You are better off looking for the actual "[GM]" tag by using this at the end:
not like '[GM]%';
or just the bracket
not like '[%';
or even escape it if
not like '![%' escape '!'
Haven't tested these with mssql but they all work in postgresql.
|
|
|
11/24/2009, 23:22
|
#11
|
elite*gold: 0
Join Date: Jun 2008
Posts: 472
Received Thanks: 277
|
Thanks all the correct syntax and
PHP Code:
$result2 = mssql_query("SELECT character_name,wLevel,wMapIndex,login_time FROM character.dbo.user_character WHERE user_no = '".$row1[0]."' AND character_name NOT LIKE '_GM%' ORDER by login_time DESC",$con);
|
|
|
11/25/2009, 09:27
|
#12
|
elite*gold: 20
Join Date: Dec 2007
Posts: 1,451
Received Thanks: 840
|
Quote:
Originally Posted by caper
That will work but it will exclude any regular player names such as "GGMll" or "sGMres" for example.
You are better off looking for the actual "[GM]" tag by using this at the end:
not like '[GM]%';
or just the bracket
not like '[%';
or even escape it if
not like '![%' escape '!'
Haven't tested these with mssql but they all work in postgresql.
|
Seel, in the LIKE sql statement, you can't use [ and ] symbols.
Also, if you know, you can't use GM in your name even without the brackets, if you don't use GM hack, so non-hackers can't make a name like "sGMres".
I could make it with brackets by getting GMs form SQL and the filtering em out with preg_match(), but that's more to think about, and I just wanted to make it quick xD
|
|
|
04/12/2011, 15:39
|
#13
|
elite*gold: 0
Join Date: Oct 2010
Posts: 178
Received Thanks: 86
|
Hy.
Bye.
not good for me.
you normally would not write off that rain is a good file server?
|
|
|
 |
Similar Threads
|
[RELEASE] Script - Number of Players Online
11/05/2013 - Shaiya PServer Guides & Releases - 47 Replies
Updated
Script showing how many players are online, with distinction by race.
Instructions:
Note that for it to work, you need to alter two procedures in PS_GameData and add one colum in PS_GameData.dbo.Chars, LoginStatus. Files with sql code are included.
What it does?
|
[HP]Server script incl REGI FULL IS RANK TOP 10 PLAYERS TOP 10 GUILD ADMIN ADD COINS
03/03/2013 - Metin2 PServer Guides & Strategies - 36 Replies
VER HI-FI ver 2 (FAST SERVER) updated and translated
screenshots:
http://img411.imageshack.us/img411/8049/20327240. jpg
http://img683.imageshack.us/img683/6581/30641525. jpg
http://img697.imageshack.us/img697/93/29191941.jp g
http://img3.imageshack.us/img3/406/96803128.jpg
http://img412.imageshack.us/img412/9854/51065306. jpg
download:
http://www.speedyshare.com/files/21438828/wlasny- ver2.rar
|
[Request] Script to look at Chat logs or Players IP?
09/11/2010 - Shaiya Private Server - 1 Replies
Is there any script to look at the chat logs or players IPs?
My database has that stuff empty.. so... any help would be appreciated.
So please, post the script if you have it :p share summm luv.
|
hi RF online players
12/30/2008 - Say Hello - 0 Replies
hi to all rf online players..dont know how to use CE in RF..have to study it..can you teach me basics..tnx
|
[REQUEST] online players script
10/30/2008 - EO PServer Hosting - 18 Replies
hi all ,
i think that the titel says enouf of what i want to aks , but to be shure i goin write a little more ^^
i aim looking for a script whit a few things
server offline
server online
players online
|
All times are GMT +1. The time now is 08:40.
|
|