标题: 物品发送脚本 [打印本页] 作者: admin 时间: 2016-1-10 03:43 标题: 物品发送脚本 <?php $ |1 d! G5 ^1 Q7 F* B6 j0 [& F, bfunction Connect () { ) r. c, G& A: Dmssql_connect('Server','UserName','Password') or die('Error: Connection to DB , q2 Z. H4 ]5 m( d, x+ _9 _) D8 r+ o
Failed.'); , ^6 x3 T1 E: j4 t( \}" N/ v) P$ R2 j$ k- m) W5 q
Connect();! S r+ D$ C# f0 ]) d
7 R _2 J# _& j$ | cfunction InitForm(){" _9 ~5 j9 D; c
//layout for the form1 U0 G) b: d7 j( Q
echo "<strong>Send Items.</strong>" k( K8 K0 @! \% K1 V
<form name='select' method='post'> . U5 n" ~3 f* R<lable>Character Name</lable><br/>/ }1 ?' M) ~! a0 d/ S
<input type='text' name='char'/><br/>6 I# a! `$ r, G6 I" X
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>2 [ x" ~: Z# O* A2 X4 D& l) P* n
<input type='text' name='item_name'/><br/> 7 n3 q) k# `) ~) ~' H4 }<lable>Item Amount</lable><br/>/ N% K) S% \" @ k' F
<input type='text' name='item_amount'/><br/>3 o2 y; p: H: J; R- ~: j
<lable>Item Upgrade Amount</lable><br/>- ~ k/ B+ m. z/ j" \& x5 w
<input type='text' name='item_upgrade'/><br/>; a- P3 h- k- E; j$ R; C1 U
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.) " l5 ]0 y2 Z+ Q8 k. A5 ~+ O$ H! C& r6 n p
</lable><br/>6 {9 T( T, n& \( X! b
<input type='text' name='item_element'/><br/>* \" V* e9 U. y' X0 |
<lable>Element Upgrade Amount</lable><br/> 7 c7 v( P1 y) i<input type='text' name='element_upgrade'/><br/> 8 ?7 p2 S: \& ~+ V<lable>Pierced Amount</lable><br/> ) [" X$ F* W n. E' u4 ~- \# ~<input type='text' name='item_pierce'/><br/>0 S: v* E7 k, P" @' D, v
<input type='submit'/>7 i h+ w6 h' P
</form>"; 0 H% L! D: V# @4 {+ q}% ] z8 g6 V. H
. M9 Y: @8 {8 |) |9 j7 E; t& hfunction PostListener (){ 1 } B' F, a- Q( P& l# j//Add more post variables if needed and add them to initform() function aswell ' v4 U# j5 `5 l1 b+ s" a' Z . |7 h; Q9 }( H6 Y0 M% _################################" ]# E9 ?! {6 V" n
##### Connection and Post ######& J, U* j0 d# j0 {) ~0 W
################################ . H) Z4 {/ {2 I4 |: c: O9 M# z$name = @$_POST['char'];* G$ F$ \4 s' Z0 ~
$ItemName = @$_POST['item_name']; " _, p, G; u1 e5 n7 l" N! R$ItemAmount = @$_POST['item_amount'];1 ]% P* s) r% U, s
$ItemId = @$_POST['item_id'];1 W) R! N2 X. y |
$ItemUpgrade = @$_POST['item_upgrade']; - z) _+ L; i; i" g. l9 @# Z7 |$ItemElement = @$_POST['item_element'];# |7 P+ c! N I; x
$ElementUpgrade = @$_POST['element_upgrade'];0 L7 S8 T! X9 E( b# q
$ItemPierce = @$_POST['item_pierce']; - k, w# k v: ~################################8 I( g/ z5 W! O+ l- C& Q: f# G' A
6 F) i4 j1 w% z T# u7 v//Check both variables for empty value2 q3 d( @- q2 i5 K
& V3 Q6 x" ]2 ?6 W. k
if (!empty($_POST['char'])){ ' x: T4 l( B, E5 K! u/ H$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where % \, U W f; |" J& C7 J8 P9 Z# p
0 }. H; d' [) \6 ?3 fm_szName = '{$name}'"); % k$ S6 Q, w$ y M6 swhile ($row = mssql_fetch_object($find)){ ! I2 M3 z G7 N) H: jecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>"; , E+ k9 X! H/ G- y$ L7 f$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], $ _# z- F: c( ?+ J
) K& r# Z/ j) V$ T# @- n7 h) ]* j
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 0 u3 G; u" y3 {4 @ u' l9 J# B