标题: 物品发送脚本 [打印本页] 作者: admin 时间: 2016-1-10 03:43 标题: 物品发送脚本 <?php9 a% T0 u- t# K5 Y& |9 f6 X3 _
function Connect () { P2 e" U+ S. w$ J. y; C; e! g
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB 4 g: L/ ~; p1 }/ v4 A
" p5 v) U/ a* X' s% B* E
Failed.'); 3 T; z" P' r5 G0 J) F} ( v2 Y7 e8 x* t0 n8 qConnect();1 p$ e ^5 N+ i3 {; m( C
% l6 C4 L5 `( I9 r% g4 P+ A
function InitForm(){ d$ u1 Q7 F2 K8 y) d+ s//layout for the form8 e* k$ |1 r: F7 t6 Z3 R3 [$ c+ \
echo "<strong>Send Items.</strong> ( ~' X; X* d$ O) u1 v<form name='select' method='post'>1 X3 A4 ?: T6 g! v I$ }) r
<lable>Character Name</lable><br/> & n, _ r r( a" \- e- J8 e+ w<input type='text' name='char'/><br/> . @. \, x' W' Q: H$ F2 E<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>8 y2 B3 V; u3 i0 [# I8 _' W
<input type='text' name='item_name'/><br/> ' O9 B+ `2 Q" d/ Y6 j, z+ }- e<lable>Item Amount</lable><br/> / k2 Y- w6 r V. K$ I<input type='text' name='item_amount'/><br/>) ]0 J# g% p0 S
<lable>Item Upgrade Amount</lable><br/># f! a' E& q1 D+ _- N1 }. v! w
<input type='text' name='item_upgrade'/><br/>% E( Y k: m: }% y) l
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)8 V6 r+ r( D: l; g) }" Z+ {
6 j, N9 z5 G4 f4 Y
</lable><br/> 6 U& N) m7 `, P7 F2 w$ t<input type='text' name='item_element'/><br/> " H* g8 _1 T5 E<lable>Element Upgrade Amount</lable><br/> $ Y6 L3 ^: g0 H% q6 ~& a<input type='text' name='element_upgrade'/><br/> : b% d* Z9 h! w8 T6 s# D* N<lable>Pierced Amount</lable><br/>0 T8 U! x8 T* h @& Y( ]6 P* R' x7 }! V
<input type='text' name='item_pierce'/><br/> 8 K' z3 }5 E I# O% x& e- \, }<input type='submit'/>3 E, ^* e8 H6 T# ^- r" b
</form>"; 6 i5 h- q( \- [2 g}4 r9 r3 ~2 ~4 O
2 H0 V$ s N. U) Q2 `/ U! wfunction PostListener (){( ], \% j. Y; _$ G# s
//Add more post variables if needed and add them to initform() function aswell/ m9 D7 v) M$ j5 T/ ~
, G* s4 d* P2 N################################5 O/ h$ w& P1 L% J: B& e7 b
##### Connection and Post ######' r( J% G; s) ?9 w; r- M
################################- n" c6 e# F8 p) F
$name = @$_POST['char'];- c$ u& p: [# K" `$ e
$ItemName = @$_POST['item_name']; - d3 R# U% n% ^9 L3 }4 U$ItemAmount = @$_POST['item_amount']; % _* _) e0 w# @6 @# a4 n) W( C$ItemId = @$_POST['item_id']; V4 V" h2 K) m" W Q/ T$ItemUpgrade = @$_POST['item_upgrade']; 4 G# i9 J. e; t# d: T V9 e$ItemElement = @$_POST['item_element'];7 ~; g L8 @' f1 u/ S3 y
$ElementUpgrade = @$_POST['element_upgrade'];* K) C5 D, B! w/ l/ L$ H
$ItemPierce = @$_POST['item_pierce']; d3 u% ?# g! b: W
################################9 C+ q8 P9 S% V* J, C6 x. l
: t' R7 _: e; n) f
//Check both variables for empty value 1 s n& p4 ?- w 1 |( {, [* a- P# N0 X9 k$ Jif (!empty($_POST['char'])){4 L# u; [- l7 n. a! z
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where 5 W0 g9 N- Q$ w2 u1 |( j4 H3 |, \4 S$ S; K; A. [
m_szName = '{$name}'"); + \8 }# M+ a5 M. u! j0 {* nwhile ($row = mssql_fetch_object($find)){ , z' |8 Y2 A% Z- iecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>"; . N! J1 e, e/ }1 H- W4 R% y$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 9 p/ P2 ^. |( B( r
8 }, O" O& s3 a8 G T* L6 W; B
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], [. E7 M% m7 P$ V