Post Pacific  

Go Back   Post Pacific > Восстановленный архив > Темы без сохранившегося раздела
FAQ Community Calendar Today's Posts Search

Notices

 
 
Thread Tools Search this Thread Display Modes
Old 12.11.2006, 14:37   #76
Shawnmb
Архивный участник
 
Join Date: Feb 2005
Posts: 307
Default

Quote:
Originally Posted by blue3722 View Post
thx a lot

that is ok now


just
Get char id by char name
Check user invertory

Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: lin2world in E:\APMServ\APMServ5.1.2\www\htdocs\cached.php on line 209

Warning: mssql_select_db(): supplied argument is not a valid MS SQL-Link resource in E:\APMServ\APMServ5.1.2\www\htdocs\cached.php on line 210

Warning: mssql_close(): supplied argument is not a valid MS SQL-Link resource in E:\APMServ\APMServ5.1.2\www\htdocs\cached.php on line 213

Is not normal
Those warning messages should be obvious, bolding added in quote for emphasis.
Shawnmb is offline  
Old 12.11.2006, 15:05   #77
blue3722
Архивный участник
 
Join Date: Nov 2006
Posts: 11
Default

anthder poblem is not support to Chinese

I dont konw anyabout php ....so i cannt modify about it

any how it is very applied


my english is very poor
blue3722 is offline  
Old 14.11.2006, 07:35   #78
twzenit
Архивный участник
 
Join Date: Nov 2006
Posts: 15
Default

is there a function such as ban user? I tested chatban is ok. but with 0 or 1 in punish option it does not work. also additem and delitem is not working.
twzenit is offline  
Old 14.11.2006, 08:14   #79
twzenit
Архивный участник
 
Join Date: Nov 2006
Posts: 15
Default

15. Getting char id by char name, directly from db. (tested)
16. Showing char invertory and warehouse by char id, directly from db. (tested)

Those 2 when I click go they return with empty page, and it does not send message to cached.exe

Any idea why?
twzenit is offline  
Old 14.11.2006, 10:07   #80
Dmytro
Архивный участник
 
Join Date: Nov 2005
Posts: 215
Default

Quote:
Originally Posted by twzenit View Post
15. Getting char id by char name, directly from db. (tested)
16. Showing char invertory and warehouse by char id, directly from db. (tested)

Those 2 when I click go they return with empty page, and it does not send message to cached.exe

Any idea why?
No, working fine!
15. - Return char_id by char name.
16. - Return items by char_id, that you got by 15.

Maybe different ports ... check your *.ini files
Dmytro is offline  
Old 14.11.2006, 10:20   #81
twzenit
Архивный участник
 
Join Date: Nov 2006
Posts: 15
Default

when I chose 16, it asked my the same option of 15. Strange...and when I input charname it shows a empty page... any idea what wrong with it?
twzenit is offline  
Old 14.11.2006, 10:23   #82
twzenit
Архивный участник
 
Join Date: Nov 2006
Posts: 15
Default

also beside 2012 what other port it use? I don't see any other port should be open for it. You tested on single machine or 2 machines(cached is in a seperate machine)
twzenit is offline  
Old 15.11.2006, 21:33   #83
Dmytro
Архивный участник
 
Join Date: Nov 2005
Posts: 215
Default

Quote:
Originally Posted by twzenit View Post
when I chose 16, it asked my the same option of 15. Strange...and when I input charname it shows a empty page... any idea what wrong with it?
... in (16) you may put not char name - char ID !!!!
id = 123 for example
Dmytro is offline  
Old 17.11.2006, 15:47   #84
Charis
Архивный участник
 
Join Date: Feb 2006
Posts: 39
Default

I can not make DelItem function work (13).
It returns 01 all the time.

Does anybody succeded in using it?

I'm using a little different code, but an original doesn't seems to work too.

Code:
function ansi2unicode($string) {
    $rs = ""; for($i = 0; $i < strlen($string); $i++) $rs .= $string[$i].chr(0);
    return($rs.chr(0).chr(0));
}

function l2_cached_push($buf){
$cached_ip = "127.0.0.1";
$cached_port = "2012";
$fp = fsockopen($cached_ip, $cached_port, $errno, $errstr, 5); $rs = ""; 
if(!$fp)return 0; 
else{ 
    fwrite($fp, pack("s", (strlen($buf)+2)).$buf);
    $len = unpack("v", fread($fp, 2)); $rid = unpack("c", fread($fp, 1));
    for ($i = 0; $i < (($len[1]-4) / 4); $i++) { $read = unpack("i", fread($fp, 4)); $rs .= $read[1]; }
    stream_set_timeout($fp, 2);
    $answ=$rs;
    fclose($fp);
    return "$answ";
  }
 }

