![]() |
need litle help on php
do anybody have registration system that uses some serial to register?
and can anybody help me how to implement server statisticks based on cached sql data, to decrease server load by webpage? smt like every 2 min procedure will write all statistics data to some file and page takes result from there. like in RUN UO Server statistics ) btw, im using l2cp modded a bit. and another question: how this query from asp should be writen in php query = "SELECT TOP 100 user_data.char_name,user_data.char_id,user_data.ac count_name,TmpD.sumamount,lev,user_data.create_dat e,user_data.use_time,login,logout FROM(SELECT char_id, SUM(item_id) AS sumamount FROM user_item WHERE item_type = 1306 GROUP BY char_id) TmpD INNER JOIN user_data ON TmpD.char_id = user_data.char_id ORDER BY account_name " the problem seems to be in tempD.sumamount, seems like php dont like that dot. sry for my poor engl. ) tnx for any advise |
Quote:
it's SQL |
Top 100[php:1:9758bd6c0c]<?
include("config.php"); mssql_connect($mssql_server,$mssql_user,$mssql_pas s); mssql_select_db($mssql_db); $result=mssql_query(" select char_name, Lev, builder, class, use_time, PK, Duel,gender from user_data where char_name not in (".("'".join("','",$exclude_from_top)."'").") and account_id>0 order by Lev desc"); $online_users=array(); for($x=0;($online_users[$x]=mssql_fetch_assoc($result))&&$x<100;$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> <tr> <td>##</td> <td>Nick</td> <td>Lvl</td> <td>Class</td> <td>Total in game</td> <td>PvP/PK</td> </tr> <?for($x=0;$x<count($online_users);$x++){?> <tr> <td><?=$x+1?></td> <td style="color:<?=$online_users[$x]["gender"]?"#FF8080":"#8080FF"?>"><?=$online_users[$x]["char_name"]?></td> <td><?=$online_users[$x]["Lev"]?></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> <?**?> </table> </body> </html> [/php:1:9758bd6c0c] Refresh in seconds Code:
<head> |
Here is my sample of BAN log php:
[php:1:e13fd394e5]<?php securitycheck($securitycheck); ; if(!isset($frmAccUid)) $frmAccUid=$_POST['frmAccUid']; $frmAccUid = intval($frmAccUid); if($frmAccUid>0) { $userAccId = $frmAccUid; $dbconnect = mssql_connect ($CONFIG['dbaddress'], $CONFIG['dbuser'], $CONFIG['dbpass']); mssql_select_db ($CONFIG['dbdbname'], $dbconnect) or die(print("error")); $query = "UPDATE User_Account SET block_flag=0, block_flag2=0 WHERE uid=".$userAccId; $result = mssql_query($query); if($result) { $str = "ACC UNBANNED: UID = $userAccId;"; echoLn($str); writeLog($str); } else echoLn("ACC (UID = $userAccId) NOT UNBANNED!!"); } $szArqLog = "/home/banlog.log"; <----- !!!! add ur path to file here !!!! $hFile = fopen($szArqLog,"rb"); if(!$hFile) die("Can't open the log file"); $buffer = fread($hFile,filesize($szArqLog)); fclose($hFile); ?> <TABLE align=center border=0> <TR> <TD align=center> <FORM METHOD=POST name='frmUnban' action="home.php?page=banlog"> UNBAN ACC UID: <INPUT TYPE="text" NAME="frmAccUid"> <INPUT TYPE="submit"> </FORM> <TEXTAREA ROWS="30" COLS="80" style="font:10pt;"> <?php echo($buffer); ?> </TEXTAREA> </TD> </TR> </TABLE> [/php:1:e13fd394e5] |
tnx for reply.
for bigboy i got parse error on line 23.. and i have top 100 page. How exactly works that refresh? where to put it and i need it works automaticly, not only then im visiting admin page or else? to vieruemil i need item search by id page.. how make it on php? that sql string doesnt works for me.. got parse errors.. i make it on asp like i post. |
BigBoy wrote an explanation for you at line 23 - "<----- !!!! add ur path to file here !!!!"
just remove it. Th refresh code is only the meta tag Code:
<meta http-equiv="REFRESH" content="90;url=home.php">Code:
<head> </head>If you load the page in browser and let it open, after 90 sec. it goes to the url indicated in the meta-tag. So if the url is the same page, then it reloads it again, and again ... after each 90 sec. What do you mean with search by id? You want to indicate the ID and have as result the item name ? Or you want to search several information about the players, who own the items you want to check? btw the items data is stored in the user_item table (lin2world DB). Try to execute your query in the query analyser and see the results. Code:
SELECT TOP 100 user_data.char_name,user_data.char_id,user_data.account_name,TmpD.sumamount,lev,user_data.create_date,user_data.use_time,login,logout FROM(SELECT char_id, SUM(item_id) AS sumamount FROM user_item WHERE item_type = 1306 GROUP BY char_id) TmpD INNER JOIN user_data ON TmpD.char_id = user_data.char_id ORDER BY account_name ASC |
LoL thx vieruemil for explaining him. i tought the guy will read the code and that he got some more experience with it :/
add for items: U need to create another database to be able to get the Item names. from user_item u can only get item id's without names and descriptions. The easyest was would be to decrypt itemname-e.txt, open the file in word or excel, filter the non needed entryes and create brand new table under lin2world so u can fetch the item ID's for ur webpage. |
Using excel is really a good idea, Bigoy !!!
It's really cool at editing npc's itemdata's (server-side) and easy to find errors :) How didn't I figure up before... :? :wink: |
ok, iv got it with comment without // ) didnt notice that // is missing there.
but now i got error - undefined function securitycheck on line2 ( about autorefresh - do that script create some html or else file from wich main page should get data to decrease server load? about item search, i just need to find users wich have item number.. this is part of my asp page: Code:
|
the code top100 is secure?
Thx a lot |
You can find charnames using a simple sql query like that
Code:
select a.char_name, count(a.char_name) as amount from user_data a |
| All times are GMT. The time now is 15:10. |