飞飞世界论坛
标题:
物品发送脚本
[打印本页]
作者:
admin
时间:
2016-1-10 03:43
标题:
物品发送脚本
<?php
* U9 ~$ r) @: p& `9 c
function Connect () {
- [7 ^! y9 J4 i, p
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
2 R6 s! I9 D- L: [$ t
+ b1 o! U3 Q- z& n% {, p
Failed.');
) }: V2 j3 O( j* _, T( V) B
}
5 b0 A, W; r4 C& L
Connect();
, \. D& N9 D' K8 C
T+ X4 f u: [2 e$ |+ z# r
function InitForm(){
, Y; I! j/ T2 M# ?, a
//layout for the form
, b/ K% B& B: c$ X3 G
echo "<strong>Send Items.</strong>
$ R# t$ a! A1 ^! M7 A
<form name='select' method='post'>
+ L8 W+ d+ [0 t9 h' D' e
<lable>Character Name</lable><br/>
: F0 C( W9 H$ P, h* ^1 k9 t- `& d
<input type='text' name='char'/><br/>
, E: {& H- j/ Z5 X# U
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
1 H6 T& |. h6 c
<input type='text' name='item_name'/><br/>
/ k9 n8 r' D2 O8 Q$ W9 m- }
<lable>Item Amount</lable><br/>
! _$ j. \6 ~" \7 o, ^
<input type='text' name='item_amount'/><br/>
' Y: L4 K) C' r" o5 {, i
<lable>Item Upgrade Amount</lable><br/>
% q9 H' y5 I5 B+ w; N4 \2 x
<input type='text' name='item_upgrade'/><br/>
5 O$ G0 |5 e' |0 V: @ X) s5 U4 m
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
# Z1 g, Q. E! F a
! A0 u: U" |$ `
</lable><br/>
, Q) E ^; |" l* p" o
<input type='text' name='item_element'/><br/>
1 E# ]7 | i+ u9 P6 }4 B# k! h
<lable>Element Upgrade Amount</lable><br/>
% S H/ \& q9 d) {" R ~
<input type='text' name='element_upgrade'/><br/>
4 [+ V0 r6 i+ c: { `$ @- W& O
<lable>Pierced Amount</lable><br/>
+ u) e7 U; a P1 u- O5 s- Q
<input type='text' name='item_pierce'/><br/>
3 r1 \6 N+ |2 V
<input type='submit'/>
' A% Q3 h- h1 j1 w0 ^
</form>";
! B6 [0 [, h7 j9 g" B0 @
}
s$ o4 h0 Q/ M) l' g" }4 \3 @
Q9 ~+ E5 n, C
function PostListener (){
) V1 [) \8 A, ]% I2 @
//Add more post variables if needed and add them to initform() function aswell
& e: n7 Q* h) o) j2 T: t I
1 l! p6 o5 x' r. _
################################
. n1 Z: x1 {8 }. C( @5 j {1 X
##### Connection and Post ######
! v5 D8 O2 }+ Z1 \5 e. y" v: S" Z
################################
+ e9 v4 I' N6 B) T. B
$name = @$_POST['char'];
% _# ?/ T7 \8 P
$ItemName = @$_POST['item_name'];
" @) p& G# f% v$ J' X
$ItemAmount = @$_POST['item_amount'];
; S+ k; L2 n" E+ T
$ItemId = @$_POST['item_id'];
, G0 ?- [8 N+ y" L" }, C
$ItemUpgrade = @$_POST['item_upgrade'];
, L4 t7 E5 A5 H! f- c
$ItemElement = @$_POST['item_element'];
5 ]5 @+ \' J* @3 X
$ElementUpgrade = @$_POST['element_upgrade'];
. X+ n5 `7 l# I( X& U& g0 F, s
$ItemPierce = @$_POST['item_pierce'];
* a; X- Z0 S2 ^! U" W1 f" }+ q
################################
& R3 _# b' F u" R) n; n
. C/ O9 z' t F2 U
//Check both variables for empty value
2 O6 p0 V7 M9 g# \& m& Z1 M! S
. t- t& j9 [8 N) G. A' G! d/ f) @
if (!empty($_POST['char'])){
9 e7 p D p7 S) I: e# u! q
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
: [( w1 M7 J2 q6 t5 Z( \9 [0 j
1 {, x) _7 W' S' B$ U8 N8 Y9 h9 Z
m_szName = '{$name}'");
2 b+ V8 u1 H$ S" K" l
while ($row = mssql_fetch_object($find)){
! a$ s% Q2 x: V2 I% j
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
" r, ~. _/ l3 l' m* X1 ~! [2 }
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
$ Q/ j ]# S- u1 k6 y C
: g/ k6 G: g* E& X+ [8 [
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
5 I7 X8 J U7 P, L( D
% J# V' p" |$ v* l& L# Q
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
8 u2 P# G& y# `$ u% B2 L: K3 z
1 z6 c$ m7 Q$ K4 J: e
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
! U' g/ p( N6 {& _
* x# s: H9 H; }
'{$ElementUpgrade}', '{$ItemPierce}');");
% u; T+ @0 Q1 O4 G ^& c
}
) T" h, P/ q. `4 _
3 v1 C% f3 l" o
}
' ~+ Q8 C4 d8 t
: [. I0 J2 e. f! v; S% r3 h
}
2 M3 K( J8 f t# h: |" V
1 g% R9 M* Z) r# r
$InitForm = InitForm();
, B9 I+ }, N4 t: A M& o, D
$Listener = PostListener();
- x& L- o2 ]% n6 I; A
4 A# F+ r1 g2 ?$ ^ v* G3 ^1 w
?>
! a; p3 w( ?$ x7 Z+ ]
, n h* C! M" L, T c
+ r$ h4 X3 N. b7 U
: k" y2 {6 c/ [: F. {- c
" ]" y& j* r4 M* \2 s
欢迎光临 飞飞世界论坛 (http://www.ffwold.com/)
Powered by Discuz! X3.2