function l2_delItem ( $webadmin, $char_id, $warehouse, $item_id, $amount) { 
    $cached_op = pack("c", 13); 
    $cached_op .= pack("i", $char_id);
    $cached_op .= pack("i", $warehouse);
    $cached_op .= pack("i", $item_id);
    $cached_op .= pack("i", $amount);
    $cached_op .= ansi2unicode ( $webadmin ); 
  $rs = l2_cached_push ($cached_op); 
  return ( $rs ); 
}
$adena_id is an item id for Adena in char inventory, not the item_type.
$changeacccost - some value like 10000.
Code:
$answ = l2_delItem ( $_COOKIE['login'], $char_id, 0, $adena_id, $changeacccost);
$answ is always "01"

Function like Kick and MoveChar is working... But DeleteItem - does not
Charis is offline  
Old 18.11.2006, 16:50   #85
Kenjiro
Архивный участник
 
Join Date: Apr 2006
Posts: 120
Default

I use DelItem2:
Code:
function l2_delitem2 ( $item_id, $amount ) {
  // 54 - DelItem2, char_id, item_id
  $cached_op = pack ( "cVVV", 54, $item_id, $amount, 1 );
  $cached_op .= ansi2unicode ( "webadmin" );
  $ret_string = l2_cached_push ( pack ( "s", strlen ( $cached_op ) + 2 ) . $cached_op );
  return ( $ret_string );
}
You must remember that You can not delete more $amount, than You have in one item_id.
Kenjiro is offline  
Old 19.11.2006, 01:23   #86
Charis
Архивный участник
 
Join Date: Feb 2006
Posts: 39
Default

Quote:
$cached_op = pack ( "cVVV", 54, $item_id, $amount, 1 );
What for is 1 in the end of the statement? o_O
Charis is offline  
Old 20.11.2006, 07:11   #87
Kenjiro
Архивный участник
 
Join Date: Apr 2006
Posts: 120
Default

I do not know, but without this it won't work.
Kenjiro is offline  
Old 20.11.2006, 09:29   #88
LoVeRSaMa
Архивный участник
 
Join Date: Jun 2006
Posts: 111
Default

Suggestion: Quick Item Addition, Drop down menu for S grade A grade ect, it will not be to hard.
LoVeRSaMa is offline  
Old 24.12.2006, 22:22   #89
whwwhw
Архивный участник
 
Join Date: Dec 2006
Posts: 5
Default

I got this error while trying to edit new item:
I changed Cached to 2006 Port ( As it came from Rz )

Warning: unpack(): Type v: not enough input, need 2, have 0 in c:\appserv\www\functions.php on line 108

Warning: unpack(): Type c: not enough input, need 1, have 0 in c:\appserv\www\functions.php on line 108
Kicked:

Warning: unpack(): Type v: not enough input, need 2, have 0 in c:\appserv\www\functions.php on line 98

Warning: unpack(): Type c: not enough input, need 1, have 0 in c:\appserv\www\functions.php on line 98
Item added:
whwwhw is offline  
Old 24.12.2006, 23:19   #90
AsterisKSM
Архивный участник
 
Join Date: Jun 2006
Posts: 163
Default

me 2!.........
AsterisKSM is offline  
Old 25.12.2006, 09:27   #91
DevilsAssociate
Архивный участник
 
Join Date: Jul 2006
Posts: 81
Default

Hel
if you make another version this one is kinda useful

displays all the chars from an account by entering the account name

Code:
<option value=203>--Get char name from an account--</option>
Code:
		case 203:
			$get_account_name=htmlspecialchars($_POST["param1"]);
			if(strlen($get_account_name)<1){ ?>
				<form method='post' action='cached.php'><b>Get char on an account: </b>
				<br>Enter account name:<input type='text' name='param1'><br><input type='hidden' name='funcid' value='203'>
				<br><input type='button' value='Go' onclick='doSpecialFunc()'></form><?php }
			else{
				$con_sql=mssql_connect($mssql_host,$mssql_user,$mssql_pass);
				mssql_select_db($mssql_base,$con_sql);
				$result=mssql_query("SELECT char_name FROM user_data WHERE account_name='$get_account_name'");
				while($row=mssql_fetch_array($result)) { print "$row[0]<br> $row[99]";
				}
				mssql_close($con_sql);}
			break;
DevilsAssociate is offline  
Old 31.12.2006, 21:57   #92
rodier
Архивный участник
 
Join Date: May 2005
Posts: 979
Default

