飞飞世界论坛

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

作者: admin    时间: 2016-1-10 03:43
标题: 物品发送脚本
<?php
3 c, h. P+ S" sfunction Connect () {" |+ s8 a2 B$ X+ b2 G' f
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
- n' j- E% }0 E* ?( i* i5 a' Y/ b( n% s) L% V3 y3 S% `6 n
Failed.');* `7 |5 B# t3 m! B+ @5 \$ k
}$ f* W( U; G3 W% a' w
Connect();
2 C3 S% J5 I( O$ Q4 \! q; y$ @* j7 v, L* J
function InitForm(){1 C6 \0 R5 [3 d4 y: G" b1 V4 E
//layout for the form0 X6 E- E& o" U2 @
echo "<strong>Send Items.</strong>4 V4 ~7 N5 t- `6 U! Q: b1 `# E
<form name='select' method='post'>) M3 G7 q8 O5 n3 S
<lable>Character Name</lable><br/>- R! ^4 {7 Q$ J
<input type='text' name='char'/><br/># q) R" s$ s+ L+ j" ~
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>' v" [. ^3 c+ T) f9 S4 V
<input type='text' name='item_name'/><br/>0 K  V8 f  B3 j* ?$ O4 s) s. O' A
<lable>Item Amount</lable><br/>6 o: c; U' D. h; p' j0 S
<input type='text' name='item_amount'/><br/>
! j$ X4 E# s, A) G5 F<lable>Item Upgrade Amount</lable><br/>
5 n. X, u! k" P" n& F6 h8 R4 h( \<input type='text' name='item_upgrade'/><br/>
4 F& o" e8 V1 _! C* k8 f% K4 @<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)  e8 M2 y6 `; v; a8 B8 W

- Z, t, Y$ I$ s9 Z' }</lable><br/>! z4 H( y% q6 A/ I7 C
<input type='text' name='item_element'/><br/>' _* G7 U- p% C$ x) J
<lable>Element Upgrade Amount</lable><br/>
1 X8 d- f: J8 Q. B  p/ {6 f9 _<input type='text' name='element_upgrade'/><br/>
5 O" B8 E+ K. {9 f% X<lable>Pierced Amount</lable><br/>7 y4 n# E$ k( t: U& C& h4 o4 b
<input type='text' name='item_pierce'/><br/>) E5 q$ H4 h3 P. O
<input type='submit'/>
7 s: h2 {4 E4 ]6 C& a! K</form>";  p1 F, i- @% Z. P0 i3 F
}
( O) e/ V0 @9 ~4 V# d$ a0 e- n
1 H' J$ P. ~6 n* }: }8 V  Ufunction PostListener (){3 K" V1 H2 U6 ~# x) a
//Add more post variables if needed and add them to initform() function aswell
- h: s. G( v# j- K' g" o
! u/ |$ p' r! F" [% d; o################################
' i6 l( b4 r; A* r  O; i$ \5 q8 V##### Connection and Post ####### C0 F" E( _) p& h# J( X
################################* f. l- ]; ]4 I( H7 b  d
$name = @$_POST['char'];
$ T. t* A7 \4 o6 g  o/ d( e$ItemName = @$_POST['item_name'];
" {& `; g, u! T$ItemAmount = @$_POST['item_amount'];
: y: L4 ]2 ]1 W$ItemId = @$_POST['item_id'];4 n' D# v0 n4 y( f
$ItemUpgrade = @$_POST['item_upgrade'];) _# g4 I" d* k- E
$ItemElement = @$_POST['item_element'];/ _' F, Y8 `( C5 a. d( q; B
$ElementUpgrade = @$_POST['element_upgrade'];
' R# r; X( {& |5 k/ ~$ c$ItemPierce = @$_POST['item_pierce'];1 S6 ]* O/ u9 P1 N6 J
################################
( p+ l1 `! I. e, a  \5 x* r
% O6 f4 |4 U$ h  L6 J" u% S//Check both variables for empty value3 F# ^* O5 c3 {+ ~0 A
) _" x* N3 O1 S. }- R: j8 b+ |
if (!empty($_POST['char'])){0 G4 a. y7 l) N" n2 L8 `' ^
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
' g* j: Y7 v3 t; i. P: M. j3 D4 Z  E0 {
m_szName = '{$name}'");
% p. v0 h+ H4 p! Q% P( |while ($row = mssql_fetch_object($find)){; S" y8 {- A7 J) A0 ]
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
% D+ z. V$ p4 z, l" p$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 4 R1 L% l9 ], L: W9 I8 }# I/ r
, n& ?, M' h' _4 o
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
: B' K1 z! S( b, i6 w+ P. U7 {7 \" _- E
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
0 C) T6 n+ C$ e6 K( `/ m  a1 _( ~$ D/ ?' M0 E: z$ a8 z2 c- \
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', ' V- m7 w0 `0 f& ~- S

: ^' A0 H* f- m/ t( Q: z5 _'{$ElementUpgrade}', '{$ItemPierce}');");5 U1 |: E" O; n
}( r: w8 E7 }% ^! O
: n6 h  u% b  k" {
}0 ^5 j; ~# f1 i  K. J$ I1 U
) W( i5 C3 D% C! D* K% D5 e; O) b
}
0 j6 X  q- u1 Q: q' |. x5 i! a4 M/ h0 ]+ |4 z5 O
$InitForm = InitForm();
% J+ }# q5 `' e( ~0 s3 ]$Listener = PostListener();$ p# L- K/ b* l% t) i
. k3 [) k2 Q' E  U7 u
?>
$ R' E: d" @3 G4 C6 q& U6 L" W7 }3 {* y! {

* W5 ?7 Q  C. j! V3 }4 O- o' {3 x" C7 {1 p3 J9 Y
/ A/ r* {2 z, l& |





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