飞飞世界论坛

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

作者: admin    时间: 2016-1-10 03:43
标题: 物品发送脚本
<?php* w+ D" H: V& I2 ?3 [
function Connect () {& m  X2 S* ]$ G
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
9 G. k! D3 A2 u3 X$ y, O7 Y1 B3 t3 V0 p  e2 G$ C
Failed.');; M: A+ m1 a! n9 v6 a
}
9 v& R% n9 x  E! XConnect();
9 E; C9 [8 @4 Z& ^/ I! h' H/ O; M: `8 {; G, Q8 i, g4 v+ N: B
function InitForm(){
1 P$ Z" M5 I' G# o2 o- ^( @//layout for the form8 @% O5 f' m% d% w
echo "<strong>Send Items.</strong>
, W) v" b9 `( E5 k<form name='select' method='post'>& H8 c7 n  z9 q4 X: c: i9 K4 L
<lable>Character Name</lable><br/>
) k+ ?' B6 Y! L7 t4 D! r<input type='text' name='char'/><br/>
! L! d3 R* s$ w" {, {<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>: \5 D1 D6 i9 X' K% X! V
<input type='text' name='item_name'/><br/>
% J: _- }7 K& s<lable>Item Amount</lable><br/>
3 A& s% s3 q: S- Q2 k9 ]) L<input type='text' name='item_amount'/><br/>
- z" N9 [' t7 f<lable>Item Upgrade Amount</lable><br/>
8 M! S$ ]! e0 S' t<input type='text' name='item_upgrade'/><br/>+ q9 b! r- [9 h$ H% p: q
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
. U5 K  I1 D; q/ t+ X& E. s5 M. ^  V/ q# l# h) x2 C
</lable><br/>; V/ O3 C& p% L7 \9 C! N' s6 t
<input type='text' name='item_element'/><br/># n6 {: i& u* I0 p
<lable>Element Upgrade Amount</lable><br/>8 z( P8 ?9 b$ ]
<input type='text' name='element_upgrade'/><br/># F, ~1 G; ~* N
<lable>Pierced Amount</lable><br/>
7 |9 T5 `# d; f- P<input type='text' name='item_pierce'/><br/>% m8 e6 _2 ], y+ t8 A
<input type='submit'/>% N9 P$ n* j' O
</form>";
, |( V6 c' G/ d+ d, ?}: V+ V! L/ H" K0 L! a0 [2 {
! J' U6 k1 v6 @6 o- H
function PostListener (){
  _, N5 }' N/ I2 z+ v  E2 E//Add more post variables if needed and add them to initform() function aswell/ N/ k/ O% U7 T$ y. |0 U7 k

1 g7 ?8 Z. v8 W% X################################+ \# V) J: F( O  d
##### Connection and Post ######
% B/ i3 D5 U0 Z################################2 f, b$ R5 c6 c- {! T1 V7 D4 ^$ b/ I
$name = @$_POST['char'];
, e! U7 f. h( }$ItemName = @$_POST['item_name'];
" g# f% ?+ W2 S+ K4 w$ItemAmount = @$_POST['item_amount'];  G3 I# }! U- s8 I6 C0 @' ~2 I8 }
$ItemId = @$_POST['item_id'];
- E  B: c) h1 T0 p; b4 c$ItemUpgrade = @$_POST['item_upgrade'];
/ v" E/ [# z0 E) D2 l. u! b" b$ItemElement = @$_POST['item_element'];; [7 @3 \. D: a# u4 a& V8 ]
$ElementUpgrade = @$_POST['element_upgrade'];
& J; j' L& ?7 b) ?, w$ItemPierce = @$_POST['item_pierce'];3 M* r  D9 b$ W8 ?; ]
################################% f; R' ~% p  C) O# n
8 Y, `: z' J5 ^% [3 E/ W' e
//Check both variables for empty value
& d) O. S, _( X" x' B. |- p8 @: i8 o" v( A' E
if (!empty($_POST['char'])){
- `+ c, a# F% D" O$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
" r: p$ F# B$ j' s$ }+ B5 F9 E' z( c% l" ]+ H  I5 R
m_szName = '{$name}'");
+ z7 L! J3 q: Owhile ($row = mssql_fetch_object($find)){# }) v. A8 y6 X0 F+ h, G2 ?' z
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
; Q9 j" E" V- J7 r+ }+ i6 \- m$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
+ s5 l' W) o  H  Q' e# Q8 v2 i. \6 G) X
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], , X" E0 O% {4 d7 Y5 w' H4 U
; Q2 c. ?7 A% r. l5 S& n6 {$ L4 f
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
  d' Q, k6 k. Z7 i8 a0 p
0 e: k$ u9 O, f* o1 QN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
- X9 V$ Q# ^2 Y9 @6 g9 U% I3 s/ n4 k5 u4 I; V" ?! Q9 K
'{$ElementUpgrade}', '{$ItemPierce}');");
: X0 Y8 r0 A2 p5 L/ Z}* I. z- A, u! u! K+ ^* `% A
6 H% C1 W) d; A9 y; f6 Y! I
}
4 K) P8 r$ ^" \% b& b2 g; `5 V9 v' B
& i- L# t- M: m* i( m}
) c/ r5 G/ A. D( e
$ f7 z5 m% I/ [8 r! ^$InitForm = InitForm();" ~- m9 x: X# M. u6 l2 a
$Listener = PostListener();
+ f  d  O3 {' w% e+ g+ i0 ]
' g: }' T6 I; V5 K1 w+ |3 a  Q?>
# u) u+ |! M! O8 I
& W0 `1 ?9 x  i  x7 Z% u( \5 R3 @2 l( K. ~

3 z% Y) L, _( y5 N) h; c8 O5 V/ H8 D  e' ]6 _& y/ F* P) i





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