Quote:
Originally Posted by twzenit View Post
15. Getting char id by char name, directly from db. (tested)
16. Showing char invertory and warehouse by char id, directly from db. (tested)

Those 2 when I click go they return with empty page, and it does not send message to cached.exe

Any idea why?
I have same problems.. every other functions work OK, but this two not.
If I chose function 16. it show me text from function 15
and when I chose function 15, I wrote charid 1 (its my character) then Go and nothing..
-----------------
its really broken, look:

Code:
		case 200:
			$get_char_name=htmlspecialchars($_POST["param1"]);
			if(strlen($get_char_name)<1){ ?>
				<form method='post' action='cached.php'><b>Get char id by char name: </b>
				<br><input type='text' name='param1'><br><input type='hidden' name='funcid' value='200'>
				<br><input type='button' value='Go' onclick='doSpecialFunc()'></form><?php }
			else{
				$con_sql=mssql_connect($mssql_host,$mssql_user,$mssql_pass);
				mssql_select_db($mssql_base,$con_sql);
				$result=mssql_query("SELECT char_id FROM user_data WHERE char_name='$get_char_name'");
				while($row=mssql_fetch_array($result)) echo($row["char_id"]);
				mssql_close($con_sql);}
			break;
		case 201:
			$get_char_id=htmlspecialchars($_POST["param1"]);
			if(strlen($get_char_id)<1){ ?>
				<form method='post' action='cached.php'><b>Get char id by char name: </b>
				<br><input type='text' name='param1'><br><input type='hidden' name='funcid' value='201'>
				<br><input type='button' value='Go' onclick='doSpecialFunc()'></form><?php }
			else{
				$con_sql=mssql_connect($mssql_host,$mssql_user,$mssql_pass);
				mssql_select_db($mssql_base,$con_sql);
				$result=mssql_query("SELECT item_id, item_type, amount, warehouse FROM user_item WHERE char_id='$get_char_id'");
				while($row=mssql_fetch_array($result)){echo(ItemNameByItemId($row["item_type"])."(".$row["amount"].") --> warehouse: ".$row["warehouse"]." --> "."item uid: ".$row["item_id"]."<br>");}
				mssql_close($con_sql);}
			break;
rodier is offline  
Old 31.12.2006, 22:03   #93
rodier
Архивный участник
 
Join Date: May 2005
Posts: 979
Default

I think someone simply dont make it 100% done..
because there is
<br><input type='button' value='Go' onclick='doSpecialFunc()'>

Instead onclick=AnyRealFunction..
rodier is offline  
Old 01.01.2007, 01:30   #94
rodier
Архивный участник
 
Join Date: May 2005
Posts: 979
Default

hmm I dont know php too much, so I changed it alittle bit..
simply I changed it to normal form where u insert name of player and it will forward to another my php code where it will change to ID ;] (I dont know code too much so I dont know how to merge it :-DD )

Code:
case 200:
                         $get_char_id=htmlspecialchars($_POST["param1"]);
			 if(strlen($get_char_id)<1){ ?>
				<form method='get' action='charid.php?char='><b>Get char id by char name: </b>
                                <br><input name='char' size='10' value=''>
				<br><input type='submit' value='odeslat'></form><?php }
			break;

charid.php

Code:
<?php

include("config.php");

