飞飞世界论坛

标题: 物品发送脚本 [打印本页]

作者: admin    时间: 2016-1-10 03:43
标题: 物品发送脚本
<?php
7 j9 ]  Y; w0 e+ ^5 l2 h! vfunction Connect () {( V$ r# A4 `) h8 g
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB 9 H( N1 N  }$ C5 F
0 g& S2 S/ ~7 B% J) ^; h! w6 W
Failed.');
& ?7 l& o7 R, k/ \}
5 {. j* Y# k5 H4 `( O9 b' q. wConnect();
. M- M/ P9 H3 E* a- j8 R; B  h- x2 K. e& M9 G5 n7 _  H
function InitForm(){9 J# M+ P  f* M$ p  t7 G+ b1 B0 O
//layout for the form/ M" g4 \9 O( c1 _: A  K4 d8 e, v
echo "<strong>Send Items.</strong>
& m% p' E2 A7 K, l# J$ a  z<form name='select' method='post'>
" b6 u; k" ^/ L; z. u0 k: Z5 `<lable>Character Name</lable><br/>
: f$ M: t" M3 A# E% b6 w1 }<input type='text' name='char'/><br/>2 W! @/ g7 U  d! i( G* P! O+ J; c; B
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>6 G% Q% {& q: o6 T
<input type='text' name='item_name'/><br/>
7 z/ r$ m3 {8 L/ K: }- q<lable>Item Amount</lable><br/>7 ?! F; j% C7 u7 S
<input type='text' name='item_amount'/><br/>
  z) b' [# V) W( x3 f<lable>Item Upgrade Amount</lable><br/>) R. G. e* E# H) ~
<input type='text' name='item_upgrade'/><br/>! ?7 B4 M1 v) h, _( y/ H" S& f
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)7 \7 ^( m9 D5 X) E' R

; ]* |, |& h" L/ ^</lable><br/>5 j' s, H0 |7 N9 |" m: H
<input type='text' name='item_element'/><br/>1 F4 i8 i/ e4 W3 L" d* o+ _1 }
<lable>Element Upgrade Amount</lable><br/>
8 W* ~) X3 s+ u5 F<input type='text' name='element_upgrade'/><br/>' E' J7 D3 d$ L6 C& f  b4 c6 \8 B
<lable>Pierced Amount</lable><br/>7 t) D( Q2 p1 [& e% K" ~; P
<input type='text' name='item_pierce'/><br/>3 Q+ g- |+ v$ }$ r9 L
<input type='submit'/>( `' i6 y: @% F* j
</form>";
8 J# X8 e. D! v$ {1 G4 b6 ^( |- ?}3 `7 F) Q$ w0 L. n4 `( M! i

) O; W; N2 M/ m; lfunction PostListener (){9 M+ n6 u8 q( Q5 U! G+ V' q: h  Y7 C
//Add more post variables if needed and add them to initform() function aswell
7 }. h, z& b- N. x4 S/ f# d5 f( S9 S; P# s
################################2 A! l) \6 ^, Z3 ?0 c* w! @7 m$ l
##### Connection and Post ######
/ h6 b, O1 S8 X################################' }* b5 x( A, J- q
$name = @$_POST['char'];
* ^& o% ?8 _& c. X7 p) J3 R7 e( V$ItemName = @$_POST['item_name'];# n) Z9 n( s" x- N
$ItemAmount = @$_POST['item_amount'];
- a. t+ g8 A( _/ O* r$ItemId = @$_POST['item_id'];
/ m. H9 _1 i8 R4 v$ o: q, C5 w$ItemUpgrade = @$_POST['item_upgrade'];. u1 m2 V4 ^' F; K) L
$ItemElement = @$_POST['item_element'];2 k8 d0 a5 ^) E. c+ ?9 E
$ElementUpgrade = @$_POST['element_upgrade'];
7 ?3 q$ S. f/ ~, W6 m: ^. T. V( w- F$ItemPierce = @$_POST['item_pierce'];2 v2 F9 A; G! f) \* K1 _& b
################################- q& @5 b* _9 |+ P
1 X. H! e$ \/ w& S3 n( |
//Check both variables for empty value
/ j4 D, @) r% b4 e/ w3 H, \6 M$ N5 X1 H+ j/ C$ f
if (!empty($_POST['char'])){6 ^+ V% z& V1 f2 h; b- G
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where / }; O7 |% ]4 Y* @9 Z) _% i1 L

) r! x: J" O" ~+ S4 [m_szName = '{$name}'");7 ?* C  e4 `6 Q) q9 L
while ($row = mssql_fetch_object($find)){0 d2 w& ]& R& [0 [
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";. R( S7 H& m# n" ~" X
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
. _; h0 ^/ G, D( f: ?4 c! A9 G7 u2 B1 G. K
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], ( X- ?' I. }9 j& C4 G2 H- a. y" S% o
8 y3 \- `/ |* w5 P3 B
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
( X* A4 d8 i( E3 Z$ U' [# W2 d- z8 Q' z  V7 z
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
) w8 m9 ?: g3 k8 d9 K& f/ o! m2 q: t/ z" d" z2 O
'{$ElementUpgrade}', '{$ItemPierce}');");7 M- U$ e4 ~: p' x. L# v
}" R$ V) g* V. l6 R7 l. s* |9 D: w
, ~7 r% ~8 B3 o9 E; i7 F0 x
}3 @* o- m9 Y  R. H8 L& ]* T

9 v9 R! y6 G1 E" [}; _+ d' ?+ z  _+ w: {4 _

/ d" }- j! U2 P$InitForm = InitForm();/ d+ Y6 k+ `  }; t
$Listener = PostListener();& h4 l* R; T5 I$ s

2 U3 t3 u% C: X! |9 F" _?>; t6 k, P4 I9 @$ |2 H! I2 j+ V

$ U8 l9 h" z) D. t/ k3 F
# g& D0 _) `1 H/ S+ ]# X1 t6 E/ {7 G3 @

9 L) Y3 Y1 `& S+ O8 k5 `




欢迎光临 飞飞世界论坛 (http://www.ffwold.com/) Powered by Discuz! X3.2