飞飞世界论坛

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

作者: admin    时间: 2016-1-10 03:43
标题: 物品发送脚本
<?php2 ^1 ^4 v0 n7 c) I1 s' S5 m
function Connect () {. k# t6 Y7 d  g, L; j
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB : S) h8 a- K) f' ?5 R( g

  ^& k# O# G( K1 G9 NFailed.');3 J$ Y; `8 R, R$ \6 A! M% r
}
9 v- A7 V% C$ r; u2 y8 K$ MConnect();
; Y" H7 x3 K' p6 f
0 K$ g- v+ E# L* ?) D% afunction InitForm(){9 S; n$ y* T. T7 I
//layout for the form& n4 i# a. |9 _5 G( w
echo "<strong>Send Items.</strong>6 w7 X) {5 \, a
<form name='select' method='post'>
* E) X5 i/ X' c# ?- g- d<lable>Character Name</lable><br/>
$ Z5 T4 a: F" y" a. J<input type='text' name='char'/><br/>3 L; Q; q, d* [/ L. L, y/ e) z
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>5 ~+ [& `; H6 C7 i) y
<input type='text' name='item_name'/><br/>
0 z# W9 y; w  Y- H( f' w" N8 }' C<lable>Item Amount</lable><br/>: u. D7 |# D9 n4 @# z
<input type='text' name='item_amount'/><br/>1 F* J! _, E7 c' R9 ~, P9 u0 M
<lable>Item Upgrade Amount</lable><br/>+ d4 r* q( N) }. I' q4 l
<input type='text' name='item_upgrade'/><br/>
9 z# H/ Z" x, l* j1 D; `<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)& t( o: S0 D' C- p* @5 v

) B! v$ D9 @  C% f4 [</lable><br/>
: j( P5 F. u' Y  y<input type='text' name='item_element'/><br/>
, M( y2 @, o7 ~2 \" Q  p" e<lable>Element Upgrade Amount</lable><br/>
# O: P0 ~/ w* u2 [, T# ?<input type='text' name='element_upgrade'/><br/>
$ H1 K4 a$ u+ j; i3 f<lable>Pierced Amount</lable><br/>
' [% i. Y9 h% v: ]. l<input type='text' name='item_pierce'/><br/>3 A) s" V  }: v6 U6 U
<input type='submit'/>$ O! n7 z8 d6 k+ r8 C6 _
</form>";
  W. ~# `4 W: r, n- l) p# B) w) ~. p}  Q- t( V1 k5 r; R

' }* W, s2 f. w1 Gfunction PostListener (){- |$ W: s& l8 I( a$ v! O5 a; w
//Add more post variables if needed and add them to initform() function aswell/ v) w* q3 {( H8 c- b

5 F* u! |8 u* E& U6 I3 C8 m################################
1 d0 M7 a- s. g5 X$ ~  c. W) \; o3 ?##### Connection and Post ######3 S& P9 k4 x( I. i  s5 E+ F
################################
% I" l6 H& n* t$name = @$_POST['char'];  ~8 N9 o; L, R/ z5 q( y8 N& b
$ItemName = @$_POST['item_name'];$ l# Y% i! i& k, V& ]4 v7 ?
$ItemAmount = @$_POST['item_amount'];
$ u2 V; u* ?; l$ItemId = @$_POST['item_id'];, f. F* I$ v4 Z6 Z) f  C% d9 @/ b. |( T
$ItemUpgrade = @$_POST['item_upgrade'];! A' u) |: n/ a, @5 m% t
$ItemElement = @$_POST['item_element'];
) d! X9 a6 w9 o; y8 Y$ElementUpgrade = @$_POST['element_upgrade'];
/ [& f; h- F' D' y" F$ _. x  x: Q$ItemPierce = @$_POST['item_pierce'];
2 w9 B/ L1 f6 r. n/ \################################
$ F/ t$ K: G$ u% c1 J; c  q+ H4 c* @. B
  e5 \5 R8 L8 E4 O" [( A//Check both variables for empty value' d8 D- ~6 G+ V0 n& O

8 a% n. ?. p+ M9 tif (!empty($_POST['char'])){' g1 y; m7 n+ {; k7 z. K' X
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where / h/ ^8 Q# C8 F; G* o% I0 Z. `( c
3 h& O, A3 W3 k2 u4 c  D
m_szName = '{$name}'");! I" {8 _) f( {3 t  m. B
while ($row = mssql_fetch_object($find)){& ~/ f; k) e1 n( O4 u4 x; @
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";3 _2 ?' w) Z" n6 z
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], ! B7 b4 a0 }0 t/ Q9 t
, S6 s  ?" p4 z: J1 O* X* h$ |
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 7 f5 w1 r" N* C/ h

3 P6 Q( C8 M/ n  k0 m- c2 b[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
* X7 c: ]6 T6 [3 ^+ j: k4 @7 Q
5 h! w4 V* a7 s# j  W% ~+ ^- kN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
3 D. z* \, i4 ?0 j# }7 n' P$ n4 {1 S: p# x
'{$ElementUpgrade}', '{$ItemPierce}');");* g2 R9 s3 R, P5 ?( N+ l& f% E2 F
}
" H1 M  g2 h9 u9 U0 L" Z0 k0 `( {8 z  ?
7 B0 X, C/ f/ y! {}( R; l! A* }/ K! c
2 w( H% l+ D! j7 O6 m' b# I4 [
}
5 |8 u. I1 j. r: o
4 U) G  r' b- [* k! I. @$InitForm = InitForm();: _/ a2 r" f; L  O8 q
$Listener = PostListener();5 i6 a/ T$ q0 |- ~8 U, g

+ ?4 d, `; c0 Y. ~2 B, s1 @( y) O?>
; R! b, \% @# n( C: l) M. U4 G3 W, s  U6 F$ K0 \/ F3 L' r- G3 X
3 V3 {4 Y' Y+ t2 k5 o1 Y5 }
7 @: Y7 C$ R; _1 G  T  {# Z
; R5 E% T, a( `; H1 l9 U* p





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