飞飞世界论坛
标题:
物品发送脚本
[打印本页]
作者:
admin
时间:
2016-1-10 03:43
标题:
物品发送脚本
<?php
4 c# @$ d4 W4 ^7 R
function Connect () {
& |% B6 W. S. _& u; k( P9 |
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
i$ q% D" H+ ^8 H8 Q$ a6 i
1 Z5 d& Q: u' }( H
Failed.');
) R! ?. D' x$ v% s# ]" @
}
6 P6 A% u6 o$ S; R5 B
Connect();
- f+ C4 L9 i/ Y% L d
Z" q7 @9 G" q4 ?+ H! q+ o( a
function InitForm(){
4 H3 p) k8 P$ P
//layout for the form
( `: V# k9 L) Y {# r
echo "<strong>Send Items.</strong>
; w* L, K3 ?. q( U, p0 F
<form name='select' method='post'>
) f7 o2 v. N; b
<lable>Character Name</lable><br/>
. e; R3 d3 D/ k. `/ }- Q% m
<input type='text' name='char'/><br/>
0 z- a# t" ?3 v- m. [
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
0 F+ d( f7 f- ~ H9 U
<input type='text' name='item_name'/><br/>
% O/ A. y, U7 k4 F
<lable>Item Amount</lable><br/>
1 ]9 I* {4 y- u5 G
<input type='text' name='item_amount'/><br/>
) v9 x! Q8 V2 |, G
<lable>Item Upgrade Amount</lable><br/>
: f$ }! S$ s/ s
<input type='text' name='item_upgrade'/><br/>
. D @1 P$ ~; E
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
7 C& W# W, x l: Q! b8 P1 m
# n& [# K J `0 T4 b2 q, l: e; X
</lable><br/>
+ n! v- E" b: I" Q, L0 r0 V
<input type='text' name='item_element'/><br/>
. U' \2 [/ i7 J* A( I) W9 {9 z. r
<lable>Element Upgrade Amount</lable><br/>
) H+ g6 x* [5 M$ @- S
<input type='text' name='element_upgrade'/><br/>
) x% J- X' i& ?+ N# V2 f8 v
<lable>Pierced Amount</lable><br/>
4 H6 m% _' l# f# f0 j6 H8 W0 G* [
<input type='text' name='item_pierce'/><br/>
7 `' f- o, {6 Q0 `) d$ S, C& k5 T
<input type='submit'/>
5 H1 ], E- a2 p+ b2 K
</form>";
4 c& _5 g. @3 s3 f; E6 ?
}
, M7 c4 q# @9 r3 X
0 H F# }4 M- y1 c; a6 @2 Z5 S
function PostListener (){
( H7 J' R8 g. g2 P/ s8 A+ f
//Add more post variables if needed and add them to initform() function aswell
5 f( d3 H, S* k( O& @: Y& o
Y1 L8 x. Q. i0 h2 J' a3 ~
################################
) X+ \" p3 Y* _ H. j( K$ G
##### Connection and Post ######
8 A0 X$ M) ^1 N9 d
################################
2 Z- M6 ?; }6 ^) T" J9 i
$name = @$_POST['char'];
* G( w( [" m5 H* ?; U; ^7 W
$ItemName = @$_POST['item_name'];
. H% B. q( ]" F: U! R% k# i- }
$ItemAmount = @$_POST['item_amount'];
. _5 N4 z" M" i# Q" b; W9 a2 U5 R- k( F
$ItemId = @$_POST['item_id'];
& i4 |8 i7 Z2 k& m. ~& v
$ItemUpgrade = @$_POST['item_upgrade'];
' E. w3 c# X Q y( Y% v% P4 S
$ItemElement = @$_POST['item_element'];
: d! l) u9 Q! m F8 }, E/ n
$ElementUpgrade = @$_POST['element_upgrade'];
L2 J p2 Q9 k2 N7 z
$ItemPierce = @$_POST['item_pierce'];
+ s" g! O% Z b, G- ^
################################
n6 g7 U1 h7 }% _
( D+ u3 w% l5 {" b
//Check both variables for empty value
* i8 Z- N4 j* ?$ C$ ^3 Z( b
7 _% D9 Y# o2 |2 R0 e, r
if (!empty($_POST['char'])){
% w, d% i' H; m* x
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
2 G3 T8 M$ S. X( U# h
- d6 x2 x! _1 A, b# v
m_szName = '{$name}'");
B& b' `9 N% `9 S, P; Q2 L
while ($row = mssql_fetch_object($find)){
8 c* v5 z6 |8 @$ e, c
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
- d/ |6 f, n0 \3 E: }4 ?, P
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
* q+ ]0 {3 M+ d6 p
+ U" w% W# q7 O* B6 O2 w
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
J g7 `9 L$ c6 u
: O: N9 W8 _7 b; h/ k
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
* }" r4 v% A7 }: k" ]# C7 C
/ S$ c8 F) ^% A3 L
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
9 L- T% Y( k. s% _4 P: N
- d/ _+ d' k3 x/ i8 X- c/ d
'{$ElementUpgrade}', '{$ItemPierce}');");
; v8 J/ Z* X$ W& ^" e
}
! z- `1 L; ]9 |4 V7 I- d
- @9 y+ [7 E2 l% E5 f" |: o" F
}
$ e# ?& d/ ?1 d1 p, g+ Z
/ }& z& N$ C6 i' @. q$ |
}
. `8 p& k1 U3 P1 E" A4 D4 Z" j
N8 [# c9 @4 b7 n& J- B) W) N8 B
$InitForm = InitForm();
) _( N8 w- ^) G5 k0 n
$Listener = PostListener();
& M3 M$ M7 _: B8 H0 \2 K" S5 F
8 }9 ^4 s ^7 s+ g
?>
8 P0 i; S5 I% E: G4 v
+ d! @3 H4 S# L$ k, [8 ]
2 y0 n+ y: l- {2 R; L
/ o9 g T' G' E! i& w3 J ]
' n* k3 Z2 m+ {( B
欢迎光临 飞飞世界论坛 (http://www.ffwold.com/)
Powered by Discuz! X3.2