标题: 物品发送脚本 [打印本页] 作者: admin 时间: 2016-1-10 03:43 标题: 物品发送脚本 <?php+ a& p1 L1 E7 t, W$ Z, _
function Connect () { 4 g$ p" n/ |$ o. G. f8 N1 o7 pmssql_connect('Server','UserName','Password') or die('Error: Connection to DB B) h9 m* s5 j! c( x$ `/ p" o8 m1 b4 c3 b- \# K
Failed.'); 7 m7 Q# V) \; l+ Q; z} : A/ c; b$ i$ R0 c' V! H1 u6 O PConnect();9 ]3 @& v! h: {6 @" S+ D
- G* x) Y0 m% m$ C2 ]# b
function InitForm(){+ p4 l; x1 i( t
//layout for the form; J6 O1 B" [( |8 T
echo "<strong>Send Items.</strong>. ?+ }- [) o! o, l
<form name='select' method='post'>6 P# }, l2 O# ?0 D" A
<lable>Character Name</lable><br/>* ~, _: n4 }. Y
<input type='text' name='char'/><br/> 9 d+ b0 Y2 H! Q6 h; o<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>( }% l% D" v; u2 q- m. J9 s3 T
<input type='text' name='item_name'/><br/> 3 P. C3 Y9 c1 v. c, U) s<lable>Item Amount</lable><br/>9 V( A: C7 b* L4 Z5 a0 k: H& M. G8 q
<input type='text' name='item_amount'/><br/> 6 u `9 { Y& w u3 K<lable>Item Upgrade Amount</lable><br/>6 M! K5 `' m- @! ]. U) p2 v
<input type='text' name='item_upgrade'/><br/>+ ~: G' ~. N7 e" I3 V
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.) + R5 v$ K6 L2 p0 d$ {" F& j( S ^* y2 s$ G& j+ N
</lable><br/>- z. x: h0 Y4 G7 ~' S
<input type='text' name='item_element'/><br/>8 }1 l8 b+ B* @7 ~; c
<lable>Element Upgrade Amount</lable><br/>$ ~. f! `9 F1 }6 Z8 ]! A T
<input type='text' name='element_upgrade'/><br/>* b: q) N( N. K ~ D t
<lable>Pierced Amount</lable><br/> " F; N4 O+ W! \+ A6 k3 r) s<input type='text' name='item_pierce'/><br/> 0 B) M2 m2 Z6 J q6 T% F" B<input type='submit'/>7 N; P, `( a+ w4 A$ O+ W# I
</form>";# ^" f) }. o; q9 l' i
}2 u# ?7 {& x" Z) \; w. d9 f
4 Z2 a) [6 N* }0 Q& S
function PostListener (){ ' A6 U$ L' u/ R0 ]+ N//Add more post variables if needed and add them to initform() function aswell 5 W6 [% d/ d' s) c! k( `+ r- ^7 ?4 B3 A7 [
################################ . {$ ~& t0 s, S! y##### Connection and Post ###### r- v% O+ U7 P# I6 z################################ . Z# n/ W4 \# a& ]$name = @$_POST['char'];1 L+ s8 ]/ k3 S* q, `- ]3 X9 Z
$ItemName = @$_POST['item_name']; . ]- `6 f6 f8 W% S+ y$ItemAmount = @$_POST['item_amount'];3 g. q1 p0 k& t! K% t9 B, ?
$ItemId = @$_POST['item_id'];8 c: }% k( z3 G! B0 }' ]5 U
$ItemUpgrade = @$_POST['item_upgrade'];, U0 X# Q' P/ {% U9 n: s
$ItemElement = @$_POST['item_element']; + m% @9 S* [1 `5 g2 ^( B6 X2 r8 L$ElementUpgrade = @$_POST['element_upgrade']; 9 h, P* c/ s1 \9 s4 Z/ I% u% c& h$ItemPierce = @$_POST['item_pierce']; ! s" T/ ^6 h( [0 K7 k7 T& y( K################################, F- D' I: j! C5 O- x# O
: ?/ g0 z$ r H4 [# C, v//Check both variables for empty value3 \, D' ]+ G4 a/ A! z3 G4 v' I/ d
0 I$ ^" s! t- c4 Q& I2 Zif (!empty($_POST['char'])){ 7 [ q4 {* f a, e) @8 p" @$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where 0 Q4 @$ i$ G& D1 u * t. N7 {' L8 u) |% ^m_szName = '{$name}'");0 R X2 o- k! r8 p
while ($row = mssql_fetch_object($find)){- y E% c4 s# f
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>"; ' ]; |* }$ }* l, P$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 6 P& h% B B3 t3 K" y. h ?