飞飞世界论坛

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

作者: admin    时间: 2016-1-10 03:43
标题: 物品发送脚本
<?php
. ~6 ~( y! A7 m, S9 A. _. ufunction Connect () {' @( Z. X- E* a0 L; B$ k( I
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB - r' r6 b% B; a
3 \; O  q! N: n
Failed.');
' a1 r1 F% L# |5 z+ I' [% |  T}
1 f9 d9 m( ?4 ?4 c& c3 ?9 @Connect();5 v7 ^( A, R- T9 W
  g# \) O1 T" W$ U1 c# K
function InitForm(){. y3 B; Q+ _5 n
//layout for the form! M/ Z& K3 L8 a& f' c/ G
echo "<strong>Send Items.</strong>
# x8 S0 N) L. o! u; i- v5 F<form name='select' method='post'>
# p* P6 @" K# {3 a! m$ B. X5 r<lable>Character Name</lable><br/>! D# W7 }3 G$ ^) Z, O
<input type='text' name='char'/><br/>7 q( ~" e9 u8 I3 p& J
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>. v5 e# H: |  J. X7 v' [+ z9 I6 y
<input type='text' name='item_name'/><br/># o0 x- a" \& @; z4 u- {
<lable>Item Amount</lable><br/>1 ~5 f4 U4 y2 Z
<input type='text' name='item_amount'/><br/>
6 B6 s; B0 ~/ L+ n! P/ K' m3 b<lable>Item Upgrade Amount</lable><br/>
( x3 @3 B3 F! I  s$ H<input type='text' name='item_upgrade'/><br/>
' m! A. V1 J4 b1 M+ A9 X, ?. n<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
2 t& W$ E% o  [: w# t' s7 E2 G8 E, s$ U; u' j- b/ Z$ L5 ~
</lable><br/># Z, E/ r5 w5 T( j; p
<input type='text' name='item_element'/><br/>8 t5 A3 h* C; W& w7 _) m. q
<lable>Element Upgrade Amount</lable><br/>
, D3 A; `% }  Q* c( w9 M<input type='text' name='element_upgrade'/><br/>
$ z/ P% z+ m2 ~: v0 {<lable>Pierced Amount</lable><br/>8 b) j" v( o) l. z! @$ I' @% d
<input type='text' name='item_pierce'/><br/>
) A2 y& i+ [/ x' V! S<input type='submit'/>
0 e  R/ f3 s* u( }) V: ?, k</form>";7 m! [* L/ O$ K* m. @, m
}
3 e, |$ S: `$ i' h( M; V  e  o; ]/ l0 o1 A, M
function PostListener (){
5 p9 L  b. U! a4 G: _//Add more post variables if needed and add them to initform() function aswell
0 C* ?$ _# L/ w6 y( P1 |0 f$ }& W
$ E7 X! f2 t6 u' b4 c! _1 t################################
1 G7 s( X. M: B8 r; a##### Connection and Post ######
- B' p4 W7 A  I8 F################################
! R- t. \7 P8 g" }) M8 t$name = @$_POST['char'];1 x% t( b! t9 H; M# J$ B
$ItemName = @$_POST['item_name'];  Z" |2 {" A4 j' t4 p
$ItemAmount = @$_POST['item_amount'];/ t1 T5 l2 W: Y5 C; ]
$ItemId = @$_POST['item_id'];
" g$ |0 m$ ?# o  [8 J: A+ u$ItemUpgrade = @$_POST['item_upgrade'];  ~5 P9 P1 s9 [8 Q) d  h/ g2 F, b" D( n
$ItemElement = @$_POST['item_element'];; x# m, R! l7 S( j- x
$ElementUpgrade = @$_POST['element_upgrade'];
' o5 q# _0 i, y9 E) u; ?! y$ItemPierce = @$_POST['item_pierce'];3 C9 ?7 A) H& G0 j1 w
################################
6 M& o! b; f( ^" K* `" ]8 _! e5 V4 u
//Check both variables for empty value7 f0 ^2 ~' d" u) h4 y, _. g

+ S3 d& w0 @& q: q! F" Hif (!empty($_POST['char'])){! e/ H, i8 o* U! {8 ^' h
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where $ I* u7 v% t8 k& x( z6 i* S

* N" Q" S" p: Om_szName = '{$name}'");
0 _8 _+ C8 B% g8 {  |" B! F* Uwhile ($row = mssql_fetch_object($find)){, K  \) e) y+ b6 M5 x6 V1 `8 ^0 q! l
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
2 f; q& R0 ~! O, x' O" ^$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
7 G+ F8 ~7 F3 ~; l; x
$ w7 \, U2 ?5 d7 @( V0 a[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], + e& G0 G2 @: e7 f8 g% Y3 I

# }4 R$ f2 O! x[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
, n& [, {3 Y! C3 f- R
, G0 d" I, f% @0 ^( A! GN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', / r/ Z+ {* j# i" m
3 h' Z# r  H; T# X4 M/ q
'{$ElementUpgrade}', '{$ItemPierce}');");8 I6 q; h3 x; V
}; I6 |" f7 V8 i/ I, J9 z
; M7 j$ [7 H" W+ j4 e9 [
}0 w# o& ?6 O4 R9 Q

3 \+ f0 M# F) h3 Y: J4 f}7 T% O) M' [/ Y% Q5 e. R. V
6 k9 S  H9 U! t! X: E6 ^
$InitForm = InitForm();6 O# }! q  E1 d! F
$Listener = PostListener();
' l3 O0 g8 \2 p; W0 M4 y" Q& h1 Y. _: W8 O0 {$ R* K+ Z
?>
0 B6 Q6 c6 ?0 j+ M7 ?$ }5 f: m9 i* m' z+ Z) i3 P: E4 a. q
* q6 d1 N: I5 y" G8 l! K$ m3 Q
8 y, m# \5 |! p; U1 V8 W! ~

* |$ d$ G5 g$ V2 p# X5 e* }' L3 \1 R




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