飞飞世界论坛
标题:
物品发送脚本
[打印本页]
作者:
admin
时间:
2016-1-10 03:43
标题:
物品发送脚本
<?php
% v- S& i9 E: V4 V( r2 ^& B
function Connect () {
* Y2 r( P: |: D1 o
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
0 B, n3 D1 b/ r0 _& X
( m/ \1 q0 d, n; j
Failed.');
4 [. u' J1 y7 O2 f y
}
) x0 G0 c5 ~) s4 {
Connect();
; g# B$ H/ U J/ [8 a
- D: n! F# Y4 n g
function InitForm(){
. Z) Z- a( b! B n: G
//layout for the form
! l, D, S2 b8 _) j: N
echo "<strong>Send Items.</strong>
! L7 c7 t% z, _# c* }. [- ~
<form name='select' method='post'>
) q& G0 z+ F- l. \5 g8 E& m, |! c
<lable>Character Name</lable><br/>
2 w, ?5 v6 F/ ?4 q
<input type='text' name='char'/><br/>
s" w4 Z' r; W8 T6 I
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
, \( P7 q6 G0 ^% p% l
<input type='text' name='item_name'/><br/>
8 `4 L/ x# y- e4 `: t J* B
<lable>Item Amount</lable><br/>
" b. w) Q V5 {& X+ t; ^
<input type='text' name='item_amount'/><br/>
7 w* @* l. o) W$ k' o7 Y
<lable>Item Upgrade Amount</lable><br/>
7 P* E0 f5 g- y2 k! Y9 ~" p
<input type='text' name='item_upgrade'/><br/>
0 P& g4 G+ t2 g8 A3 v/ `4 g% B) K
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
2 x0 b s T8 N
) x/ V+ U! E5 ~* v/ ^% M
</lable><br/>
8 A9 L! b- p2 E1 U% u5 H
<input type='text' name='item_element'/><br/>
5 P. h6 c5 v8 w) X+ s+ s% o
<lable>Element Upgrade Amount</lable><br/>
8 A) a& P2 k& R0 T7 c8 q- J% i
<input type='text' name='element_upgrade'/><br/>
3 t) D) i6 C" `% W1 g7 }* ^
<lable>Pierced Amount</lable><br/>
* F- E `; ^7 g7 N
<input type='text' name='item_pierce'/><br/>
# `, w3 B }- \0 h
<input type='submit'/>
/ V: { I9 t2 U l0 [
</form>";
6 E! p7 O! M' F# {
}
7 Z4 C7 n- s1 U' r, B1 z( f
1 ]+ V$ C3 F& {1 i9 W
function PostListener (){
8 H8 |( j+ @ W% Y! ]
//Add more post variables if needed and add them to initform() function aswell
+ W4 J" D% p! c; V& _4 O) K0 ~& B
, @/ l. a0 c: H C6 k; F. Q. y
################################
! b' t1 h# J5 i5 _3 j# u; J8 j
##### Connection and Post ######
3 r x4 p9 Z* Y8 ~
################################
% w9 I/ I$ f) `2 x+ v$ V1 i
$name = @$_POST['char'];
9 H% ?+ T" B4 `: D
$ItemName = @$_POST['item_name'];
7 M- x* O; e* g: S, z7 Z0 X
$ItemAmount = @$_POST['item_amount'];
( f% U6 c/ e" i/ B3 k
$ItemId = @$_POST['item_id'];
; V' g) L8 V; A0 |& @. u4 X: |4 J
$ItemUpgrade = @$_POST['item_upgrade'];
1 J" [/ V1 Z. z: D* p# ^7 b
$ItemElement = @$_POST['item_element'];
! ?: }- `* r6 e$ Q% V! z
$ElementUpgrade = @$_POST['element_upgrade'];
) ~0 B5 F* z, r0 T' u2 h
$ItemPierce = @$_POST['item_pierce'];
2 h {. ]# x4 E% f+ z1 e/ N6 v
################################
1 ]# K4 r! s8 K1 ?! B- W
& S7 [: d6 b; I8 _$ V
//Check both variables for empty value
5 Y9 f" D( d# o
3 c2 ~. K9 O6 S( o: X! z
if (!empty($_POST['char'])){
- g% E1 x, R& d/ i+ E: v
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
" q" l+ R9 h& @4 V, V8 d; x) o
, t: n4 S S0 k, [' A
m_szName = '{$name}'");
& g/ f" U, ]: C/ J W
while ($row = mssql_fetch_object($find)){
4 @. k& j0 o3 g% |, R
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
# g* O# s- j9 c
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
9 b4 V( r# P0 o6 `* i4 q
) f$ n! c" F B% o* C' d$ e
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
& a) d `& ~) u& C
" m* }* i [. ]7 T& t
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
# Y; |: K1 [! a7 L. z7 C
4 x `- N! j: e2 ?
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
. d% a5 s6 X6 [0 o& ~
F% [+ K8 n t; S. e. p
'{$ElementUpgrade}', '{$ItemPierce}');");
/ O! [" E! ~% u! {2 L
}
* k7 T+ |7 G6 r2 F0 s" }* K
, z, T4 j4 l/ O
}
0 C4 R0 {8 L8 @! \& e# N7 S
" `# f l& x! V7 d& n* k+ r
}
$ R8 v" {; H7 r" l t+ ]. W
& ?/ z6 B7 v$ y* F& @' `
$InitForm = InitForm();
3 i! T& n6 Y7 V1 ?; V0 B. g) k, o% @
$Listener = PostListener();
) @5 P! @. O9 B7 w# g: u9 m2 m
1 }' o. k" \! N. H x3 o3 f3 _
?>
' p8 ^6 L9 E, f, ?% @9 R9 j' Q" a
; C8 N+ ^8 C0 H- S/ q% ]& o
* n: u6 X/ h ?5 B: ]6 z
o& m) h% _+ r
) r) h7 _" `; ~- E- @% ]
欢迎光临 飞飞世界论坛 (http://www.ffwold.com/)
Powered by Discuz! X3.2