飞飞世界论坛

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

作者: admin    时间: 2016-1-10 03:43
标题: 物品发送脚本
<?php
* A2 e' _' L! z0 xfunction Connect () {4 X* G& u- o8 r; n0 c0 O
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
/ C0 Q" o' ?) k, y9 N, s0 ?* V( L2 K, A7 P0 Y# |( T
Failed.');) w, r% u, ]. G
}0 L( n! m1 h  Q) {
Connect();
$ F9 K) C- o; \
1 X6 E2 ?) Y0 h- kfunction InitForm(){/ @9 Y+ K/ t) q# Y0 X# ^  K
//layout for the form
+ o0 y, T& @% Becho "<strong>Send Items.</strong>7 U" u' g- k! ^- E
<form name='select' method='post'>
" z* w+ d* W- T; Q% u7 ~. t) v<lable>Character Name</lable><br/>% b. m6 G. h: M3 K/ P% z2 D* B* m! ?
<input type='text' name='char'/><br/>& D2 L1 s" A# U8 S' `
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>: m1 B1 U- m2 _* D$ o% z
<input type='text' name='item_name'/><br/>; C. T! O$ u( l
<lable>Item Amount</lable><br/>! L' c' d" i, ^" _2 S- f- q+ e
<input type='text' name='item_amount'/><br/>( l  R( ]1 v" e) M
<lable>Item Upgrade Amount</lable><br/>
5 C1 ~1 \9 W4 k6 t<input type='text' name='item_upgrade'/><br/>6 n! ]& S3 ?( r; a6 {' P# ]# o8 q
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
; \" S; p$ B0 w( d! T9 G; o! z0 B, S6 I: K  s8 H7 K, B- u0 `
</lable><br/>
5 k9 Y2 V, ?2 }4 L" |' _, B) n. Q<input type='text' name='item_element'/><br/>1 D, q( r" \5 r. ~: o1 s
<lable>Element Upgrade Amount</lable><br/>' b$ Q* ~7 [3 D# h: M1 r+ V; E/ h
<input type='text' name='element_upgrade'/><br/>' q+ A' `$ H  |
<lable>Pierced Amount</lable><br/>
+ h( k* o, L; P<input type='text' name='item_pierce'/><br/>
' V" H: c4 @  O+ |' U<input type='submit'/>
' Y8 b, W9 v+ s) F- p/ H: ?; U</form>";
; o+ \$ T. I0 {' q8 b) ~" ^}( Y- M: [6 g$ [6 i5 o0 |  e
/ ~8 J/ P9 t4 W$ v) v1 S
function PostListener (){3 u0 G1 N  N& I/ X
//Add more post variables if needed and add them to initform() function aswell0 y9 L. _5 m  h! G1 E

9 w4 F+ A  I- t$ r; Y$ m; `################################. }3 i, ~, h+ E/ [: {2 t
##### Connection and Post ######
8 n$ u8 c8 M4 `/ C2 H################################$ ], K, m0 B8 M- M5 M, ^
$name = @$_POST['char'];
% e- V& T+ ~; ~) K3 }7 d, B# f$ |+ n$ItemName = @$_POST['item_name'];# D! w# R! m- _+ q# m
$ItemAmount = @$_POST['item_amount'];, D# ]$ j7 M7 I
$ItemId = @$_POST['item_id'];
0 M, D% g3 c" J5 l, l) L& \$ItemUpgrade = @$_POST['item_upgrade'];2 H' B5 K# a2 c" \1 `
$ItemElement = @$_POST['item_element'];
9 D  o( G5 J0 Q4 k: i" \$ElementUpgrade = @$_POST['element_upgrade'];
- @! s1 d/ \) x, q) k! J1 i. }$ItemPierce = @$_POST['item_pierce'];
; p0 }- u! }: S################################
* C1 Z% p3 G2 ^, H) n2 _/ a+ Z
" H" B3 b9 j5 _6 @//Check both variables for empty value
5 |7 v. u3 ]& G$ {1 f: Q# Y. c) V2 W4 p$ a2 ^7 i
if (!empty($_POST['char'])){9 O* w; @" X, t! O8 h
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where ' J7 z0 Z# A( X
( y) m; e  z" n
m_szName = '{$name}'");
: `% v, b4 _! _, G' fwhile ($row = mssql_fetch_object($find)){
6 A, G/ r6 I* J; jecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";) m9 x# x. l2 C% i
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
' k8 G% t( ]$ `4 X' ]2 L
& C* O. Z# L3 ~, ~[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], % p, a7 G, t5 G' B1 d) v  ~) h1 s

- l! d: r3 u, f: Y[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
* f* U& U3 U2 z0 w. h( ]5 @* |2 V& D# k2 F) K
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
. _; q* q! p1 u, n& V$ F/ `# y, x( V# Z6 Z7 T6 ?- W
'{$ElementUpgrade}', '{$ItemPierce}');");
* V5 ]9 n  m8 N3 }" @! C  w6 D}- f1 j5 ^! {7 u% g6 s( O
9 \9 L; G9 P1 C0 {# j; N; A
}3 h+ g/ l* w9 `5 F
' H' S9 P* h. l
}) M/ d4 B) ^6 L7 t$ Y" C8 _8 G# I

: L, t" y: X, D+ }% e8 V% I$InitForm = InitForm();
4 D3 E1 v) t7 h& c( w# \! p$Listener = PostListener();7 v: m3 e  ?: a& J3 B) h
' K6 u& ^- G7 b. J9 ^' E+ k$ ^1 b
?>" ~& r1 o5 E2 U/ k4 F% H
' }2 r$ j' t; a( O3 L

% L) V4 q, T: N# r
& J7 s- |. A0 Y7 ]( K3 }: b/ h5 ^6 D) b" w( v





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