飞飞世界论坛

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

作者: admin    时间: 2016-1-10 03:43
标题: 物品发送脚本
<?php# A  m& f( `8 t: h
function Connect () {
8 s9 M% ^7 g$ s' ~6 z7 }) u- ymssql_connect('Server','UserName','Password') or die('Error: Connection to DB 2 d5 i5 |1 t6 J- X3 Q

  b1 ]- ]3 k; o: ~3 \2 nFailed.');) s3 T  L  [1 ~% C, g' V! P
}5 c7 b6 ]4 ?6 b- C& b; e# w
Connect();
, e" t2 V  i2 D4 e& B
7 W: c' i9 x) f' c# tfunction InitForm(){  f$ Q4 H$ q; g. s
//layout for the form
1 P1 G1 U3 @$ W  ?3 M! [5 P+ }echo "<strong>Send Items.</strong>
( m5 k$ y+ _$ g& P<form name='select' method='post'>
0 \: R5 {  o" ~<lable>Character Name</lable><br/>
* T7 C, _7 u% j( Z: P0 c2 {' ]<input type='text' name='char'/><br/>
+ @' p$ ]/ p3 }* m6 @& n' @<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
) O( I5 ^6 e* T<input type='text' name='item_name'/><br/>
+ ~* ^0 x- ^+ X2 E) h/ P<lable>Item Amount</lable><br/>
  X& |& W* ^. ^7 M<input type='text' name='item_amount'/><br/>+ S: o7 u8 G2 F# l- L! T
<lable>Item Upgrade Amount</lable><br/>
* ^; F2 G2 u6 M8 `, ?7 f# D<input type='text' name='item_upgrade'/><br/>4 ?* a, a" C5 U4 c
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.). y; T/ c3 C1 N4 y2 ~% B3 g" H& ~
  c! w2 \7 e4 z4 H
</lable><br/>
) B  {: ]6 }4 ?. x. Q<input type='text' name='item_element'/><br/>2 a2 c/ W0 x9 N- t: I5 t& z* q
<lable>Element Upgrade Amount</lable><br/>
2 `/ ~) G- ^  O<input type='text' name='element_upgrade'/><br/>
" g1 \% P8 D$ ?  Q0 }" j* [<lable>Pierced Amount</lable><br/>; O: I( J$ i$ R2 h4 w
<input type='text' name='item_pierce'/><br/>
4 T4 T& H2 M, R7 j6 V& B& r<input type='submit'/>/ ]9 ~/ h8 I: B4 l: V
</form>";4 n5 \# J  O& M" }2 N9 `2 B
}$ u& i+ G, h8 `. o

6 \1 J4 J, S% \$ }function PostListener (){7 n1 {7 N6 U7 r' H. y+ H) _! V
//Add more post variables if needed and add them to initform() function aswell9 @1 x6 E+ c8 }
& B* W% \# |) q, e: c
################################
5 Z* b2 [: T. z- C6 b3 J  g1 A3 u2 D##### Connection and Post ######
- @# U* b  J# J################################
) \4 v+ ]2 n6 U% k2 r7 d$name = @$_POST['char'];6 |! N$ \# r  F) P9 i4 j: ]
$ItemName = @$_POST['item_name'];: B8 E8 k/ J* W* U* \; g1 [# s
$ItemAmount = @$_POST['item_amount'];( r/ u! u9 v- t8 {# r# S
$ItemId = @$_POST['item_id'];
, W. g1 t/ N9 j: @+ Q5 w$ItemUpgrade = @$_POST['item_upgrade'];
- z$ N. u4 Y+ N" u2 O$ItemElement = @$_POST['item_element'];
& ?) y- y+ o. T' [* z) G$ElementUpgrade = @$_POST['element_upgrade'];
. A4 L1 U# H2 {  c; v$ItemPierce = @$_POST['item_pierce'];1 c0 |9 A+ a! N, @0 W: u  x
################################
1 h3 r& J( |4 ?: f& ~% u
2 K+ i% J; b) K) I4 N. L5 J$ [/ F' B//Check both variables for empty value
( V* T  s- @; K/ L. ?  o
8 s* {$ ^: w+ ~' Y7 @  Hif (!empty($_POST['char'])){
( X( Z; O* ?+ b0 x! `0 ?' l1 z$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
( |6 _* Q' d$ I7 o: N& W
) w4 C4 N8 e  {4 x+ Am_szName = '{$name}'");$ h# n8 V6 o/ u; \( z1 D% c
while ($row = mssql_fetch_object($find)){4 w3 G3 \1 ^6 ]
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
4 M. F" i+ o2 w* j0 K& P0 B& b7 j$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], # ~5 I+ G) L4 u+ t7 I  t) R1 _

* [* A( g* h4 ?' R0 |[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
( |! E+ @* k6 D; X% I/ N* T" o" y8 j( F6 M0 L& ?
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
- ^! U1 n" W' M* P. f2 X
% }% o+ x' ]) f' J  @# DN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', 5 n: m5 g" z& I+ u5 \* w
9 v2 K) E* [9 M, q/ }% i
'{$ElementUpgrade}', '{$ItemPierce}');");
' J+ S. s; }/ H}
* z9 d( n7 S- R( Y' U5 [, r' y+ @5 a1 F. {% {6 W
}$ J( _) ]: l0 |! g
; O4 S7 Q2 j# [. `8 X, e% j4 ]
}
& q( \) M0 Z6 ^6 S/ |7 R# W3 Y
- a+ A# d/ }. Z. A2 i3 D7 V$InitForm = InitForm();
) n" ]' I# |3 ?4 W$Listener = PostListener();- I4 F7 B# M; q+ N$ V

3 q6 r( E1 M1 P) X  O* d; g2 {0 u?>
# I& D& s1 R  ]
, ^9 k1 {9 o3 p- t3 k2 _$ g! \) U1 R8 E" r, ]

. u, v1 g7 L* c& ^4 O/ a" f/ d8 [9 u' F





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