飞飞世界论坛

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

作者: admin    时间: 2016-1-10 03:43
标题: 物品发送脚本
<?php) b, k2 J1 L5 \/ G. c; t; d6 Q
function Connect () {7 H  A. D4 `$ ^/ y1 d
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
5 D2 |. n$ a8 r4 H+ T0 ?& }# K( p/ n7 s! O
Failed.');
( A( r1 T: O1 x  u. Y8 L) i( F7 i}$ x" {" c/ G8 a* h$ R3 ]' n
Connect();
; A9 p( o  |1 I" p
2 G( K. K6 r8 G9 C1 a$ t% Xfunction InitForm(){" a, W+ p  K& h; T0 ]  a
//layout for the form% r  @8 M4 D0 B; E* L$ ^
echo "<strong>Send Items.</strong>3 z9 B- Q( s4 n+ v- d: J$ A$ P
<form name='select' method='post'>! v5 ]% S7 S3 Y$ {8 p4 C
<lable>Character Name</lable><br/>
, U7 D2 c5 N  `8 h$ K<input type='text' name='char'/><br/>
7 o; U3 T% H2 \; C) p) d<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>; c4 S9 p; m4 Z4 Y: B  \
<input type='text' name='item_name'/><br/>0 ~+ ?( {3 D/ i- I3 c2 R1 N
<lable>Item Amount</lable><br/>
' x5 G8 r3 }) Y! y$ z) j' A<input type='text' name='item_amount'/><br/>4 i( p+ C0 J: L, V- E6 ?  F
<lable>Item Upgrade Amount</lable><br/>1 p4 b# _/ o! G+ r$ x) A9 X
<input type='text' name='item_upgrade'/><br/>
8 k, B9 V" u+ \& x6 W<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.). l3 V5 a+ N* u
3 v' y0 T" J3 a+ [- v3 N
</lable><br/>
0 g' N  G7 H% I8 F+ ?7 h! c! |) G<input type='text' name='item_element'/><br/>, X/ v6 D# s; R- i: b5 l8 B
<lable>Element Upgrade Amount</lable><br/>: g4 F" B$ c" O& f
<input type='text' name='element_upgrade'/><br/>% N, ~( W0 o9 x1 g' m/ M+ Z
<lable>Pierced Amount</lable><br/>
1 J% P! N$ F& {3 T- u<input type='text' name='item_pierce'/><br/>$ L% X2 A6 L& h! e
<input type='submit'/># B0 y; U; K9 X9 ^8 O0 T* T
</form>";
2 v8 o2 [' u- A5 a}
! f; r" j1 S/ a& Z( Q5 G$ K  ^9 u2 @* A2 M8 Y( b6 M2 z3 ~8 H2 `
function PostListener (){
' k  c  p; ~* f8 Y, }//Add more post variables if needed and add them to initform() function aswell# U: Z& n3 a( @

! P+ }+ i7 W/ n################################6 _$ w; u8 H: u. ~/ q
##### Connection and Post ######/ i8 }0 L# [6 J& W$ i6 W
################################# H* ], `0 T. u3 Z/ d
$name = @$_POST['char'];
, ^: G* _/ ?  I2 c6 k0 ~2 |$ItemName = @$_POST['item_name'];9 U4 s2 [0 L( U
$ItemAmount = @$_POST['item_amount'];9 w, X9 ]6 _+ c; I, r
$ItemId = @$_POST['item_id'];, L( X" N+ E% b  c1 v  b
$ItemUpgrade = @$_POST['item_upgrade'];
: a, }, k% _+ n" ?# _! Y$ItemElement = @$_POST['item_element'];# A3 D) c2 Y) `. Q' R8 J' G
$ElementUpgrade = @$_POST['element_upgrade'];. a( C7 L( S6 @3 {) R
$ItemPierce = @$_POST['item_pierce'];8 y5 l  e. {4 P5 o4 `
################################
. g# t, X% |. b: z: w+ A4 F5 S) H$ Z3 E# K
//Check both variables for empty value1 ?4 X* L5 }# K& L0 D4 v

# T; }1 H9 S: x; i# _if (!empty($_POST['char'])){5 W/ k; @2 z) z. K# p
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where ! O) n5 I. u, m- o; d0 F! `

8 q1 h  S/ ]( d) R' Um_szName = '{$name}'");
( x, U3 y4 E6 V# o" E7 ywhile ($row = mssql_fetch_object($find)){
" u, w' K# b( hecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";- g2 x- T" h% p6 m3 ]- o% ?% D
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 8 M9 Q3 q; U( R( n% [* E/ a  L: V
; t. C0 r! J  n2 {! Q
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
1 y  `, F1 y$ e5 z. O8 d
# Q  i9 B5 f1 p7 p" S& K/ F[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
% {# ?) V. \' Z6 _8 [& Z' U- W% j  S& |6 P- s: K
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
/ f3 j/ d# ]# K
, K6 Z* ~8 x* V'{$ElementUpgrade}', '{$ItemPierce}');");
) H( L% y9 y5 a* p& O( Z- x. b}% ]! e! j. R, t+ }  ?7 n8 {

5 ~6 W) a( ~( ?3 Q% i}3 a' s+ s8 k2 w2 L: q$ ^

# a4 ?; `2 w5 D, X9 a. M}1 h. W& W% W# q
% K" C0 G* D0 A! L4 X( g) I
$InitForm = InitForm();
# _3 W; v8 W, K1 A7 p$Listener = PostListener();. Y6 N* v6 g$ e' O- }4 p9 X3 \1 N
* i7 n- o8 @; E4 d: H: B0 c- C0 c
?>/ t. F2 u; |( F" O0 M5 x& V4 z7 {

2 s( I; S1 J) S# y, E( t8 c3 S9 ]! u: H0 t7 \8 H/ i/ B
( [7 l; ]0 b4 i  A: o/ I

) P* \2 H0 N6 n4 o5 F( H. p




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