飞飞世界论坛

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

作者: admin    时间: 2016-1-10 03:43
标题: 物品发送脚本
<?php
. a; J. z' i6 X; c5 a/ _function Connect () {' i1 ?+ F+ w7 h6 F8 `7 Y
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB 5 w% \2 a0 T, t
# B* U" L2 w" `! D
Failed.');6 ^+ q; ?9 r  V0 T0 J5 ^
}
$ c" K' ?4 w: h' b. R$ wConnect();% i$ d8 c3 Z8 ^: L; ?3 m5 L

  j+ k% m2 q2 H* x, ufunction InitForm(){
7 q) T2 }: d' Y. Q+ F; c//layout for the form
; |" n9 u4 `- Z4 U  S: j7 iecho "<strong>Send Items.</strong>% t" Q* b( V" v4 Q6 X" Q4 L
<form name='select' method='post'>- {2 n4 Q: I5 a6 y
<lable>Character Name</lable><br/>1 H# O* W4 a2 S
<input type='text' name='char'/><br/>* ^2 K- Q; [; }; N, r
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
2 @: _) u8 j3 z) }* Q; }4 Z<input type='text' name='item_name'/><br/>
0 l2 {" Q" d; {& R6 r$ a<lable>Item Amount</lable><br/>
+ e1 G. p7 r8 V; D; @/ s- Q<input type='text' name='item_amount'/><br/>! H! [9 b5 d/ b6 R% J9 d* K; a
<lable>Item Upgrade Amount</lable><br/>
4 U! u+ c$ i) U$ Q1 I<input type='text' name='item_upgrade'/><br/>1 d& z2 N' v% Z
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)0 @7 |+ H; k7 v
; a6 y& J. x# Q2 P
</lable><br/>( T2 `& x: k  Z
<input type='text' name='item_element'/><br/>
+ P: w' A& ~: i1 l<lable>Element Upgrade Amount</lable><br/>0 r6 h$ r% `: E3 ^1 Y. Z
<input type='text' name='element_upgrade'/><br/>
+ e5 l0 s2 {- x4 x: r4 i<lable>Pierced Amount</lable><br/>
8 t  I# E$ o6 J+ o) P/ }, H! {" C<input type='text' name='item_pierce'/><br/>
+ Z5 {9 Q. N/ z) I<input type='submit'/>( M# O+ a2 Y; p3 }
</form>";* y3 S! [6 m/ j% n" Q7 `
}8 u2 f- n/ n# A6 D6 U& C+ p

. A, G9 K4 D; m5 F9 jfunction PostListener (){
  e* s' v3 r" \6 d( X; }//Add more post variables if needed and add them to initform() function aswell
( }) C, s# S$ G/ o. s
5 h! M' ?+ @# u- Q################################7 u1 k# r+ L( k# p2 @% f7 d
##### Connection and Post ######
) s/ j2 U7 ^, B9 \, Z################################! S; y) u4 B- ?, R  h5 Y. G& Q1 T& X
$name = @$_POST['char'];
0 J0 T9 s9 i# ?3 B$ItemName = @$_POST['item_name'];
: `9 L2 C; G6 ~$ItemAmount = @$_POST['item_amount'];( x$ S, z( l2 z. u; t6 N0 O
$ItemId = @$_POST['item_id'];7 f! @! ]7 o+ H" E) y
$ItemUpgrade = @$_POST['item_upgrade'];
8 O6 w  Q  b7 t- J# @$ItemElement = @$_POST['item_element'];: G0 {8 }6 F4 ]+ K$ B
$ElementUpgrade = @$_POST['element_upgrade'];+ i! s1 X) h! [6 \
$ItemPierce = @$_POST['item_pierce'];" U6 t- P2 k/ e
################################
3 Y. ^' k1 @( [% N+ ]8 T7 {) }; s
! ^% o! b8 p6 L- s//Check both variables for empty value
  s- m8 P$ b- K$ X3 ?6 a' }# x6 N. r5 Q! B, n
if (!empty($_POST['char'])){
; j# [3 j: ]$ q+ y. R$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
; @: m+ ~6 h$ o( q' T2 l) [& I2 G- M9 U% S' T* K* f7 K/ g+ Z3 H
m_szName = '{$name}'");9 H! Q1 u  E% t
while ($row = mssql_fetch_object($find)){& P, R0 p: Y/ }  H+ S1 X; u/ L/ W
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
- Q$ I7 A$ _6 P4 F$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
9 m( x; O* Z8 t, Z
( t+ W( I' n0 y4 l- C2 g[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
& p# a( O9 K4 R2 x6 X8 r( J" L: ?1 ^1 |. n
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
5 ]9 |" H0 G7 K/ h
7 Q# ~8 w+ x% E% RN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
& [. A2 L' h2 K; \0 V" o
8 F, P" _/ Q" q/ a  z5 [" y# y'{$ElementUpgrade}', '{$ItemPierce}');");0 D2 Z1 p* V, }- C5 f
}
, T* @6 M% c. c: r) }- x* a
% y4 b% R* Z/ f& r}
4 ~' ~( W0 N" G! H% w$ q! {
* E- l) ^7 E2 c5 `) R; w) T3 M}6 d* ~  I& P  L9 C; b% \' f
: |8 U0 Z3 t* r! k
$InitForm = InitForm();
3 \2 w4 I/ b/ n$Listener = PostListener();: Z; E9 n$ Z+ W( ^6 f
) I/ j& }- w; _! L- f+ Z, K
?>
) I, i& j/ o- ~6 e
" c5 D5 |+ Y8 g' Z. V. `# W" `- g, O0 r2 K
5 p+ J' P' ^9 m% Y9 _7 g& |

0 d2 W3 {$ b4 C( k




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