飞飞世界论坛
标题:
物品发送脚本
[打印本页]
作者:
admin
时间:
2016-1-10 03:43
标题:
物品发送脚本
<?php
3 a) `, L" g- M" w# A$ S6 C9 X
function Connect () {
1 x8 ]# K' P. W* K7 M: z, @
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
6 V( M- B7 F4 R0 p& e6 B2 X
0 j( {: h. n1 v9 w8 I. J9 y
Failed.');
1 o, B3 G2 @8 e& G1 E% J5 q x% P& m8 o
}
! t+ u, U* v0 |6 G
Connect();
( T3 N& v4 `1 B/ P! _! X
# l- Z* q' O0 g; P6 |* a
function InitForm(){
" b0 X _1 ^+ `( e7 N
//layout for the form
" \1 k3 T8 ^: _8 a7 j8 D) u& z0 M; r
echo "<strong>Send Items.</strong>
9 @( f6 h# m+ E$ ] d/ D$ }
<form name='select' method='post'>
b" Y; x* r4 ^+ k; ^0 v9 @
<lable>Character Name</lable><br/>
# g" d* ]5 w5 v( [5 O
<input type='text' name='char'/><br/>
3 X" c/ t" y7 l# R! D) f, v
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
0 m, M# u! Y E5 }- t
<input type='text' name='item_name'/><br/>
9 {" X+ e2 f& W$ J
<lable>Item Amount</lable><br/>
% y# w1 W1 \2 D. ]) ~
<input type='text' name='item_amount'/><br/>
, Y; V; s7 `; f' k* N" W4 x
<lable>Item Upgrade Amount</lable><br/>
' u- l. x) U1 i/ ]! U$ U
<input type='text' name='item_upgrade'/><br/>
8 q9 x' A. U) ?5 p. w2 r
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
2 M1 `, }0 Y/ Z7 @, Y
1 W! Y) G; Q; |' X% v. A
</lable><br/>
, O$ O2 K4 T1 {6 ]9 x
<input type='text' name='item_element'/><br/>
$ [5 @3 d, w8 @% E
<lable>Element Upgrade Amount</lable><br/>
8 c2 _$ v) S- d' o" Z2 q
<input type='text' name='element_upgrade'/><br/>
0 Y& q6 z8 h1 M5 r
<lable>Pierced Amount</lable><br/>
+ |4 ~ i% m2 n% _& y
<input type='text' name='item_pierce'/><br/>
( P# ], z8 [6 {# w" w" u
<input type='submit'/>
% x$ x0 P0 o) K7 e) w
</form>";
+ Z2 I+ ^, Y+ K3 q8 @ ^, v
}
( y0 m7 o) G1 e
9 n+ r# [( z/ k* f& L% n0 ]
function PostListener (){
' a! R5 ?% `) I0 i
//Add more post variables if needed and add them to initform() function aswell
+ Z% O- f6 h w+ u8 m# R4 ]4 m
+ [; X2 x. z& D( Z9 y
################################
2 g0 ^* ^, }, l' ^1 e5 {
##### Connection and Post ######
& y; J+ |% P Y' a d
################################
$ p9 H' n8 `1 O; F; ]( h6 B" g
$name = @$_POST['char'];
# Z$ I8 \- c: a! F
$ItemName = @$_POST['item_name'];
2 E$ {+ D; h( Q b6 w& `1 K/ a B
$ItemAmount = @$_POST['item_amount'];
: z, X% A" k) t; n1 J5 A
$ItemId = @$_POST['item_id'];
: E5 w4 `0 _" }0 f2 ^1 o
$ItemUpgrade = @$_POST['item_upgrade'];
8 ^- t' V& ^ H! x
$ItemElement = @$_POST['item_element'];
- S1 P% J' Y: F$ C/ ? f
$ElementUpgrade = @$_POST['element_upgrade'];
# r+ A, M! r3 Y) t$ f
$ItemPierce = @$_POST['item_pierce'];
) h+ x& t! o0 |# S* B
################################
* ?7 ]' p, Z& `" e1 E" C* e8 v
/ D& R. i% C; {* |
//Check both variables for empty value
4 ^, ?+ {( s0 ~. H/ r4 j
5 @- h2 R+ r# f* ?5 R
if (!empty($_POST['char'])){
; m! s1 ^7 Z8 N$ R0 b, E; f! X- p5 A
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
. c/ I. H- o! T- {6 C
& I( Y/ X( _. ]: W1 e# \
m_szName = '{$name}'");
- [+ G* _5 Y+ ^! P: G
while ($row = mssql_fetch_object($find)){
' z7 E8 d+ v9 G; g) r8 v- c" ^1 f: h
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
: N1 ?5 j8 H) P, k' \. {' D1 a
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
" c! N1 F# o* v7 A" p# l
4 V( Z! M* _7 ~( y) c
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
' ]/ a( J) X2 S7 M0 e
8 B! H% A$ X; _2 M& g
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
+ e6 n! W( C2 x1 ~0 O2 ?
1 c) |. Z- v$ L4 \
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
) o; g% ^ o$ B2 ]* _9 n
! Z" c* g2 Q7 l0 i) u4 B3 V
'{$ElementUpgrade}', '{$ItemPierce}');");
$ c3 s- `/ E0 s
}
5 S% h9 b' r5 C1 B
8 f7 I$ s7 B f8 ?* O
}
. P* `+ M! H* j/ r+ l2 n( R
$ B: y% p7 X0 n, L0 L# k2 G
}
8 `- v' _: d3 ?0 K
$ b) f6 W) K& N4 ?0 y6 L
$InitForm = InitForm();
6 t; f! `* o# g. p' U! ~
$Listener = PostListener();
) \) c) J5 F5 e% i
. I, V7 I& b* ^. d8 N' x
?>
+ Z* i+ L5 N9 j& r; q, {
. h( ^4 N# f, A
# k, Q* C6 L- t/ U i; M- S
J8 k7 V# M, q( r
+ s+ w. _9 O/ A( Y; E, K
欢迎光临 飞飞世界论坛 (http://www.ffwold.com/)
Powered by Discuz! X3.2