飞飞世界论坛
标题:
物品发送脚本
[打印本页]
作者:
admin
时间:
2016-1-10 03:43
标题:
物品发送脚本
<?php
/ ^. B# }! H4 ]7 f* X
function Connect () {
; Z6 u; c" U9 P7 V
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
" z9 M' |0 L( \
* p/ v" v! p1 H; f7 u/ X% z7 j4 T
Failed.');
1 A# f! ?3 e @
}
# x' E& o: e7 ]: h7 L5 i& ~. y, d
Connect();
+ ?6 G4 E3 C* z/ ?* x4 ~) q. E
3 X2 ]" U* n9 g9 v& s
function InitForm(){
8 d0 p2 f' o; ?
//layout for the form
) ]8 @2 F1 z! B4 ~/ @7 y& b
echo "<strong>Send Items.</strong>
4 Y$ x* W4 i$ E* {4 S
<form name='select' method='post'>
: e6 x! R2 [5 `9 m7 q# J& Q9 M. R
<lable>Character Name</lable><br/>
/ Q, s* i$ [3 ]* ? w% v
<input type='text' name='char'/><br/>
& H$ n% B& s1 c' F X1 H
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
; n( ?. Q2 M# c) x/ D( l
<input type='text' name='item_name'/><br/>
9 W+ B! H+ F ~ q
<lable>Item Amount</lable><br/>
0 F8 d" M/ Q' ]% A
<input type='text' name='item_amount'/><br/>
! K9 Y" _8 K' \3 y. B
<lable>Item Upgrade Amount</lable><br/>
5 k8 l+ h9 _- s# l
<input type='text' name='item_upgrade'/><br/>
+ J* a3 h" B) \9 R& N! m5 Q
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
0 m9 w. d0 r4 R) _
6 F! @& l, e6 y& H2 [+ K. {
</lable><br/>
* k+ w& p0 G& S+ @) P; S U5 u
<input type='text' name='item_element'/><br/>
@3 V" v2 A0 s
<lable>Element Upgrade Amount</lable><br/>
! Q9 E- X% T! r
<input type='text' name='element_upgrade'/><br/>
9 Z; n- v2 n7 w3 I1 V) x! v+ f& {
<lable>Pierced Amount</lable><br/>
4 t# J6 n$ G" V
<input type='text' name='item_pierce'/><br/>
: D( I& P- U6 }/ D" N+ X; q, l
<input type='submit'/>
5 m0 Q# o1 ?3 [) t) H5 |+ g3 d
</form>";
3 C6 P# N6 g: ~$ V4 z4 R6 C
}
' m% [0 a O6 B0 w+ E
) g( F" j: G7 |* H$ C" i4 H! K+ s
function PostListener (){
/ P3 B, j1 Q4 C- N% a! d
//Add more post variables if needed and add them to initform() function aswell
1 p( n) G$ l0 E+ E% p/ [
- s# r0 o4 ?) s! T
################################
% E+ f4 R F% Y# E- g$ c
##### Connection and Post ######
! S; @: b E7 r- ]" w0 _5 P: j
################################
" N- ~ S/ a- o* v/ ^
$name = @$_POST['char'];
/ w# \# f2 C% A1 f2 { @/ Z
$ItemName = @$_POST['item_name'];
* ^- g) o2 s8 l* F7 Z
$ItemAmount = @$_POST['item_amount'];
( H& j$ m) D+ {4 P1 q
$ItemId = @$_POST['item_id'];
1 t, M; k0 J, g# \, A0 _
$ItemUpgrade = @$_POST['item_upgrade'];
- J# B6 l! P7 N$ Y8 s
$ItemElement = @$_POST['item_element'];
0 R$ \! b- X, W9 G a3 ~
$ElementUpgrade = @$_POST['element_upgrade'];
; ]' w$ x# b0 t+ b* u# z
$ItemPierce = @$_POST['item_pierce'];
3 J1 b+ a; y# }" I. }/ r
################################
3 l" c3 b) i9 n- Q O
( O; }) x& E; h- G4 S- }) V
//Check both variables for empty value
D) C8 {8 h2 Y0 w) K( Y
" |! l+ `1 N* d- F q$ |
if (!empty($_POST['char'])){
- D" c( N! B; S
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
3 S3 y! Q s S; [+ r
4 c- r' K" O% j1 j5 ^$ v
m_szName = '{$name}'");
& b. b/ Y( q( w) Z- N9 K
while ($row = mssql_fetch_object($find)){
2 D2 J D E' j% t5 _
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
1 m$ j3 v$ P7 g) n" s- F
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
, a4 T/ i0 z; ^' ^1 G# O
0 b0 n C" x) W% m) F
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
- U' i ~2 @4 R! v. P" n# Y
6 S: S* W: A W( q ~# c5 |0 m3 l+ U
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
5 Z' g0 q3 V( z6 Z9 f
. a$ m" J9 V- q1 C$ P) T5 Z5 _2 j
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
- _( q& V, i. d; ^* l# q* P+ `2 U
, w ]' \/ @! }6 W! U4 @
'{$ElementUpgrade}', '{$ItemPierce}');");
/ v+ s- F! ^0 ?- g8 G0 b: k
}
' T% h$ N6 R( Y( O: T
% v l B% ~3 n0 |( t- D3 r
}
: O7 U9 |( X& d$ o' o& V+ b
8 [+ A4 Y+ s! J* d4 C$ z4 J3 R/ e
}
4 d$ L5 |; N A$ F
' @: o: O, v h2 ~% d g
$InitForm = InitForm();
- A* Q, t% c- n0 }
$Listener = PostListener();
# ]2 f! f u! t" j) L
7 m2 t2 t m! y9 k5 z
?>
) Q* n0 h/ ?0 p- K! `. n
9 k3 \7 z6 [* h5 c
: G! K& H3 t+ ?5 _
/ l1 s- c' G! F) W+ |5 O
* D$ s; z+ ?3 l% d) @
欢迎光临 飞飞世界论坛 (http://www.ffwold.com/)
Powered by Discuz! X3.2