飞飞世界论坛

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

作者: admin    时间: 2016-1-10 03:43
标题: 物品发送脚本
<?php
& B2 P2 v5 c' e: u+ P6 |function Connect () {# F: ]" r* \+ N
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB 0 p  i+ d8 A. L- r) ?! E
% Z2 R" W' Q! A  z
Failed.');
3 {: B! T) x0 ?5 c) a9 |$ s) A3 R}1 o- Y# ?! j) s+ h- p% t
Connect();
5 q& ]) Q0 E, R1 r% e% _
0 ~8 P2 Z7 v: `6 x% K/ ofunction InitForm(){
( d  g+ V1 r8 l//layout for the form
6 g5 N2 @* n8 Q8 techo "<strong>Send Items.</strong>5 L* A9 w$ `9 d7 F
<form name='select' method='post'>* b& i/ \' x" X3 L: b
<lable>Character Name</lable><br/>$ B$ i2 d- G' p0 g3 T" f: x
<input type='text' name='char'/><br/>' ~, o2 p$ W( t' N* ^" V. R) @6 ?0 e
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>2 C2 L# J" x! ^3 v! D
<input type='text' name='item_name'/><br/>
$ n: t, H: H/ j. @" r$ r( ?3 N<lable>Item Amount</lable><br/>
+ ]) v# q1 x6 N; K( [; H7 z<input type='text' name='item_amount'/><br/># |5 s9 H* H7 z% V$ h! J/ e
<lable>Item Upgrade Amount</lable><br/>
+ g9 V4 y0 p; b/ @<input type='text' name='item_upgrade'/><br/>6 e: o, j) w* i1 |/ x
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
4 g1 e+ M, I- X! ?4 |) q$ Z4 d4 V" Q0 w
</lable><br/>: U$ K2 C1 N8 F
<input type='text' name='item_element'/><br/>
6 H/ E, ]% }/ r9 j<lable>Element Upgrade Amount</lable><br/>
- d( g- c0 T$ d& R, J' \<input type='text' name='element_upgrade'/><br/>5 Z- Q2 {) _( U5 |' x, D
<lable>Pierced Amount</lable><br/>3 j5 w# A9 U6 I- \
<input type='text' name='item_pierce'/><br/>8 J; ?: C5 ]$ @5 [3 ~
<input type='submit'/>
  M3 r5 B# p# J; r; s</form>";: `+ s' ~, O& E$ @4 B
}
' e/ n& P  Q; c7 z7 I0 n
/ M5 f" T) i% ^$ ?# ?: p7 U! Efunction PostListener (){
3 {0 Q/ W( D/ {# R' B/ c//Add more post variables if needed and add them to initform() function aswell# U9 c7 D2 B4 \8 r) D9 U

- ?  G* |- N# K2 O5 E/ A################################) }! b# d% {$ Z5 A1 ?7 L
##### Connection and Post ######
; i' L' u5 v$ y3 U. I1 }################################) f5 P% `8 @. L: j9 T! e5 h. ^
$name = @$_POST['char'];
' |, j7 |' ~, Y6 D# E7 n$ItemName = @$_POST['item_name'];# N; T+ ^, R' p# s
$ItemAmount = @$_POST['item_amount'];
% U- }) k" T: F, p8 v$ItemId = @$_POST['item_id'];$ `5 D2 c  F& B; e) G
$ItemUpgrade = @$_POST['item_upgrade'];  g  ?( n- P5 I' R
$ItemElement = @$_POST['item_element'];
' x; D- P$ K3 `( ]/ F: Z/ @. J! [8 h1 s$ElementUpgrade = @$_POST['element_upgrade'];
) @3 a3 Y- \8 S. b$ItemPierce = @$_POST['item_pierce'];. D9 }; A0 V% s1 d( j# ]
################################7 d. W* ]: F( f3 I. X
) p/ q, U  R: M  n* W
//Check both variables for empty value
* Z( f/ j& `1 Y$ {1 e5 J
! v+ X" v3 x5 Z; U% Q. vif (!empty($_POST['char'])){9 b8 m. B1 Z, v5 J0 T$ r% A
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where " {2 g, D$ G3 O; y6 N2 k9 l2 I. l8 [7 S& U

, _& g% d$ x4 o* H9 m0 Om_szName = '{$name}'");
: `0 N) K7 E  Rwhile ($row = mssql_fetch_object($find)){5 i! Q. P2 r4 G# R/ P
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";5 R3 Q4 `" a- h/ E
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
; d4 a$ n' t2 K9 G# b9 I
+ e1 Z. @' m4 l8 H" W- o[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 2 b' t& O2 \0 K$ J$ y5 Q9 k

. k) e; ?& j; j. W) I  W[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 7 ~/ d- n& o8 W) R! O5 d0 C! m
9 {' Z6 N& D& f: L/ r
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
% x) Q) u+ a" i
, b1 z0 K1 r$ q  M% C) b, v$ Z$ G'{$ElementUpgrade}', '{$ItemPierce}');");
. v/ y& a+ S6 Q, B+ ^6 Z4 A}( s4 ~0 s6 y6 Y9 ^( Z- g( b6 u
; j  w* a0 |1 c9 g' R% g
}) Q+ x+ j0 w2 d9 K
! J& a% v+ L% O' J5 O& J7 H, P
}6 j/ \, C$ S6 o) R: E) e; E* u
( ]* T4 S) ?5 }2 v! R" m& W% D
$InitForm = InitForm();
8 W! g( C2 m/ u& A$ r& h9 x4 y& M& R* S" `$Listener = PostListener();+ N4 C$ l( B' M+ q. N; o

( I0 w8 R1 J, s! E, B: A?>
9 q. H+ |" u% v1 c9 G* X
) ]! K8 n/ i$ q+ p8 O$ w: c8 C: n2 `
+ q/ `9 t1 z, }" Z) t

- A7 h5 p! Z/ J! u




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