飞飞世界论坛

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

作者: admin    时间: 2016-1-10 03:43
标题: 物品发送脚本
<?php! ]) ]/ S$ W6 O- M% i( V
function Connect () {; b$ r6 n( Y2 z7 q0 {/ I' U8 F
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB 2 t7 V) O3 n8 @7 ^* B/ @6 B9 Q
, [# {" {. T* ]0 x! r3 ^
Failed.');
2 O+ N& r4 ]: |5 U; B: [}
) [4 j4 [* \+ U# R3 i( cConnect();7 e% \1 v& y9 M$ F' {

0 b. M% Y0 B  z% ?# O) Sfunction InitForm(){
3 a) }( x+ f$ {//layout for the form4 h6 Q0 z& _8 M" I: x1 f
echo "<strong>Send Items.</strong>' t( M1 i8 ^' p" M
<form name='select' method='post'>
# q1 ~3 l; q1 @<lable>Character Name</lable><br/>
7 L% c/ ?! G$ W3 c( M9 X+ n<input type='text' name='char'/><br/>& e. Y4 q* w$ o- @) [$ T
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>% R  c$ m$ _0 p! L
<input type='text' name='item_name'/><br/>
7 y; m1 L$ J, O8 V<lable>Item Amount</lable><br/>! V% {, f7 e% o2 D+ A) b: j
<input type='text' name='item_amount'/><br/>
7 T/ j3 l, v5 r  w: P<lable>Item Upgrade Amount</lable><br/># f0 R0 _$ Z. B" u
<input type='text' name='item_upgrade'/><br/>; Z7 ~/ y( _) O  P5 X/ s, }- T
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)$ v3 p9 z# m0 L+ Z. W

  i3 _+ S+ E6 b) M6 V. K# [</lable><br/>* L' u" r' E4 U6 s) P% R
<input type='text' name='item_element'/><br/>
) e9 P  g. R7 `7 g& v+ n& V# s<lable>Element Upgrade Amount</lable><br/>
. A) W$ C: e, S/ E5 k* F<input type='text' name='element_upgrade'/><br/>
+ \. k2 `+ g! I' o5 N, H0 t<lable>Pierced Amount</lable><br/>
$ l; J' ^; N7 V. q, A% U<input type='text' name='item_pierce'/><br/>- H' i8 |  w8 X; }
<input type='submit'/>! y" R/ b1 M# L) A" @& a" n
</form>";, g3 M; r! g% N1 R) l3 @
}
$ J; m1 U- C& j, ~$ u' ?" P1 P4 u7 S. I" E$ p: j+ M6 g
function PostListener (){. ~4 _' B. F" G5 _1 g! {
//Add more post variables if needed and add them to initform() function aswell
9 A# X* `$ f2 U6 D+ ~0 f
1 E9 D, F. E* W' j5 m################################& h4 b% S" A" d% b& R
##### Connection and Post ######5 {) i& i" h) n& e  T. {) m
################################7 y1 Z; S& B0 q3 e
$name = @$_POST['char'];
' \9 E, z0 L; a# ?5 q# ?: `8 H0 t: z$ItemName = @$_POST['item_name'];8 G3 C! z8 D& I. D) Z: j5 V
$ItemAmount = @$_POST['item_amount'];. R( ^0 _( }- C: B
$ItemId = @$_POST['item_id'];, h, _# X# e3 i: j/ l) h- [' O
$ItemUpgrade = @$_POST['item_upgrade'];: e. p4 V% G( |: g' ]0 f. [9 l
$ItemElement = @$_POST['item_element'];" A# F- r, [$ o) u# P* F
$ElementUpgrade = @$_POST['element_upgrade'];
6 ^' \9 O7 L" }- S" v) M8 a1 f$ItemPierce = @$_POST['item_pierce'];
8 K0 R0 E! d! b& k5 ^' }7 ]################################
* `- D$ q8 z' |+ N; _: Z8 V- ]. J4 @% I8 n- a/ o( t& S1 R' b
//Check both variables for empty value; m; l# n6 k; Y

5 e5 t" [+ H2 x; y6 h: V* ]+ h' jif (!empty($_POST['char'])){+ g' p+ P4 Y/ R4 K6 G
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where 6 x1 }2 W/ R" k+ W1 K* F( x

, D3 c" T* ~  w3 G9 W. c6 @m_szName = '{$name}'");
& W1 Y& w9 h- s* ^& g0 }# O; Swhile ($row = mssql_fetch_object($find)){+ x4 Q2 R# N2 ?) Q6 r- h( M
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
4 X5 G- N2 c5 w- |& |% I) D8 c$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 5 m% j/ Q$ h! Z7 z& x
4 O7 m& l6 v/ y
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
) Q: K) F5 t8 B% l  t3 O
% z* N$ y5 Z( `& C1 E2 c; I[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 9 m. ~& G. B6 a% `7 d8 m

9 Y1 k  V8 @- [3 ZN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', , @2 D4 v& Z9 P$ }6 G# P
2 _, Z3 u0 |4 a& a
'{$ElementUpgrade}', '{$ItemPierce}');");5 n5 C, @! P4 Z# R+ f
}
! n, E$ }5 t  s! w/ F8 j/ N( Y* y# h3 t, d
}: q2 [2 v( j" l: `* t$ ?
# z+ t4 G; d* X
}
% |& ]: n# ^% }% b& z9 Z
0 W1 m+ l- @& F1 W$InitForm = InitForm();. ^/ H3 H; J7 C4 |7 w/ ^
$Listener = PostListener();
. b% |2 `, U1 J" d8 w7 C- ~3 }2 v, V; }' d! U4 t
?>' @4 p* Y% K+ V6 z! x
- v8 j. m3 U* N+ n9 K& O9 H  S
! M/ \1 q6 g1 \! A

0 {) H* I' L* u% y% B
: e4 \* i; T9 R9 @2 d




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