飞飞世界论坛
标题:
物品发送脚本
[打印本页]
作者:
admin
时间:
2016-1-10 03:43
标题:
物品发送脚本
<?php
3 |- h$ E9 O" o( t" u
function Connect () {
4 D' a% M. |4 I( ^0 f9 n, d; [! A
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
' g! \ ?8 c& x
* r- P: @" T0 {0 I% U4 k
Failed.');
/ _+ b% I, [: {: n
}
: u9 G7 W4 Z. X" w/ l$ @! k* T
Connect();
& |" N# F, R5 ]5 m( f+ s; U3 e
0 J* G3 C* `* o' C2 Q$ g
function InitForm(){
; K' L+ W0 \- o) D! `& V
//layout for the form
: b* z+ `/ k j) W
echo "<strong>Send Items.</strong>
' P6 Y2 K" v# i1 ^
<form name='select' method='post'>
( S* Y9 I1 p: G2 h: _. c% ?
<lable>Character Name</lable><br/>
8 m: m$ S/ R. M4 |% ?9 l( O5 U
<input type='text' name='char'/><br/>
$ v" ^0 W8 Q. ~+ H4 W
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
5 f2 M# }1 C. |6 `* w/ k# B3 ^
<input type='text' name='item_name'/><br/>
" `* O8 i4 e4 H' e7 B' T' k
<lable>Item Amount</lable><br/>
* q! F* r0 O( M. J6 o F
<input type='text' name='item_amount'/><br/>
, {. m V ~/ [* N. M
<lable>Item Upgrade Amount</lable><br/>
% k# s! m5 O' G7 \
<input type='text' name='item_upgrade'/><br/>
( N' ^7 P" [( a6 g3 s$ P6 V
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
) O, B$ `. t+ s1 E# x2 I5 p
7 S2 X. K. P2 y0 {6 j1 f
</lable><br/>
$ h7 w! i, W! o) N4 |2 }" x
<input type='text' name='item_element'/><br/>
8 p. m3 Q8 J% `$ P1 Z& c/ |/ @
<lable>Element Upgrade Amount</lable><br/>
# W4 R: b3 y3 K p3 n+ x
<input type='text' name='element_upgrade'/><br/>
2 ]1 I6 Y( c" @& \
<lable>Pierced Amount</lable><br/>
2 S9 T0 m! Z; X
<input type='text' name='item_pierce'/><br/>
! J. N$ n# q/ m$ S' s
<input type='submit'/>
% G, D) B" s& ]* B% D
</form>";
& H4 E, |) I; J! \5 X2 h
}
+ k% \3 \. T& s. U+ O; c& Z
3 x" e, z$ o" z' f K' w- y8 v' W
function PostListener (){
3 ~0 s4 g2 {$ p6 h* e/ [+ }
//Add more post variables if needed and add them to initform() function aswell
0 ^+ a' z, T, F, T
. L+ d% O0 B/ G% B0 Y) P( c
################################
1 ^& b0 X* v# }" U0 K$ R& H9 j
##### Connection and Post ######
4 G9 t( J9 d. s6 Z5 Y
################################
/ `( B: @( j8 l( ^0 K/ {- z6 ]
$name = @$_POST['char'];
, ^9 {/ L, U( J) A, H2 \
$ItemName = @$_POST['item_name'];
1 M$ \5 k, `3 l% q6 f3 Q( p. Z1 V
$ItemAmount = @$_POST['item_amount'];
" w K5 j" T! r9 V# `) U
$ItemId = @$_POST['item_id'];
6 i2 z' k7 P( i8 w2 E
$ItemUpgrade = @$_POST['item_upgrade'];
' X0 g* Y- p, `% u4 W
$ItemElement = @$_POST['item_element'];
7 }+ ^3 f3 c) h5 I
$ElementUpgrade = @$_POST['element_upgrade'];
: g0 |3 ^9 z" G/ h' m* R6 j
$ItemPierce = @$_POST['item_pierce'];
* o1 y* l1 x/ H% Y* t. m: w7 _
################################
4 X* [+ \& A2 X# J
( w) ]8 K+ `2 v2 C$ @9 j$ v
//Check both variables for empty value
# d* g) b5 P, _" V; F
6 E6 e8 [7 W' t# o
if (!empty($_POST['char'])){
7 C7 @& _# {5 c
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
0 {; l. k8 C# D) `" l
6 y( ?/ S Q! U" V2 e3 i
m_szName = '{$name}'");
& @" b0 [1 W7 a: c' C: ^7 _+ D4 @
while ($row = mssql_fetch_object($find)){
& j( I6 U' e/ h( r% k5 c( s
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
" d. x& x, j. d; ]4 b+ s# I6 L
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
; q$ `. V2 N5 R1 ?
* H( K+ f& Y s6 W6 Q6 d
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
4 Z- ~8 u7 \: y( G( i7 B6 C& s
" p4 n6 U. o( ~; |$ ]
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
% x& {9 O+ u1 ^2 p: Q4 _( b) t9 j
- M' s* f( j" W2 q6 w
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
( I; v: Z" N) ^0 G2 r# q8 w6 q3 S4 w
% ^+ ]" D, D& c6 u8 A
'{$ElementUpgrade}', '{$ItemPierce}');");
3 O. p: L4 k+ u3 q2 H, H/ c3 o
}
' V N5 w% O. C: m# f8 c
. f/ z8 H' t$ K# d% Z
}
7 d1 a& T+ X% N' r1 q2 w9 I0 F
7 t5 O: |9 L5 }& o4 P& |& h% ~
}
2 [4 G+ s( M7 L( L1 x5 Z
' U' x2 F5 {& K$ C
$InitForm = InitForm();
9 x* m# G# n/ t. a+ m9 R1 u* e7 i
$Listener = PostListener();
! T5 E* Y4 `3 R) ] X
+ V) L$ {7 [/ {& h6 m% `9 f
?>
) V% f4 m$ W; u0 [* j0 c
& y+ a; j" U& [( d$ C
4 x1 |1 R( |* \' P
( t2 |" w7 X$ }( a
/ Z/ s. z- c/ g- l' [5 L8 h: Y
欢迎光临 飞飞世界论坛 (http://www.ffwold.com/)
Powered by Discuz! X3.2