飞飞世界论坛

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

作者: admin    时间: 2016-1-10 03:43
标题: 物品发送脚本
<?php' l+ Z& G& o3 M% ]; e
function Connect () {& k: S0 o, W" P
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
, E+ d  u$ d# N  g% y
+ d7 j$ p$ a5 _3 V& w, c- c. C. `Failed.');& i* `8 g3 [, F- l1 d4 c
}
5 F  y5 z& A% a( dConnect();
* o  b5 Y- [" c) d7 }, N9 T: }
. v0 N# V1 J  j% V5 U( nfunction InitForm(){5 W$ I% O$ x( m& a7 r/ t+ @
//layout for the form7 a" b% i+ U  Z& ]* N: y
echo "<strong>Send Items.</strong>
+ K- N7 x- G$ D; j% H* G<form name='select' method='post'># x* o. V( U, |' j, y: g6 T# X
<lable>Character Name</lable><br/>
5 G1 r: q" L# r$ g( f5 C<input type='text' name='char'/><br/>% C* h$ J/ \! `& ^# U
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
5 {* }% \7 ~' l: u; s6 P) _( O<input type='text' name='item_name'/><br/>
, ~+ n- K$ }: D, T; {: N<lable>Item Amount</lable><br/>
9 F& U) l; G( ^" g7 k<input type='text' name='item_amount'/><br/>
' H" L* j* j/ D2 c' `( ~" {. S/ m8 F& _<lable>Item Upgrade Amount</lable><br/>
3 g/ r* p( f0 _4 f2 }" q7 R<input type='text' name='item_upgrade'/><br/>
* E: m) C' Y$ R0 r$ X6 ]# C<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)/ A0 ^* Z: n' q5 ]. n% E0 h. c
' k9 w  D; D- l* ~$ o( L' [; J
</lable><br/>
: w7 B- ?& U7 ]<input type='text' name='item_element'/><br/>- J8 g4 @3 ]1 I
<lable>Element Upgrade Amount</lable><br/>
7 H& d  X4 r6 {<input type='text' name='element_upgrade'/><br/>
8 v) o$ r! Z4 q. y; P<lable>Pierced Amount</lable><br/>
& a+ v1 T# V3 a' T1 W4 R$ i3 H! k( P<input type='text' name='item_pierce'/><br/>
0 ~; u$ D; p. i7 c' A6 O3 p<input type='submit'/>' E1 E: ]1 b* C: H( v& F1 \7 d
</form>";
  @; c. W  Q  B+ x* N; M}* n+ d/ }1 M; [$ J( Y) m5 d, \3 n
8 d+ u, u; O. C6 [9 y3 Y9 ^' y; M) e
function PostListener (){
! C' K  F7 B; d: r! T//Add more post variables if needed and add them to initform() function aswell
, J' z% Y" z, Q! c! d5 C+ e, [! b! A) a& L7 L
################################
9 P% E6 z! |/ N0 E" V##### Connection and Post ######
) B) E" S! N4 V################################
; |4 ?$ V" m( N8 X, K, W; U) b' l$name = @$_POST['char'];
" y( A3 r- V' u! F& @( l$ItemName = @$_POST['item_name'];* r3 K% w7 s2 N6 Q* s6 L, ^
$ItemAmount = @$_POST['item_amount'];
' l9 t- e4 A% Y5 Y$ItemId = @$_POST['item_id'];0 r' r& \# h  Y/ _8 t: Q
$ItemUpgrade = @$_POST['item_upgrade'];
! Z9 V' ^  l6 `$ItemElement = @$_POST['item_element'];
4 I- l6 v0 D. B0 D/ }% w5 q! G$ElementUpgrade = @$_POST['element_upgrade'];
6 x; y8 A$ h! G2 _+ A$ \5 R+ u: S$ItemPierce = @$_POST['item_pierce'];
- h6 O7 K, {6 e& w: ~7 X################################
' B5 d( r0 P  Y- X: b$ ~0 U# q) l- U3 ~
//Check both variables for empty value3 e: r- ^" a: s. }0 T. @

5 {3 x" b; p# R6 V( l" uif (!empty($_POST['char'])){
8 _  o2 F0 U- f$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where 8 i' T) E7 w, A7 i

2 Y  ]( U1 K9 d( A7 U1 em_szName = '{$name}'");: p* [. o9 ~8 w' h: i: a
while ($row = mssql_fetch_object($find)){
8 {9 K! |# q) f% q! L- ]% d. Iecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";* h$ Q: r. t' ~# Y, }
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
7 b8 H' w8 s+ n0 G9 G8 u' M
# z; R8 a6 V, f9 w' T% K( P8 B[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 9 f. Q, L6 _' Q5 p2 _0 o
8 ^# E! c! B& S; q- `+ o
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
1 X) o) \& i+ r% ^- @0 l) D7 K4 s: y- Y
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', / L" c8 E* z- T0 B" s; |
  p' E" k& Y1 n; m4 M
'{$ElementUpgrade}', '{$ItemPierce}');");
2 a% D0 J3 o6 s  q1 B# I3 B}
5 @0 q4 s+ P) ?) D! G# W) E# s! N: k: {: B" L* r
}5 L* R# X5 b3 e  C

( Y, Y) j8 A1 B: W& b" r}
7 }8 R2 m2 |/ O, a9 m8 G4 m) J6 y4 L6 ]- ]
$InitForm = InitForm();
: S$ l/ ^) c  u( m% }5 ?! ?5 x$Listener = PostListener();
) i# X; {3 Q: `, o* }8 {+ o. g- t" B! k3 C+ w
?>3 q0 S- n1 T$ }$ w/ M
. w  X4 k+ v' o- O1 `8 V& d  \
( f$ s; @$ q* b! `2 T1 p; K6 L

/ q% }% v2 q) Z3 c) x, g
) F- e# w1 R  G4 x% p, J" a* r5 ?




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