飞飞世界论坛
标题:
物品发送脚本
[打印本页]
作者:
admin
时间:
2016-1-10 03:43
标题:
物品发送脚本
<?php
* ?; t! {$ O3 L1 C
function Connect () {
6 Q4 z. R. E& o3 x
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
4 h' V1 F7 X( M; ^$ ?2 y/ f$ e# u
/ C, ^ w2 M6 \$ v
Failed.');
: Z- K/ A7 ~/ ~$ W+ w
}
- H& d' A. p4 V' j* x! y: a
Connect();
! |1 Y% G5 ?, A& ^' ~+ Q/ u
- r/ Y, ]" Y8 @
function InitForm(){
|" s1 ]) x6 O8 I) x; {
//layout for the form
- T% r! r- j/ L k4 ?" S' A3 ?
echo "<strong>Send Items.</strong>
0 F3 S/ W- M' [% c5 v5 R; d
<form name='select' method='post'>
: h- [2 \; t/ a3 P7 _, O$ v* w
<lable>Character Name</lable><br/>
. M, Y3 N! D9 s1 z+ p
<input type='text' name='char'/><br/>
& e$ S9 g/ R0 ~3 T/ ?$ M
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
$ f3 N, a" H% p1 ?1 `. o
<input type='text' name='item_name'/><br/>
" ]6 t1 b0 A$ S6 [
<lable>Item Amount</lable><br/>
: e; v. I H3 q
<input type='text' name='item_amount'/><br/>
% R& H7 L) M) c+ i3 l1 H/ R
<lable>Item Upgrade Amount</lable><br/>
T# Y! B/ M1 k }# G# U b
<input type='text' name='item_upgrade'/><br/>
6 g; F: w- b6 d _. Q+ y: E
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
) q, _. b; ?8 A. o6 F3 ?
4 [" E W' S4 b4 B) _6 b
</lable><br/>
@5 c7 _1 Z5 p2 G9 L6 A6 h
<input type='text' name='item_element'/><br/>
8 Q# p G |0 a1 X- K, l
<lable>Element Upgrade Amount</lable><br/>
1 w+ `( ?. Y6 N+ f9 u" _5 w% U8 S
<input type='text' name='element_upgrade'/><br/>
; q9 i! ?8 o0 U+ L4 N/ Z* {
<lable>Pierced Amount</lable><br/>
! c9 D9 e0 `2 l# s+ r
<input type='text' name='item_pierce'/><br/>
1 V* u( q5 P$ v9 c' f$ x
<input type='submit'/>
, l% R6 J5 z8 `1 {
</form>";
: `4 x Q3 ]" o* Z3 n& n
}
( |* k$ {. {6 U7 R: @
6 B. C/ l( i9 d! j. U* @. e3 | b
function PostListener (){
. H- N) \" P- e3 `% @) }" ?
//Add more post variables if needed and add them to initform() function aswell
. P7 j B' ] A* Z; a5 d( k2 M
: j2 F' D" V# y# B7 R2 ?' \
################################
* B2 v* S$ T1 B3 g7 G
##### Connection and Post ######
6 a5 b3 p% z2 d" s: a8 D
################################
9 P8 [- B( h3 h% J! X
$name = @$_POST['char'];
I, D; ?6 |" N+ v
$ItemName = @$_POST['item_name'];
! ?, Z3 i" A6 z, h8 m& m
$ItemAmount = @$_POST['item_amount'];
1 c4 r; A* {1 W; g% O
$ItemId = @$_POST['item_id'];
1 T7 R2 K" q5 o' ? u5 p
$ItemUpgrade = @$_POST['item_upgrade'];
$ M+ s/ R- v" t
$ItemElement = @$_POST['item_element'];
, N2 d3 K/ o6 A' \( b
$ElementUpgrade = @$_POST['element_upgrade'];
8 x- \% r) E e0 A) K
$ItemPierce = @$_POST['item_pierce'];
% S$ D5 B) I* ^2 ?0 {1 S: U
################################
6 X- ?+ G9 I' l( F. O8 T3 }5 u$ A
9 O1 ?. n5 C6 ] c' V" N; q! E
//Check both variables for empty value
$ Z+ P$ n6 i$ k- R% |6 C6 i
' h) A% u; y- m; D: c& p+ Y/ X
if (!empty($_POST['char'])){
( }; U) z9 L1 I0 t* u5 k% P
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
; i; \& `3 G% m
- e& a7 O" C# f0 {! ]/ Y0 R4 l
m_szName = '{$name}'");
$ I; w/ W; q/ d9 l. z' r
while ($row = mssql_fetch_object($find)){
% W& P, }' V1 C( @* J
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
) ]( E% o* i5 J
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
; ?# S0 h* `9 C+ z' [
. b2 T9 m2 s) s+ A& L
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
9 i, K$ H. U4 M/ M
' B; ~+ Y9 L7 C* v
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
2 M+ l: I9 c6 o3 }0 l; r
2 K) c G. X- R3 B0 Y: V
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
( A" L$ @5 F8 a+ P' ~
0 c2 f d9 ~- L
'{$ElementUpgrade}', '{$ItemPierce}');");
/ y/ y) A6 t: y: N- o0 o+ q
}
% ^2 l& |1 G: k2 }7 ^6 J
/ N1 l! Q3 b8 b; U4 o% d2 B0 a
}
& ^( c" A6 v$ o& H3 h
& L& V: P A8 {, q
}
! A, Y4 M; e- `% w$ m5 v. O
/ ]* r! q- m3 D- U3 t- Q9 ]
$InitForm = InitForm();
! q; ^2 X H: T/ }
$Listener = PostListener();
: k5 Y, P# @) `- C* T% p
% U1 c5 Y" S$ q+ A: C
?>
# V* x7 ~8 \' L
# P7 U# k0 L- E
; }+ z5 D6 j( C
, u: X& z) v/ g
w/ s# S# Y" L8 g9 f! T
欢迎光临 飞飞世界论坛 (http://www.ffwold.com/)
Powered by Discuz! X3.2