echo "<html><head></head>
<style type=text/css>
A:link {
COLOR: #dd6900;
}
A:visited {
	COLOR: #dd6900;
}
A:hover {
	COLOR: #dd6900;
}
A:active {
	COLOR: #dd6900;
}
    body, html { font-size: 5px; background-color: black; margin: 0px; margin-top: 5px; margin-bottom: 5px; color: #dd6900; }
    td { margin: 0px; padding: 0px; font-size: 14px; font-family: Tahoma, Verdana, Arial; color: #dd6900; }
    .tbl_mainpage { width: 700px; margin: auto; border: 0px #5b5b5b solid; background-color: black; color: #dd6900; }
    .tbl_title { height: 40px; font-size: 20px; text-align: center; vertical-align: middle; }
    .tbl_time { text-align: center; height: 20px; border-bottom: 1px #dd6900 solid; color: ##dd6900; }
    .tbl_head { border-bottom: 1px black solid; }
    .tbl_female { background-color: #660000; clear: both;}
    .tbl_male { background-color: #000000; clear: both; }
    .tbl_charord { width: 30px; text-align: center; border-right: 1px #dd6900 solid; }
    .tbl_charname { width: 300px; text-align: center; border-right: 1px #dd6900 solid; border-left: 1px #dd6900 solid;}
    .tbl_charclass { width: 100px; text-align: center; border-right: 1px #dd6900 solid; }
    .tbl_charlevel { width: 30px; text-align: center; border-right: 1px #dd6900 solid; }
  </style>
  <table class=tbl_mainpage cellspacing=0 cellpadding=0 align=center>
   <tr>
    <td class=tbl_charclass tbl_head><b>Char Name</b></td>
    <td class=tbl_charclass tbl_head><b>Char ID</b></td>
    </tr>";
  mssql_select_db("lin2world");
  $mssql["result"] = mssql_query("declare @char int; set @char = (select char_id from lin2world..user_data where char_name = '$_GET[char]'); select char_id, char_name from user_data where char_id = @char");
  $i = 0;
  while($mssql["entry"] = mssql_fetch_array($mssql["result"])) {
    $i++;

   echo "
      <td class=tbl_charclass>".$mssql[entry][char_name]."</center></td>
      <td class=tbl_charclass>".$mssql[entry][char_id]."</center></td>
    </tr></table></body></html>"; }
?>


config.php

Code:
<?php

  header("Expires: ". gmdate("D, d M Y H:i:s")." GMT");

  $mssql["server"] = "hyperjadro";   
  $mssql["user"] = "";
  $mssql["password"] = "";
  $mssql["database"] = "lin2db";
  $mssql["die"] = "Error in connection to MS SQL";
  mssql_connect($mssql["server"], $mssql["user"], $mssql["password"]); // or die($mssql["die"])
  mssql_select_db($mssql["database"]);
?>
rodier is offline  
Old 02.01.2007, 17:22   #95
[DeV/NuLL]
Архивный участник
 
Join Date: Aug 2005
Posts: 23
Default My CP

Here is my little CP Demo. If you have enough PHP programming skills, possably some C, C++ or C#, you can create a complete and automated system to manage your L2 Server.

For example, the best practice is create one class to connect with the CacheD Server, and use this class to execute any operation on it, of course you will add some logs to those operations, because you are a professional Developer (aren't you?).

If you are not a professional programmer, then you should look for one, learn to code in PHP or some other language or possibly try to buy some code.

Here is the Login form:


Main Administrator Control Panel Page (HGM has another interface, same thing for GMs, the system recognizes different types of Builders).


The Administrator Accounts Manager


Add Item to Char (Recognice the characters name instead the Char ID)


Continue in next Post
[DeV/NuLL] is offline  
Old 02.01.2007, 17:23   #96
[DeV/NuLL]
Архивный участник
 
Join Date: Aug 2005
Posts: 23
Default My CP 2

Add Item to Char Step 2


Add Item Results


Delete Item from Character (Char Name again)


Delete Item results


Our CP allows many more actions, like Look-up all characters connected from the same IP, all accounts with same IP, Pledge Management, Donations management allowing add or del (or both) items to any char with only one click.

Our code is strongly Object Oriented so add plenty of security on sessions and SQL Injection.

You can do all you want if you know how to do it, all the Packets functions work, except some ones that crash the CacheD due a Buffer Overflow on cached Administrative socket.


Greetings.
[DeV/NuLL] is offline  
Old 02.01.2007, 18:04   #97
AsterisKSM
Архивный участник
 
Join Date: Jun 2006
Posts: 163
Default

Why dont u share your CP :P
AsterisKSM is offline  
Old 02.01.2007, 18:18   #98
[DeV/NuLL]
Архивный участник
 
Join Date: Aug 2005
Posts: 23
Default

Cause is completely integrated into our Forum-Game-Main Page system, we use external C++ Applications to automate some managament at server so this work was really hard to separate one piece and share it.

Anyway I can give you some explanations about some good PHP coding practices, like use Objects to store RQUEST variables and prevent any type of SQL Injection.

www.php.net/manual/en <--------- Your best friend.
[DeV/NuLL] is offline  
Old 10.01.2007, 15:40   #99
Shraier
Архивный участник
 
Join Date: Feb 2006
Posts: 137
Default

Quote:
Originally Posted by TheOrder View Post
:lol: In the folder you have L2Server Folder , L2NPC Folder etc you showld also have a folder named CachedScript in it must be itemcache.txt for C4 PTS Server !

Here is the folder : http://download.yousendit.com/8D156D0746821F66

Enjoy ...

Thanks Hel for the Share !
Can you reshare cachedscripts?
Thanks in advance and thanks hel for the share..
Shraier is offline  
Old 15.01.2007, 16:17   #100
hel
Архивный участник
 
Join Date: Apr 2006
Posts: 729
Default

Sorry, but my project is closed. I was left community 3 months ago.
Wish to all get full off c5 server and be happy.
hel 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 17:51.