标题: 物品发送脚本 [打印本页] 作者: admin 时间: 2016-1-10 03:43 标题: 物品发送脚本 <?php 6 w9 L. D- |$ s6 y& _function Connect () {# `9 a: E9 {, i5 K# J% w9 G
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB : {0 S. w# y5 Y$ e* W- p X
" p$ E: k5 F9 @3 _. p9 y/ y1 aFailed.'); 3 ^% k0 B5 ]( Q4 q- u N} : L# o! G5 m- j7 Z& z1 gConnect(); ' a$ L t- P" t8 m a6 v- k* t8 v8 C- Q7 }& R b$ k
function InitForm(){ 5 M( k( w( X7 q//layout for the form( s E! Z. T8 d4 G2 y4 k7 r
echo "<strong>Send Items.</strong> 2 v1 W* j- V1 U<form name='select' method='post'>; P. j1 l( c, L2 A" J6 r$ U
<lable>Character Name</lable><br/> # n) [) f' ~3 Z, p2 q# Q: b<input type='text' name='char'/><br/> 3 c+ r/ W6 f8 A9 _<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/> 9 k+ h# I2 G3 g: a<input type='text' name='item_name'/><br/> ; |) {2 g5 X2 Y. l; q: }<lable>Item Amount</lable><br/> * D# r/ G) N {<input type='text' name='item_amount'/><br/>6 j0 a3 v* \% j/ K: H7 s
<lable>Item Upgrade Amount</lable><br/> b. U' l% W. X9 ^/ ~# L<input type='text' name='item_upgrade'/><br/>7 Z% }' _7 Y" V
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.) 0 }$ X1 f5 w) _7 f9 A9 { " A& [+ z1 z! t- x& ~</lable><br/> * x" }# w% u2 P6 _( r<input type='text' name='item_element'/><br/> 1 I* I4 A8 e$ q<lable>Element Upgrade Amount</lable><br/>* ?' u( U2 T7 o0 m
<input type='text' name='element_upgrade'/><br/> % ?6 B: f9 |$ {" x4 @" q<lable>Pierced Amount</lable><br/>7 l V5 u/ L2 e! a/ V M
<input type='text' name='item_pierce'/><br/>/ Y( n. h: [0 Q( |( T* h& \0 |7 {! t
<input type='submit'/>8 s1 @% l% u$ _9 \
</form>";, Z: O3 j* ~) R2 y: K: L( B& o
}8 i& p1 L. ~; ~# B
5 N1 j. \% y- T: Z( hfunction PostListener (){ 9 s6 c( y9 A4 A, A% W//Add more post variables if needed and add them to initform() function aswell! F3 K1 H! w7 I" Q0 S' b( q
* U9 D" N( z0 r0 Z- c################################- D" Y, z8 |, K' p/ c- G& P
##### Connection and Post ######: l# j# d+ y% \" B; L# O* C; j+ i
################################1 D+ ?+ n' |) S# `( m3 [1 i: D
$name = @$_POST['char'];; s" U, V2 }! f# l" n0 M; `
$ItemName = @$_POST['item_name'];# [5 T3 e( s$ U: m/ ~* s' m
$ItemAmount = @$_POST['item_amount']; $ z) j; O& p6 t$ W" m" O$ItemId = @$_POST['item_id'];% o. s# ?* y& V6 w' k8 r
$ItemUpgrade = @$_POST['item_upgrade']; ! p3 }, j3 y4 A& S5 X, L$ItemElement = @$_POST['item_element']; S" q0 P& |* D3 V5 [4 W
$ElementUpgrade = @$_POST['element_upgrade']; 3 B+ f! w4 z7 q3 m$ItemPierce = @$_POST['item_pierce'];/ b. c4 d1 N9 ^$ C9 {* N
################################ 7 J, S+ H; _5 B' p2 @" Z* M0 d " W% \' x/ e5 h//Check both variables for empty value. _. h$ `; X( f( N1 `5 P
' r7 n/ C2 Y" f! T1 }; C8 b: y
if (!empty($_POST['char'])){ ( z" T0 [& f% O6 \9 Q$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where 3 y0 _- |3 @% W" ~4 Q8 O
+ T. i( p3 F3 f) j4 h% X
m_szName = '{$name}'");: l* X& P, Z6 R
while ($row = mssql_fetch_object($find)){ ' U; G; h* L# _* Pecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";7 K$ f$ N; ~+ @+ r: L
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 4 @7 h8 J9 n3 Z2 M) U