飞飞世界论坛

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

作者: admin    时间: 2016-1-10 03:43
标题: 物品发送脚本
<?php
9 E! |" w1 s$ S% A+ B  W3 Pfunction Connect () {2 F  n0 o7 w. l1 z0 E- {& J( `- b
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
: A; d/ c  `: M. W- ~) w, i( q
2 b1 r! P! K0 b5 \1 n. A' yFailed.');
7 B5 z: p  c! _6 |; u2 Z9 x; k}
$ u8 l# Y" ^4 ?0 A$ {% z- X  wConnect();) b) v- f- l7 F; b% S9 ~) ~, {. o
8 C* d! \3 y: r9 D0 I5 J3 L3 q
function InitForm(){7 {% `, G, z- w, }1 n$ u* \
//layout for the form
% C# }+ G& u$ Q1 O- E: H6 _echo "<strong>Send Items.</strong>
/ a3 D# _$ ?9 z<form name='select' method='post'>, M$ c5 V4 C! [% y
<lable>Character Name</lable><br/>
* s1 _0 G( i: P5 T9 r6 s' l, e<input type='text' name='char'/><br/>0 o6 _$ v. U+ `* x2 m1 S
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
3 G; L) V2 k- k" w0 a1 x0 G<input type='text' name='item_name'/><br/>
3 k3 q2 h' h+ c/ g! N  b<lable>Item Amount</lable><br/>
7 [/ k% I: H6 i# V<input type='text' name='item_amount'/><br/>
. m) N# I$ Y+ D) Q<lable>Item Upgrade Amount</lable><br/>
* A- P" _3 I8 I<input type='text' name='item_upgrade'/><br/>
. w3 Z( A, v, H* f# }0 I8 p<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)2 M+ T4 G2 P' y5 C
* K* O# G# f# w  P. ]: ^
</lable><br/>
: e# {0 J( h  `5 p! Y3 @<input type='text' name='item_element'/><br/>/ {, G% o4 w/ w  d3 W* T
<lable>Element Upgrade Amount</lable><br/>% {3 w9 B/ E3 n6 |4 J2 E& m
<input type='text' name='element_upgrade'/><br/>: e6 q4 D* j! {( b: y% Y
<lable>Pierced Amount</lable><br/>
5 ~% C, r1 {1 u0 G4 _( X3 l6 V: b; N<input type='text' name='item_pierce'/><br/>- j/ ]" D7 E: {6 c! u
<input type='submit'/>: L: X. \% J3 N2 A6 L
</form>";+ t8 d- a8 H0 \! `2 i7 t# \+ [: e
}
6 G, q# E# g& F) D" [! W- q6 D& I" i9 \! D
function PostListener (){
- O0 ^; L# ~& F, u//Add more post variables if needed and add them to initform() function aswell: O, p. x/ \" `1 w

1 \6 b- P# U9 g/ m) M################################
+ [5 P( ~& [/ s" t& u. F" z6 u* w! s##### Connection and Post ######/ D* n/ Z. p" p( J5 X
################################
/ F* d; i. t( I/ C" h6 M0 o$name = @$_POST['char'];4 \) H3 v& A# }6 i% L
$ItemName = @$_POST['item_name'];
" p% e( \/ K9 X/ r, e& X$ItemAmount = @$_POST['item_amount'];' Q$ c8 J! n0 q: y* {
$ItemId = @$_POST['item_id'];
3 L  d. p7 v- a- N; ?: X$ItemUpgrade = @$_POST['item_upgrade'];
4 M0 k& d' ^. w# S& {( O- s$ItemElement = @$_POST['item_element'];9 ?  D0 @3 K- V$ O$ j8 e
$ElementUpgrade = @$_POST['element_upgrade'];
. _% C4 C' f4 A; F$ItemPierce = @$_POST['item_pierce'];
4 e9 G0 X" Y/ c################################& s2 K+ M: D5 \9 r8 ?. E
. ^- Z$ g, h% o/ w+ ^: @
//Check both variables for empty value
" J0 }7 S, N* f8 q' U& S, U& I! h+ d5 d; p7 y; T
if (!empty($_POST['char'])){# A1 W8 o% P  E/ I, ~# @
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
' p# N2 O; ~8 U  m0 }( X# g
0 y* a6 N! N/ r) I" Im_szName = '{$name}'");
' K! ]% _; r' zwhile ($row = mssql_fetch_object($find)){* j+ e* @, \7 c7 q) Y3 K. h; e& t
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";1 p+ {. K' k; w! {5 Z& X
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], + z. q3 L# x* n

6 s& v4 n1 v3 H[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 0 k0 l0 ?+ J, M* D( n. y* I
0 s1 s( R- A& B! y6 N
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
! g2 e& e1 s' {. i1 k% b% q9 e: c" Z% L0 J
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', 7 I+ H) G5 G- n$ F& R
' s' {# `$ r% m: c5 k( `3 L
'{$ElementUpgrade}', '{$ItemPierce}');");
; x, ~  X, {+ v, ]6 b* ^8 W' O1 l}
6 w, x3 B2 x- {6 H6 x! \- n* O
/ F) o0 D) G4 I, [( \; H. ?* f}
2 K2 K$ J7 D$ u/ S1 m7 v; ^8 ^. i$ E9 |# A
}
, t& v% ]* b1 `' r) z
( _# O% y4 b' f: b. ^# t( J$InitForm = InitForm();8 M/ j  q+ M/ |4 `
$Listener = PostListener();/ m. t4 b9 m8 [0 A' y

- T" _: n% u! {; p; n?>
: B4 L! X; u* I) e5 T$ G6 U
3 ~* ^. {, @* m; i  A& r
  i; |0 H4 V0 v0 q/ t7 F- h. ~. V/ p" Q/ D2 t# Q. p. N

: P* @1 z5 f2 b( o




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