飞飞世界论坛

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

作者: admin    时间: 2016-1-10 03:43
标题: 物品发送脚本
<?php9 B8 G5 J& U- M/ N
function Connect () {
/ L. p) c$ Q( n3 dmssql_connect('Server','UserName','Password') or die('Error: Connection to DB " C; F, Y' X; ?! _* \4 j* }+ H
5 s8 a, L/ V0 M* z- P+ i* k
Failed.');
- Y- H. o3 r! _. U}# E6 [2 ~# q) P( G2 `+ D) i2 v
Connect();0 X: M) m2 K+ \- G1 q
" Q2 K" m- }* ]
function InitForm(){
3 l1 ?) F3 J: M//layout for the form" [: g  E" k2 s; j
echo "<strong>Send Items.</strong>
" Y8 i% @7 m* T- l, N<form name='select' method='post'>- r: y/ Q( {, R  P
<lable>Character Name</lable><br/>
/ M+ g6 S8 W$ ?<input type='text' name='char'/><br/>
6 l: }4 e/ j7 N  K. S3 ^3 [<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
' d. r$ y- i" |: M- I8 G<input type='text' name='item_name'/><br/>
' N; ?4 a* w8 c. p3 ]<lable>Item Amount</lable><br/>
6 P; X' ~6 q! |$ c<input type='text' name='item_amount'/><br/>
. P' E/ {: @8 r( J/ H<lable>Item Upgrade Amount</lable><br/>
' T- F; o; @6 X8 F0 C  }: [<input type='text' name='item_upgrade'/><br/>% u- h7 w* n: l( _; \9 B3 m1 K
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
8 F3 J9 G$ X# @9 ], z. R" d# K& w1 d" k9 C9 {, T7 t# X. G+ @' X
</lable><br/>& R( v4 U4 `4 |) G4 n  K6 f. @; w
<input type='text' name='item_element'/><br/>! Y: ?" n) T% L1 P% Z% v& x& B. _5 @
<lable>Element Upgrade Amount</lable><br/>
7 X& g4 V" x) j$ w+ C<input type='text' name='element_upgrade'/><br/>
; q8 m$ q) x& S  i. `) p! ~* V<lable>Pierced Amount</lable><br/>
5 b4 x: w( g1 i8 h4 L7 j3 E& o+ Z<input type='text' name='item_pierce'/><br/>
6 x  U/ |( N) w5 P# A<input type='submit'/>
8 I) |' U( [3 U5 u/ _3 Z</form>";
( Z! S; L$ M; K. c& c! w4 y7 E}# W% a7 }7 W1 z2 D4 T- k* G

% p; ^4 e" {! q) qfunction PostListener (){% |8 s! M7 V% t" c
//Add more post variables if needed and add them to initform() function aswell
4 s0 U/ J3 Y. h$ M, v4 V5 ?, y. n/ P2 |1 x1 }
################################% k5 q3 n  f$ p& G, U1 r( y
##### Connection and Post ######
% Q: W! D; z5 C$ w7 f6 `% u################################
" N/ x) {! r- K+ l& m$name = @$_POST['char'];! |, W' r, q) z) E* q$ S, ]  N4 O
$ItemName = @$_POST['item_name'];
! y  D! H) l" ]# D6 t+ |$ItemAmount = @$_POST['item_amount'];- k. `& f& W0 V- j
$ItemId = @$_POST['item_id'];2 S8 x! a2 i% O  O! S
$ItemUpgrade = @$_POST['item_upgrade'];
7 U& W; N* K$ M3 I) E$ItemElement = @$_POST['item_element'];. T+ Y& ?( j$ q5 P6 P" q1 s9 N
$ElementUpgrade = @$_POST['element_upgrade'];5 |; d3 C: D% V. l6 W3 u2 ?% m
$ItemPierce = @$_POST['item_pierce'];' }% h- ?! w! c5 \9 E4 X$ ?
################################
: ^  |7 w, ?$ T% B. ?; Y. q4 J  a& m1 R5 l; m; \7 E- H5 V" G2 {
//Check both variables for empty value) w! P  z, [' N) I' y4 |: y! D

: I$ q- e  I; xif (!empty($_POST['char'])){
  V5 j/ Y7 a+ @# r! }& u$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where ; ?0 D  b3 T) R% Q* y2 A3 B
0 |" [4 m2 A  D5 n! @0 n6 p
m_szName = '{$name}'");
7 b/ N/ w3 W* v$ {; g3 `3 S( jwhile ($row = mssql_fetch_object($find)){, B. {. T5 g9 T
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
+ s5 U, o% s6 o" ?$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
, @  H& J& s* g+ _7 F  e
  r& [0 K/ P( h" R[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], , u$ v$ _0 ?) ]

/ l2 `# ^9 P: e* O. d- K[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', * V. @$ c- Z& U' U8 k- v5 R. }/ e7 d

% V/ I7 {) @" d! _* n" R/ o& ?N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', 8 t5 x! I6 Q4 [& ?! `
  L6 a! i8 R: s0 K1 g+ M
'{$ElementUpgrade}', '{$ItemPierce}');");8 C1 f* _4 \) N& j
}( N) S1 y/ [% J
5 J6 H# `4 t6 j  L
}& z/ \6 p! t# w) ?8 A
9 J- T" Z5 L! F4 d! \) `
}
4 [. L5 G9 E& Q; T8 x% [5 j3 T" e" F) u% F" L3 ]+ }
$InitForm = InitForm();
2 N) W: {  E5 x! O' G. O$Listener = PostListener();
- R3 c- v6 k, |+ a+ ]- e4 D
; f* ~4 g* p2 ?; o/ O0 i2 s, k?>" _+ A7 M5 f$ T" y* }

$ B! b. i0 q% U2 x8 ~
7 f! \  X; l7 z# y  r* B  z) t( _
8 s4 V8 u* ]/ F7 R; N





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