飞飞世界论坛

标题: 物品发送脚本 [打印本页]

作者: admin    时间: 2016-1-10 03:43
标题: 物品发送脚本
<?php
) c% W7 |: q  }! d1 W( bfunction Connect () {
# g% X& C& B/ U! b4 @mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
/ s" h+ J& H! f, [. K- n3 e: F, [+ t  r! y; r
Failed.');
* f# m$ j! B$ |4 R; Y}
- c/ k7 X1 z+ ~; gConnect();2 n+ A* O3 H( C3 L0 W
, f: M1 X% W- a& D: f: ?
function InitForm(){7 A7 S) N: S6 `: L7 t5 w+ G
//layout for the form8 e, r% D5 O3 D1 j
echo "<strong>Send Items.</strong>
* N/ U0 q! C% @6 k$ {6 g/ K<form name='select' method='post'>
; {8 m# ^! a  {4 e  Z; j<lable>Character Name</lable><br/>
. D6 G- c, V- a# F) J8 w. N<input type='text' name='char'/><br/>
2 M5 g3 ]) D+ L3 V5 i+ z: ^( V1 ~% F<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
9 Q- a4 c: M3 w% X& C<input type='text' name='item_name'/><br/>! b6 J& F" B% G3 F+ o% H
<lable>Item Amount</lable><br/>
; F2 _1 b6 P, k# x/ W2 Y6 a<input type='text' name='item_amount'/><br/>4 W  c- k" D6 O8 g- n/ f( D2 X1 T' X
<lable>Item Upgrade Amount</lable><br/>
5 Z" ^* U$ c0 T, U3 X* c5 \<input type='text' name='item_upgrade'/><br/>% I& `+ Z* i% A" }
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)1 b2 d& H, o8 M6 v& B
" X9 V0 [! f0 ]) x
</lable><br/>4 W7 d+ X9 C2 A- l% f, K1 ~" Q5 o8 ^
<input type='text' name='item_element'/><br/>, s# d7 E3 {1 h, `" }& ~9 Q0 @, L
<lable>Element Upgrade Amount</lable><br/>8 ?6 X3 u" _8 V4 U
<input type='text' name='element_upgrade'/><br/>
$ V% g9 v4 o( Z( P' j; W<lable>Pierced Amount</lable><br/>3 j+ ?" G; i1 Y% n! B
<input type='text' name='item_pierce'/><br/>
0 K6 [! b3 W$ h<input type='submit'/>
6 H$ p* X+ U4 C$ h) G</form>";
- q% x1 I* Y' D}* F3 h# r% B. E  Y, D# v

6 t! s; V7 F* X) ^+ p' ~function PostListener (){
6 ^/ O3 e* v/ {7 `' }3 v8 N8 I//Add more post variables if needed and add them to initform() function aswell$ [* d- ~  ]# f. J
' h& ~( l0 {$ K/ F' l! a
################################/ b" s) a- V2 i3 e' J* S1 b
##### Connection and Post ######
2 a" r/ S! C+ v/ _! Q/ c! m& @* {################################8 j" ?( @1 d, M5 H" C6 j
$name = @$_POST['char'];. ^0 ~" O1 k% {0 A
$ItemName = @$_POST['item_name'];
6 Y; B4 B, V, V) t! u" P$ u$ItemAmount = @$_POST['item_amount'];
; h% a" U+ ^9 [# T$ItemId = @$_POST['item_id'];
+ N6 g' y) h' a( ~$ItemUpgrade = @$_POST['item_upgrade'];# v& u% z4 s% U3 @
$ItemElement = @$_POST['item_element'];, G/ ~' Q* P' W2 @* D
$ElementUpgrade = @$_POST['element_upgrade'];
/ G3 o" X; {; Y5 ?7 }4 i$ItemPierce = @$_POST['item_pierce'];
1 E0 ^- }+ J9 z; v) ~. a' z/ N6 i################################4 N. x* \& D/ V/ b/ r, s3 u; P

! I7 v! }4 T! |: x//Check both variables for empty value7 `7 L+ w5 o& t/ v
5 e! c. f; P# Y
if (!empty($_POST['char'])){! |2 Y6 l1 L( D+ u' @, q5 S
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
; ~* ~1 H; v3 K# K6 D2 Q
. B8 C9 x# X4 W0 q+ U$ p/ E" Km_szName = '{$name}'");: |6 A' k1 `1 {$ S5 u
while ($row = mssql_fetch_object($find)){) o: {( X, W! d5 `, [- E
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";0 k5 Z/ _& H  T: [8 I
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
, a- Q  Y) d) S9 }3 Y( @9 H' [8 c4 }/ \$ l% w7 u% P1 m
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 2 Z# n" }8 P/ f6 W. Q& w4 r
2 }9 S( p* ~$ @1 a& B0 o" m+ k
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 3 u7 K9 D/ v0 ~! ^0 A) j

. w; t& V' f8 W) S5 D7 ]. {; AN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
- m+ X, M/ M* d- b2 y+ A4 G' t: Q8 m
4 S" j: z7 o) C9 l  k4 h'{$ElementUpgrade}', '{$ItemPierce}');");) M. m, N1 @/ R: i
}
$ L) K2 ]' ~1 }; p# D' C; w, _
2 N7 C. D8 z# A( j) y}
% Y  h# y) }5 U! J$ \0 q- K  u* @5 B. w* A( D. r
}8 X* g5 r: n% h- }

7 u, h1 f4 p0 D7 r9 w$InitForm = InitForm();
* f$ E- ?) v9 d# ]' e- I; b* u$Listener = PostListener();) H# b8 m$ P  x9 O. I8 C
0 Y! g  ?8 \; B( I; k
?>* Z: C/ \; D+ ?4 g4 `
' k4 u" J, Y$ p; p

; F( }- W# h0 k- W" M0 C) f# y5 `9 b' X3 p7 K( ~1 V
* x+ p5 t7 Z, M' _  O; j8 R2 E" O





欢迎光临 飞飞世界论坛 (http://www.ffwold.com/) Powered by Discuz! X3.2