标题: 物品发送脚本 [打印本页] 作者: admin 时间: 2016-1-10 03:43 标题: 物品发送脚本 <?php , Y8 {- c e1 pfunction Connect () {# V0 O, X, V( B
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB 4 _/ W2 K i! e- n. u! C
1 N B: H4 ^, y# \Failed.');0 P( F6 C' X/ g% S7 J, `
}) s$ I- K1 t7 N: z' Y6 x' H
Connect(); 1 M( E# X( R1 Z1 q" G! |! \( Z! ^7 \5 a
function InitForm(){ _- @% O& a) A//layout for the form + I/ U: j2 F. I; h+ f; G6 }4 o9 becho "<strong>Send Items.</strong>7 l0 | ~8 s1 z2 ~2 T: S9 a( c7 m0 O; c
<form name='select' method='post'> $ f5 d2 o5 d# v. Z5 c+ Y<lable>Character Name</lable><br/>6 q# S4 M+ M- S _
<input type='text' name='char'/><br/> 7 R* r$ \+ ?2 f. q<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/> ( @+ s" Q: D9 n9 c" s0 \( R! o<input type='text' name='item_name'/><br/> ! Q" Z3 z5 E* h% U) r3 }( ~<lable>Item Amount</lable><br/> 7 N* u, S( Y/ Q9 p<input type='text' name='item_amount'/><br/>7 _0 H2 s6 K9 F* E2 J& J8 h* `
<lable>Item Upgrade Amount</lable><br/> ; L7 b4 ^9 O2 ?7 m+ P<input type='text' name='item_upgrade'/><br/> ( \0 E% j) K. O+ i1 z9 \<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.) ( Q6 k" S2 ?, G0 z4 t 3 N; a1 L, ~4 Q0 d; R: o. I</lable><br/> 2 b* ^ ^3 Z) H, T" D; d8 N! Z<input type='text' name='item_element'/><br/># O' D7 K7 A5 e6 N. k4 L
<lable>Element Upgrade Amount</lable><br/>+ Y6 b" Y' C8 _3 q, Q. w- m _
<input type='text' name='element_upgrade'/><br/> $ u. g! t0 S, y: Y* U<lable>Pierced Amount</lable><br/>5 e. }+ z; K& ~5 ]! H6 c
<input type='text' name='item_pierce'/><br/>3 C3 O& \/ B, q
<input type='submit'/> - l6 ]3 I4 z% m" K8 x# p% |# y/ w</form>"; 1 k2 P& S; Y/ `4 q: d) o} 9 S1 v: _7 ?8 |% ^4 ^1 }; ?% M, ]% k/ U E9 e9 ?
function PostListener (){ ' ?. K- D: q1 i) R//Add more post variables if needed and add them to initform() function aswell6 w7 m9 ?- G' `1 m0 i* |
- B- [, D. B! L' G( N; g
################################: C% H# `1 Z. o. U+ I+ Z
##### Connection and Post ###### 4 D) L! ~# D: F5 \+ ?" Z: s1 `################################ ( E. B) J9 S& R5 C. Y6 d4 E$ i$name = @$_POST['char'];# ~9 m7 y+ y3 a) @# U+ R3 j7 m7 b
$ItemName = @$_POST['item_name'];1 z- P' S' |0 ]. m) C' n) o
$ItemAmount = @$_POST['item_amount'];0 S. p$ d' ~, h3 O- a
$ItemId = @$_POST['item_id']; . ?1 p; F. n2 Q% F( \# n* O4 k% a$ItemUpgrade = @$_POST['item_upgrade'];1 a' @# p# K' P3 ^. i) m
$ItemElement = @$_POST['item_element']; 8 i/ c, o6 ]/ D$ElementUpgrade = @$_POST['element_upgrade']; ' x* z) H6 Q5 X* d% Q4 ^* |# ]$ItemPierce = @$_POST['item_pierce'];) H6 B* Q* a% T2 @
################################ ( F. P! e5 h. E3 n1 C. M4 ]4 M; m, \2 b, T/ T+ V( e, ]
//Check both variables for empty value; j3 n- \6 u+ w' E
: }! x/ ]9 i- [5 K. ?3 l# S9 ^if (!empty($_POST['char'])){( s6 G$ ~5 r! f
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where ( {2 w& l% U6 h9 y. Q7 q5 x D2 G# Q 4 z% u8 d# v7 D) T/ Q4 `2 N1 K' ?m_szName = '{$name}'"); ; r! ^& A" f* I! k' nwhile ($row = mssql_fetch_object($find)){ 1 g' I" i* o0 i; necho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>"; : ?& r A4 M, G: y4 U$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], : Z6 L @2 P# ?% k
9 V, n) }6 A; N& O
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 6 r, x% A7 b; y& y: ~- B f7 P% K! J
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', ; L. T+ x* Q7 n2 B7 X( j$ @9 @- w