飞飞世界论坛

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

作者: admin    时间: 2016-1-10 03:43
标题: 物品发送脚本
<?php
4 c( O1 _3 r3 G. ~" _% {; R# I+ ifunction Connect () {0 b0 U$ T( R9 L3 Y1 ^
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
5 u% a& J  v+ S) \* r  u
5 b8 x- D0 @6 {& M$ H" X) ?. {Failed.');
# G/ w$ c7 m$ E" i}7 k; o4 e) i/ F. b) y' ]4 x
Connect();
" \7 b. ^: w: _9 y3 U
2 F6 `6 y, i- K, }9 W0 V1 Pfunction InitForm(){
& n2 Y3 f' i! W1 b9 F, d% D//layout for the form
5 X% @- R4 \- a3 K  _- Z' ?0 }: eecho "<strong>Send Items.</strong>
7 J( f# O: i3 S! V# o- D! Q4 S; F7 E, [<form name='select' method='post'>
% r* s3 E5 n( l/ m1 m+ c* p<lable>Character Name</lable><br/>
6 }- a1 f2 \: Q6 i<input type='text' name='char'/><br/>' C# [& Y' q! A
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
7 S2 S) Q1 ~  _5 ^" r. F<input type='text' name='item_name'/><br/>+ A7 m4 f& r/ e, z
<lable>Item Amount</lable><br/>3 n, B5 J; k( C4 A' x6 x7 @
<input type='text' name='item_amount'/><br/>0 x% s/ n! [- a
<lable>Item Upgrade Amount</lable><br/>
5 @% p, \* ]3 s) i& g. C<input type='text' name='item_upgrade'/><br/>& \; w6 @8 I" m& ~
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)$ P: F! b& O$ a2 K$ \; R

6 t6 I  K6 h$ {+ O</lable><br/>4 h. z' w5 O: Y+ ~9 k
<input type='text' name='item_element'/><br/>- j9 u/ i% n0 w) ]+ c% Z
<lable>Element Upgrade Amount</lable><br/>/ m: q9 o. f7 {2 s- f
<input type='text' name='element_upgrade'/><br/>
7 C! ~" g" r6 w: U8 a: D<lable>Pierced Amount</lable><br/>
& t+ U- ~: k! Y<input type='text' name='item_pierce'/><br/>8 s* a& |0 O7 z" X
<input type='submit'/>  v0 x- x/ X. Y; X/ [
</form>";% y$ w& k3 Y+ `5 Q  H
}8 t6 j5 b8 Z$ L
1 _: L3 o, Q$ [$ o! z
function PostListener (){
) o; k2 [: ^0 P9 u" X//Add more post variables if needed and add them to initform() function aswell
+ a) z& P5 F5 E4 E+ q0 s  Z' W: X6 h
################################
* T0 u, L* h5 I: D##### Connection and Post ######/ a. W6 L; v1 h: q, A7 u. C3 Y' D  j
################################2 i3 H4 H/ x. w9 H
$name = @$_POST['char'];
- E' @/ S0 }7 w, w9 @5 ^$ItemName = @$_POST['item_name'];
* z1 _* U: c* q% J3 B7 s8 M: _7 M) G$ItemAmount = @$_POST['item_amount'];
+ B* k5 `+ \( x( m7 e# R$ItemId = @$_POST['item_id'];1 M' @: Z  }* b6 C' X5 A
$ItemUpgrade = @$_POST['item_upgrade'];  W. S/ O1 q6 e5 Y5 k
$ItemElement = @$_POST['item_element'];
  i) {& k- `" J! s: `) s$ElementUpgrade = @$_POST['element_upgrade'];
. E! h' k9 N5 W/ Z! u7 q4 U0 E6 u$ItemPierce = @$_POST['item_pierce'];0 s! P7 s8 J; w6 }! R) L( Z
################################. i! d& M$ s! X; ^/ _
$ Z6 E/ r$ C5 o( K2 E  j
//Check both variables for empty value
, t% A. M- R6 r& p) V7 Y) s) e* f
$ @+ |, U/ N" n& Fif (!empty($_POST['char'])){- w2 u6 R% S* c& L0 |- y( M  d$ b' c
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
# M$ P8 }5 x1 @) M- j5 o5 U
7 z5 O3 y+ ~" r) ?0 q6 Y5 Y6 ^m_szName = '{$name}'");- k& L6 I& k5 `+ ]
while ($row = mssql_fetch_object($find)){  s4 z9 Z" M  l" K+ F0 ?
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";; I# j) o0 I. p! q, R% j: @( ]! A2 Q) t
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], + B  o- |& m; Q1 o9 P2 r' ?

: W( D+ G6 D- Z/ \3 P. u3 k, o[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
9 J& j$ X) I3 H. |9 H! P7 M
8 O: O" L# g$ F[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
% L# i% }+ k1 E" h+ V+ u
  j: d7 u) d1 M) R2 @N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', 1 r2 w& g: @/ `2 P5 }
3 ?9 z- n. K6 ^, Q9 @7 D
'{$ElementUpgrade}', '{$ItemPierce}');");
5 }/ X6 ?  a! E* [3 k% N$ C8 E, ?}
& F, v& U8 k8 k* ?- y/ _7 Z: b. b7 J# {* o4 R5 ?- \) j4 w" [
}
& c8 A3 j2 c) x) g% M4 ~) F# A" X
+ v+ N: E# p& k- J  a1 ^  N- H}
! ?$ |; [9 P4 b  \9 R
* Z! Q! l( ]/ E6 |$ v3 s$InitForm = InitForm();- I) v+ u6 B) v2 G
$Listener = PostListener();; ?8 y: B7 \2 P% F

0 {1 i1 i# w+ Y- G?>
' _& g- u3 @1 o. y
& M" a. G( U1 P! R6 }7 ^1 A/ n/ H$ }

$ y: s4 ?! K; X0 L1 u- ?6 x- \; O! s6 U! r+ n. j





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