![]() |
|
|
#1 |
|
Архивный участник
Join Date: Apr 2005
Posts: 599
|
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> |
|
|
|
|
#2 |
|
Архивный участник
Join Date: Apr 2005
Posts: 555
|
Oh excelent, thank you!!!
what about config.php? |
|
|
|
|
#3 |
|
Архивный участник
Join Date: Apr 2005
Posts: 599
|
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 |
|
|
|
|
#4 |
|
Архивный участник
Join Date: Apr 2005
Posts: 599
|
Sakumi - ragezone it is you?
|
|
|
|
|
#5 |
|
Архивный участник
Join Date: Apr 2005
Posts: 196
|
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
|
|
|
|
|
#6 |
|
Архивный участник
Join Date: Apr 2005
Posts: 599
|
I mean, make a php status, script take pladge_id and go Pladge table - take there name and put it in status...
|
|
|
|
|
#7 |
|
Архивный участник
Join Date: Mar 2005
Posts: 442
|
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 |
|
|
|
|
#8 | |
|
Архивный участник
Join Date: Apr 2005
Posts: 196
|
Quote:
order by lev desc limit X |
|
|
|
|
|
#9 |
|
Архивный участник
Join Date: Mar 2005
Posts: 442
|
at least in my query, it works.
Top 50 Top 10 Top 1000... they all work! Oso |
|
|
|
|
#10 |
|
Архивный участник
Join Date: Apr 2005
Posts: 196
|
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 |
|
|
|
|
#11 |
|
Архивный участник
Join Date: Apr 2005
Posts: 599
|
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.
|
|
|
|
|
#12 | |
|
Архивный участник
Join Date: Mar 2005
Posts: 442
|
Quote:
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 |
|
|
|
|
|
#13 |
|
Архивный участник
Join Date: Apr 2005
Posts: 599
|
plz post fuff varisnt here
- my edited script - PLEEEZ
|
|
|
|
|
#14 |
|
Архивный участник
Join Date: Apr 2005
Posts: 196
|
please try again o.O
|
|
|
|
|
#15 |
|
Архивный участник
Join Date: Apr 2005
Posts: 599
|
I'll try again and again and i cant
Riane plz help me...
|
|
|
|
|
#16 |
|
Архивный участник
Join Date: Apr 2005
Posts: 196
|
<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> |
|
|
|
|
#17 |
|
Архивный участник
Join Date: Apr 2005
Posts: 599
|
OOOOOOOOOOO EEEEEEEEEEEEEEEEE
))))))))) THX A LOTrewrite 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 ? )))
|
|
|
|
|
#18 |
|
Архивный участник
Join Date: Apr 2005
Posts: 599
|
I'll do it my self thx
|
|
|
| Thread Tools | Search this Thread |
| Display Modes | |
|
|