Post Pacific  

Go Back   Post Pacific > Lineage 2 > Lineage 2 Server Modifications ONLY!
FAQ Community Calendar Today's Posts Search

Notices

 
 
Thread Tools Search this Thread Display Modes
Old 15.04.2005, 08:22   #1
Domzelan
Архивный участник
 
Join Date: Apr 2005
Posts: 599
Default PHP

This script shows us online status, pladge_id - is number how i can take "name" for pledge_id from Pladge table?

<?
include("config.php");

mssql_connect($mssql_server,$mssql_user,$mssql_pas s);
mssql_select_db($mssql_db);

$result=mssql_query("
select
char_name, pledge_id, builder,
class, use_time,
PK, Duel, align
from user_data
where login>logout AND LOGOUT>0 AND LOGIN>0 AND account_id>=1
order by char_name
");
$online_users=array();
for($x=0;$online_users[$x]=mssql_fetch_assoc($result);$x++){
$online_users[$x]['use_time_h']=round($online_users[$x]['use_time']/3600,1)."h";
};
unset($online_users[count($online_users)-1]);

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<META HTTP-EQUIV="Expires" CONTENT="Fri, Jan 01 1900 00:00:00 GMT">
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Cache-Control" CONTENT="no-cache">
<META http-equiv="Content-Type" content="text/html; charset=windows-1251">
<META http-equiv="content-language" content="en">
<META name="author" content="">
<META HTTP-EQUIV="Reply-to" CONTENT="@.com">
<META name="generator" content="PHPEd 3.1">
<META NAME="description" CONTENT="">
<META name="keywords" content="">
<META NAME="Creation_Date" CONTENT="08/15/2000">
<META name="revisit-after" content="15 days">
<title>Online</title>
</head>
<body>
<table border="1" align=center size=5>
<tr>
<td colspan="5">LineAgeII Server Online:</td>
</tr>
<tr>
<td>Nick</td>
<td>Clan</td>
<td>Class</td>
<td>Total in game</td>
<td>PvP/PK</td>
</tr>
<?for($x=0;$x<count($online_users);$x++)
{?>
<tr>
<td style="color:<?=$online_users[$x]["align"]?"#FF8080":"#8080FF"?>"><?=$online_users[$x]["char_name"]?>
</td>
<td><?=$online_users[$x]["pledge_id"]?></td>
<td><?=$class_list[$online_users[$x]["class"]]?></td>
<td><?=$online_users[$x]["use_time_h"]?></td>
<td><?=$online_users[$x]["Duel"]?>/<?=$online_users[$x]["PK"]?></td>
</tr>
<?}?>
<tr>
<td colspan="3">Total Online:</td>
<td><?=count($online_users)?></td>
</tr>
</table>
</body>
</html>
Domzelan is offline  
Old 15.04.2005, 08:23   #2
Sakumi
Архивный участник
 
Join Date: Apr 2005
Posts: 555
Default

Oh excelent, thank you!!!

what about config.php?
Sakumi is offline  
Old 15.04.2005, 10:20   #3
Domzelan
Архивный участник
 
Join Date: Apr 2005
Posts: 599
Default

This script shows us online status, pladge_id - is number how i can take "name" for pledge_id from Pladge table?
If somebody help me I'll post config.php
Domzelan is offline  
Old 15.04.2005, 10:22   #4
Domzelan
Архивный участник
 
Join Date: Apr 2005
Posts: 599
Default

Sakumi - ragezone it is you?
Domzelan is offline  
Old 15.04.2005, 12:38   #5
Riane
Архивный участник
 
Join Date: Apr 2005
Posts: 196
Default

i guess pledge id is the a number, then search for the clan with that number in the pledge table and ure done having the name, that wasnt much brainpower was it
Riane is offline  
Old 15.04.2005, 13:17   #6
Domzelan
Архивный участник
 
Join Date: Apr 2005
Posts: 599
Default

I mean, make a php status, script take pladge_id and go Pladge table - take there name and put it in status...
Domzelan is offline  
Old 15.04.2005, 17:53   #7
Osito2Dancer
Архивный участник
 
Join Date: Mar 2005
Posts: 442
Default Re: PHP

Instead of this: select char_name, pledge_id, builder, class, use_time, PK, Duel, align from user_data where login>logout AND LOGOUT>0 AND LOGIN>0 AND account_id>=1 order by char_name

do this one:

select user_data.char_name, pledge.pledge_name, user_data.class, user_data.PK, user_data.Duel, user_data.align from user_data, pledge where login>logout AND LOGOUT>0 AND LOGIN>0 AND builder=0 and pledge.pledge_id = user_data.pledge_id order by char_name desc

This way, itll show Char Name, Pledge Name, Class, How many times he has been PK, how many Duels he has fought and Karma at the moment. It'll show only Players (Builder = 0) and it'll show the clan name. Nice select, you should try it in the query analyzer and fix the wrong naming (For instance, im not sure hat pledge is a table inside lin2world, or if the name is called by pledge_name). If you want a top X, just put "select top X" at the beginning and "order by lev desc".

Hope it helps, im here all week for any questions xD

Oso
Osito2Dancer is offline  
Old 15.04.2005, 20:26   #8
Riane
Архивный участник
 
Join Date: Apr 2005
Posts: 196
Default

Quote:
select top X
that works? im always working with limits,
order by lev desc limit X
Riane is offline  
Old 15.04.2005, 21:01   #9
Osito2Dancer
Архивный участник
 
Join Date: Mar 2005
Posts: 442
Default

at least in my query, it works.

Top 50 Top 10 Top 1000... they all work!

Oso
Osito2Dancer is offline  
Old 15.04.2005, 21:40   #10
Riane
Архивный участник
 
Join Date: Apr 2005
Posts: 196
Default

this script is kinda complicated, it could be done very much easier..
well either way, put in config.php
<?
$mssql_server="serverhost/ip";
$mssql_user="SQL user";
$mssql_pass="SQL password";
$mssql_db="lin2world"; //if im not mistaken, put database with player data in here^^
?>


that should make it work
Riane is offline  
Old 16.04.2005, 09:52   #11
Domzelan
Архивный участник
 
Join Date: Apr 2005
Posts: 599
Default

no no no - this is online status, pledge.pledge_id = user_data.pledge_id - shows only players who have CLAN but i need to show who online and his clan name, if hi dont own clan - shows Blank.
Domzelan is offline  
Old 16.04.2005, 16:28   #12
Osito2Dancer
Архивный участник
 
Join Date: Mar 2005
Posts: 442
Default

Quote:
Originally Posted by Domzelan
no no no - this is online status, pledge.pledge_id = user_data.pledge_id - shows only players who have CLAN but i need to show who online and his clan name, if hi dont own clan - shows Blank.
Humm... if you dont put that condition, it'll show a cross-point of results... SQL does that very often xD.

I think Pledge_id = 0 shows blank. do a select to a var in php with the values of pledge_id, and do an if:

varsql = "select pledge_id from pledge"
if (varsql = 0) show "No Clan"

Hope it helps

Oso
Osito2Dancer is offline  
Old 17.04.2005, 12:09   #13
Domzelan
Архивный участник
 
Join Date: Apr 2005
Posts: 599
Default

plz post fuff varisnt here - my edited script - PLEEEZ
Domzelan is offline  
Old 17.04.2005, 12:15   #14
Riane
Архивный участник
 
Join Date: Apr 2005
Posts: 196
Default

please try again o.O
Riane is offline  
Old 17.04.2005, 12:19   #15
Domzelan
Архивный участник
 
Join Date: Apr 2005
Posts: 599
Default

I'll try again and again and i cant Riane plz help me...
Domzelan is offline  
Old 17.04.2005, 12:33   #16
Riane
Архивный участник
 
Join Date: Apr 2005
Posts: 196
Default

<td><?=$online_users[$x]["pledge_id"]?></td>

replace with this

<td>
<?
$clanquery=mssql_query("SELECT pledge_name FROM pledge WHERE pledge_id = '".$online_users[$x]["pledge_id"]."'");
if(!mssql_num_rows($clanquery))
echo"No Clan";
else {
$clan=mssql_fetch_array($clanquery);
echo $clan[pledge_name];
}
?></td>
Riane is offline  
Old 17.04.2005, 16:31   #17
Domzelan
Архивный участник
 
Join Date: Apr 2005
Posts: 599
Default

OOOOOOOOOOO EEEEEEEEEEEEEEEEE ))))))))) THX A LOT
rewrite some... working....

and last - how i can did - if clan have level 3 ore 4 ore 5 - then this clan name shows and if clan level <3 shows No Clan ?)))
Domzelan is offline  
Old 17.04.2005, 16:35   #18
Domzelan
Архивный участник
 
Join Date: Apr 2005
Posts: 599
Default

I'll do it my self thx
Domzelan is offline  
 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 21:37.