飞飞世界论坛

标题: 物品发送脚本 [打印本页]

作者: admin    时间: 2016-1-10 03:43
标题: 物品发送脚本
<?php
/ O6 z# u8 g7 g6 m! f9 `* S' e/ S! Pfunction Connect () {8 B  a: ?+ z' t7 w  J, I/ H0 z) T
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB 6 f+ V' J. F& o* Z
6 U: A5 t0 A" e7 s" T) j
Failed.');
3 r$ V- m6 k7 G: j8 k1 A/ v* y}$ A3 F! B; M: u8 s
Connect();- d( Q* D3 g/ X. b# D

+ N9 u9 S7 L) U, p" pfunction InitForm(){+ d2 U: P" T$ u7 F6 G$ D
//layout for the form
9 E  u( ~1 J4 h3 c! y6 cecho "<strong>Send Items.</strong>* F. B1 K' y1 e9 N5 h, N* g9 t
<form name='select' method='post'>' a8 i3 j# Z( z" ^3 @% R% I
<lable>Character Name</lable><br/>
6 w  o8 g7 ^' u' W" l6 W! l<input type='text' name='char'/><br/>, o! C) J# N, Q  L8 b, G( [" C6 N: Y. O
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
5 ^4 u( ]7 h7 w$ a9 B<input type='text' name='item_name'/><br/>
0 ^- T+ q: E+ \; n# v) E6 T4 P<lable>Item Amount</lable><br/>
0 A2 c& v  |0 |" j& V<input type='text' name='item_amount'/><br/>' k* j0 J% h' @* {! @) \' C
<lable>Item Upgrade Amount</lable><br/>) X6 K6 p+ \5 u1 R4 U
<input type='text' name='item_upgrade'/><br/>
" n! f+ _0 s! O/ c( C# E$ V<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)% e6 J) [/ C) F

0 i4 n# R3 t5 Y0 Y- `3 p6 X0 \</lable><br/>  b9 ]2 \) \$ A& U8 R
<input type='text' name='item_element'/><br/>& S$ S& @8 G: b4 E
<lable>Element Upgrade Amount</lable><br/>9 R# _1 m8 o0 ~! H8 G2 W
<input type='text' name='element_upgrade'/><br/>; D, ^4 `% }9 a9 m2 A9 \
<lable>Pierced Amount</lable><br/>( U- w* q- }" j/ a  l# W) Q; ^
<input type='text' name='item_pierce'/><br/>
2 ~3 d6 @/ A$ G3 e6 ~& {% Z4 @<input type='submit'/>$ Q9 z6 I* H6 \' K
</form>";
6 I+ t0 l5 a# ]6 h. B( M. z! J}
3 N7 C) e( M2 D9 j+ H
! ]" x; m7 |: @$ q! W  _function PostListener (){  [! ]; Y2 V+ J
//Add more post variables if needed and add them to initform() function aswell. @+ Z  }% b) e+ X6 d
6 o& g3 v9 |; H4 f
################################. G4 y& O. u: @  q9 P
##### Connection and Post ######
% ^- x; ], e8 Q' i( \6 f################################
# J9 j9 J" L% y$name = @$_POST['char'];
# G$ U# o4 e7 ?4 ]2 c  S$ItemName = @$_POST['item_name'];1 c  J- A. w* O( p
$ItemAmount = @$_POST['item_amount'];: a9 d/ r& X6 p9 t/ c6 X
$ItemId = @$_POST['item_id'];; ?/ W; o+ M: W. [( M
$ItemUpgrade = @$_POST['item_upgrade'];
) Y9 D6 p9 z- G" j. ~$ItemElement = @$_POST['item_element'];
. p" M9 z1 X$ f$ E$ElementUpgrade = @$_POST['element_upgrade'];0 Q+ U8 O% O3 B" J: s
$ItemPierce = @$_POST['item_pierce'];
7 d7 L9 g1 p% Z################################% B8 W6 G: {' e6 X
; D% P- ?3 o( T3 z# G
//Check both variables for empty value4 H" W+ x' |: u6 a1 B: }

( F: ]$ X. t$ u; X! Mif (!empty($_POST['char'])){3 w! r. Y- d: W- w3 Z
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where 7 h& T: N0 z5 ~1 A+ C/ a, @! o' I& l! O
5 x" K6 w- i) E, m. \
m_szName = '{$name}'");; y9 J4 S9 q/ E9 l  i, X
while ($row = mssql_fetch_object($find)){
1 O. h  c* V7 w0 d% ]) o6 v2 J1 M5 Cecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";0 V, B( [3 S2 R) G! v! g/ ?" F
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], ( u) ]% ^* A' X2 N1 }2 ?6 S  x% n

8 N! P' G2 T$ m+ m9 M9 E[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],   ?6 z/ ?* s) ~# D
2 M& Y9 @7 D' U' X* Y6 @2 m; K* [
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
- I6 ?% ]9 ]- {0 j
/ A8 _& b# G, u7 O- I0 iN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
& e; V9 _; l# T( d
; \0 Y9 U$ a6 l' e7 h5 {  y'{$ElementUpgrade}', '{$ItemPierce}');");2 W: _: `) R+ t6 g' y2 s6 R
}9 J( I" Z: B) P/ u$ F, v0 M! R2 S9 x

4 A  u7 q2 `. {% V% @}
0 ?& N: W* N8 F$ b
: x' k3 u( L. C6 h0 F}* V& x  G  n8 _' U/ Z0 f, z8 \

4 F% Z' G. q6 Y/ z8 e$InitForm = InitForm();, _0 V1 o1 I" R$ \8 H
$Listener = PostListener();
8 D" t! R1 ~/ C- [+ K! [5 A# j9 [
: c+ l' M( }& d# w) f3 X9 K' ~2 `?>( V$ ?: \" c1 k6 b- V) ~, x
" o3 v) W: D1 L& Q
9 q$ U8 b. ]. i* M- ^2 t
1 s3 ]- y# Y1 z& N5 T

" q: f) `# U9 x' q8 a




欢迎光临 飞飞世界论坛 (http://www.ffwold.com/) Powered by Discuz! X3.2