飞飞世界论坛

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

作者: admin    时间: 2016-1-10 03:43
标题: 物品发送脚本
<?php! X' [4 n& i6 c8 a
function Connect () {( {: R7 h3 @1 g3 @% T& G
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
, I: M6 ?: v$ w. t
) X) U* r8 T% t% {. `8 oFailed.');  d/ X5 k2 Y" A3 S5 ^
}0 ^# [( W% U- q1 i9 H" l: P0 a
Connect();& R3 R$ b# R/ D2 p+ W
: n$ K0 r" K6 J4 f2 E
function InitForm(){2 e2 W( `& t) h; s( r+ m8 v
//layout for the form
# ]- S/ Q) }9 J- f* U, Yecho "<strong>Send Items.</strong>: q# q2 a7 r- t/ `5 i
<form name='select' method='post'>
( k' _8 Q6 J# Q0 T  `8 ~" P; ~/ K<lable>Character Name</lable><br/>8 D- [' X9 b+ `+ I
<input type='text' name='char'/><br/>: ~' q. I1 A- O$ U/ i
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
" s1 Z  [! ~% u; {+ t<input type='text' name='item_name'/><br/>
. I1 E8 U! c9 o' m9 d<lable>Item Amount</lable><br/>* J" T6 p" ]5 h9 a, d; C" F( L
<input type='text' name='item_amount'/><br/>' {( m  Q  ~; p9 p. M# r
<lable>Item Upgrade Amount</lable><br/>
5 c+ E: v2 L; C! q& O6 ], O+ }# I<input type='text' name='item_upgrade'/><br/>
8 y9 o9 a0 a3 K# O! ^+ ^& K<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
3 @- \& r' A9 A, a! R. N& g4 a( D2 o3 s
</lable><br/>0 ], H1 O) \# F# q& x% Z- ~: x  T
<input type='text' name='item_element'/><br/>  \& ^) ~1 t' O, ~
<lable>Element Upgrade Amount</lable><br/>" D# {+ B8 u5 n! `0 y2 \# J4 m2 h6 q
<input type='text' name='element_upgrade'/><br/>
' a/ `* f" P3 L& t4 n7 v/ H; ^<lable>Pierced Amount</lable><br/>/ m% g9 `! ^9 i
<input type='text' name='item_pierce'/><br/>- c, H" J  l" T0 e8 U5 A+ B. D
<input type='submit'/>
1 B8 {5 q* m/ c/ J</form>";2 U* s3 D$ _6 `& }$ p* v& y
}
  q$ X. P( y" N8 g5 S5 J& Z# o& n5 X% Q) K* B9 S
function PostListener (){
+ r! F: U2 f0 n//Add more post variables if needed and add them to initform() function aswell
3 }( [. w0 ]+ M: T/ }. l3 {
7 \! K2 f1 N0 X& H* }/ P################################
, G# ?0 V$ \1 }##### Connection and Post ######
) c, N. N! p/ y5 O1 }/ c) S: j$ F################################
1 }/ F  b. Z$ G: h  {7 x$name = @$_POST['char'];
  T2 K( w" C1 e9 r" `$ItemName = @$_POST['item_name'];& i4 Z9 B- D) ^5 N% L7 _* ~2 j' b
$ItemAmount = @$_POST['item_amount'];' Q" r- Q) Z" `+ z# I- |
$ItemId = @$_POST['item_id'];7 y5 b1 G$ j' D2 u
$ItemUpgrade = @$_POST['item_upgrade'];
$ k2 ~3 u: j) g: [3 g8 a$ItemElement = @$_POST['item_element'];, R. L  T7 T: n7 X. m/ k
$ElementUpgrade = @$_POST['element_upgrade'];
; E" U& ]( C. c2 k% W$ItemPierce = @$_POST['item_pierce'];
# |; j2 e- a' J1 S" `& m" r' a) o################################# ^! l# J  m; _6 [: J: U4 H- e5 `
# ~0 h. X3 g. P
//Check both variables for empty value% s* C" V( p6 `( m, R
3 x/ ]* U5 y) K& A( E1 `5 M8 w& v
if (!empty($_POST['char'])){: F, L/ Y6 K5 c! L3 ~8 @
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
3 X( G+ V) _; @
7 k- G9 K0 B5 k& p$ k5 ]m_szName = '{$name}'");
) s8 l0 d9 V/ c4 dwhile ($row = mssql_fetch_object($find)){* s% O. E2 U! d- Y/ E& e. T
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
+ v. C# Q' j) j% V$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
# ?/ ?: H8 t1 H# M8 q6 N. C3 A
0 W' [1 U& K- z3 B4 |: F3 y3 v" |[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 3 b! L* A( o/ D. C& k1 y: H$ I

( _4 e( j+ q" f6 e9 I[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
! u/ O( O) p/ l- R/ |8 P9 v7 ^/ N3 w( y1 l
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
! `. I7 E0 k& p2 m0 ?" \5 D! E* h, c, A* D8 E
'{$ElementUpgrade}', '{$ItemPierce}');");
- |8 O/ x& U0 z2 H$ h}
3 N; ^. y/ ^2 I" u$ C6 {% \2 ^  y8 F3 H6 [/ y2 l- @
}, K% Q5 t4 W5 I+ O4 I+ Q% I

  V8 G5 u: |% |6 j}
8 Q- }  x% k, n+ G" f
+ k' O+ A2 o* y3 ~! ^$InitForm = InitForm();2 w0 R* Z* Z( W* d  k8 M8 _
$Listener = PostListener();% V/ v) Z4 U: \. J( }
& K  p3 |6 Q8 K4 M$ R& {" u
?>2 p& X1 W/ L8 m1 e" G: M- C

1 N4 B# O/ S! [4 y# |5 x/ k
6 h$ U+ {% k2 Y% a( [% V9 o
% q* ~: w/ ]; E& W# Q: }
9 F- A5 j5 G! K1 K- L% W




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