飞飞世界论坛

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

作者: admin    时间: 2016-1-10 03:43
标题: 物品发送脚本
<?php
& G$ ?0 u8 A0 _4 o  ]" Kfunction Connect () {- U, i! A  H# \( @* q0 R! L
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
* u  B( c! A* Q5 \
; W: K. O. b- D1 d" |& oFailed.');3 F# b- C3 X$ I  n( F" V* \
}
# S' C% S" i. n) l7 T& v2 b* Y2 RConnect();
" m3 t$ x& d' G* T1 {+ I& T# X" k% C0 L9 r; X( {: v) H9 _  X- }* \; `3 S
function InitForm(){3 F2 x  m% q0 r1 H" `' g6 r" |$ I
//layout for the form
! R* u% q$ E1 S1 b  ^0 p' T: fecho "<strong>Send Items.</strong># W) M; R2 i' i1 o
<form name='select' method='post'>
% ?7 W7 y: v# U3 ~$ w<lable>Character Name</lable><br/>
8 b4 a. M# G% ]! c: a  t! A8 n<input type='text' name='char'/><br/>
* I. f+ o- b, ]/ c" i: j) T& ?<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
& U" C& e  h1 x% R" X$ a<input type='text' name='item_name'/><br/>
' w$ j2 j: x4 t0 j( U* A% a  v<lable>Item Amount</lable><br/>7 b7 H% `) M& P5 d+ V7 x% v) K
<input type='text' name='item_amount'/><br/>6 x" f/ B" P  H( H7 `6 ?- h5 P
<lable>Item Upgrade Amount</lable><br/>5 U8 m( @- F3 N4 n; \
<input type='text' name='item_upgrade'/><br/>
1 Y# b' s* O$ U& x: ?<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)0 q5 J; S9 @$ O# S/ d

8 v% I; t% @- B) B* e! }" }</lable><br/>
+ O' O6 p& k# `2 M, }  s<input type='text' name='item_element'/><br/>
$ {: i1 g3 ?% ^5 Y* R* u<lable>Element Upgrade Amount</lable><br/>
& @7 s' _1 @1 h) m$ h<input type='text' name='element_upgrade'/><br/>
- n5 T: R6 z  M$ K& f* S1 q<lable>Pierced Amount</lable><br/>% F* o& [# [7 A  y: m
<input type='text' name='item_pierce'/><br/>
$ E7 f. o7 X! |3 B) J) K<input type='submit'/>7 K) D/ k. V$ U
</form>";
! [, z6 u6 ?. k, a' t* {6 U}( V3 ^) f( N7 {( j
/ K3 N' M2 B; F  `- J# [
function PostListener (){2 b$ W" `- ?& L3 d# o2 Z% g
//Add more post variables if needed and add them to initform() function aswell
, I7 u: S1 ~$ C( f1 D% W0 W$ A4 o
8 H6 f& I6 C* q4 z( I% m################################
1 n( \: N/ p7 W1 J/ H. e# F& E##### Connection and Post ######1 X1 s" ~8 s3 c& W" t* `
################################/ {3 L; a' ]' a. }. y7 B+ s( R3 q
$name = @$_POST['char'];$ y( L" s' D3 ^$ y# y
$ItemName = @$_POST['item_name'];
! K5 V& p& z. h) b9 n, C8 j$ItemAmount = @$_POST['item_amount'];
9 @2 U6 g1 w7 p- K$ItemId = @$_POST['item_id'];; X, Y2 ?8 j* K2 ^1 R7 X
$ItemUpgrade = @$_POST['item_upgrade'];" g/ [6 o7 T2 P6 t# a- g
$ItemElement = @$_POST['item_element'];
' ^: D+ w6 l+ t" G+ @9 d$ElementUpgrade = @$_POST['element_upgrade'];
8 h! R) Z4 \/ _: ^; p& z$ItemPierce = @$_POST['item_pierce'];
& c$ r- @" k  X################################, b" [4 W0 u  H' l2 v1 w- @

7 N) ]; [8 M6 m' t0 u3 k+ Q4 G//Check both variables for empty value' W8 p* q: t& @2 l* M8 Z1 I
% |3 L  H8 c; D
if (!empty($_POST['char'])){6 U/ b+ Z% V  l
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where + x* _8 _% e+ U3 F- Z

: e6 |- s; I$ U6 ]! N/ Pm_szName = '{$name}'");! X5 [# R3 y; P: x. D
while ($row = mssql_fetch_object($find)){
4 E' O0 Q- R' e9 s/ ?/ N( }# hecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";% n3 \3 S$ N, Y
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
+ C) _. m) H. P( m) r
9 t/ `% j6 [3 I$ A% p[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
- ~3 C+ Z3 a0 L2 |* \7 K( V
1 L9 z7 K# G6 \; y9 ]& a* p; x2 y' h: O[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
0 t. h) B* ^# x, Y$ S: |! K
. F4 J1 a6 O; }) m+ v. AN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', 8 K3 I, x) r! b7 E1 n0 ]0 X* M

4 l1 z9 ]) }0 H0 T$ o'{$ElementUpgrade}', '{$ItemPierce}');");+ r/ _* b  _% L1 _' [
}
( |7 M' i9 C+ \0 j$ F& o7 ~
7 T; B2 x+ g9 h4 D0 ~3 T% [% n, o}, }% Q. d1 L. K( }5 [) l
# A1 f6 y3 f% [* i* T8 N/ W" Y4 g
}
1 \8 ]0 ^$ g: y  M% k
- z) X& m3 j! e- W: r$InitForm = InitForm();
/ n; Z7 L( ?# |2 D0 I$Listener = PostListener();* V7 n. f$ _; ?9 a% D( D

: `3 q, A0 v$ ~- |& z?>
  I8 n' r) g  E6 r" e5 ]# b! i' j# s
' G! A; X: _3 ^1 y8 K! n( ^4 L9 y/ P4 f" _1 a
. D8 [7 h+ \: A1 P. i9 a4 P) o& @

. P  p, |. w  L( D8 G




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