飞飞世界论坛

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

作者: admin    时间: 2016-1-10 03:43
标题: 物品发送脚本
<?php& M/ i5 z$ N3 i, g/ S, k
function Connect () {# i" q0 ~1 c9 Z. p' b
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
+ c) ?  P- `/ T) Z$ C
4 P. o: U3 L0 G! `! hFailed.');
8 H7 H0 A4 e  v  F}! o# D7 A! |* R! s1 @/ b
Connect();
; B9 v. h9 Y9 h$ D) c
0 B/ ?1 Q9 }) A3 N- e3 U6 vfunction InitForm(){! y# h0 p$ D4 g8 W; x* O, j
//layout for the form% n7 I0 i7 V5 k6 p/ ~# J' O
echo "<strong>Send Items.</strong>- G) ~1 C- c6 W! J+ X% R: Y
<form name='select' method='post'>
$ ?3 j% c1 E6 j  n6 \<lable>Character Name</lable><br/>, f# Z& e. |, Q) q# h- d0 U
<input type='text' name='char'/><br/>
  N3 w& ^7 i- ]/ I<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
; [5 A- N* V7 E8 W4 l. r) Z<input type='text' name='item_name'/><br/>9 @: T+ i- J6 s+ d4 q
<lable>Item Amount</lable><br/>
4 R: J" B) R+ B+ u( t<input type='text' name='item_amount'/><br/>8 C% N7 D1 W* l. j$ ?$ c
<lable>Item Upgrade Amount</lable><br/># Q' N+ s/ X, S( R! d
<input type='text' name='item_upgrade'/><br/>0 Q3 T# h* F7 \6 E, G' ?
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)7 [) m# K: t* h) g

' R5 \# d! Y% H</lable><br/>/ g0 Q4 B: Q" f% ~% q
<input type='text' name='item_element'/><br/>
) G6 o% K! N  F8 Z" a3 g2 W: e7 X<lable>Element Upgrade Amount</lable><br/>+ f' {: x$ t$ A# Y0 n/ S
<input type='text' name='element_upgrade'/><br/>
0 Z; q5 X7 ?) O# U3 i% @<lable>Pierced Amount</lable><br/>/ V6 e* }+ s3 l1 E: L. m: _! w
<input type='text' name='item_pierce'/><br/>
) n# O. z4 h% [% ]- A<input type='submit'/>: B. D, X' q. w5 t# l9 Q
</form>";4 p6 O" L0 w# U$ P( u3 F7 t( c
}; m& k' F0 }1 H) E
" g, G. m4 R- i; ^' V# P
function PostListener (){
# x. \9 x% ?+ e( ~% L1 F0 k( ^4 h//Add more post variables if needed and add them to initform() function aswell
* X& k; t: J5 _
  s# P* F( s: e0 q/ U, \8 N################################
, B& C: }3 l8 {) W+ A##### Connection and Post ######
7 I* \' ^. A2 P4 A( t9 z: X################################  E6 B% }% K3 f8 M% v4 x
$name = @$_POST['char'];
) W6 i% J8 |7 B1 G) K& l, t: L$ItemName = @$_POST['item_name'];& a* _5 S% ^4 }: P
$ItemAmount = @$_POST['item_amount'];+ D3 m- \( P6 Q
$ItemId = @$_POST['item_id'];! _( P; L- Y5 g
$ItemUpgrade = @$_POST['item_upgrade'];
$ W" a; O: q6 {/ M8 y$ItemElement = @$_POST['item_element'];
( p1 _( n; A9 `3 E- D5 m$ElementUpgrade = @$_POST['element_upgrade'];
. [' Z& `/ A8 m$ X* R* M3 @$ItemPierce = @$_POST['item_pierce'];4 P( D3 L, v$ ^" b
################################
+ d! J4 J" D6 B6 K$ f) x, b1 z
//Check both variables for empty value
8 o2 R* D# d, S) D
0 @" `8 h) Y, {" J+ pif (!empty($_POST['char'])){* ]( p; m0 U( T8 |! \
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where   m" O7 C& t' t
  w# i$ i& {9 v+ C
m_szName = '{$name}'");
( ?) q' F2 h4 q( r- s' x% ^while ($row = mssql_fetch_object($find)){
2 Y* T) e( s! `4 J2 i2 D1 pecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
+ d3 o  l* X1 h$ `$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], + M+ q/ u' ]3 k: A  L0 D
1 Z+ a( |4 o& q* Z+ }& W
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], ( L- D& V( x0 Q& [

# W1 M6 V* i% l[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', ( O& M' z* Y. B9 N
. V* I5 A0 ?; q/ S& D! v
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
  w" M' y+ }1 U
- T$ ^( m. J! |4 E'{$ElementUpgrade}', '{$ItemPierce}');");
; r3 @4 Q5 p. a& |& W# M/ x9 a}. a( p: J3 W# w7 D2 H

3 e- S. x5 w: ^/ V2 y}
. T# w4 `( d  s& b
- s1 O. I. A1 _}$ ~) H5 @$ b9 ]

) T: {4 l. Z. F' g) k$InitForm = InitForm();: a/ h0 [, g6 P! V, r8 ?
$Listener = PostListener();& F8 M4 Y' [. \, ]6 \  I- W

+ J, s+ x& x: ^$ \6 X( M?># [: I. _# U, `) X3 {! _
  ]. A; q( i2 f, ^+ x
7 v7 y4 Q3 }# `
: F" C& q* s- G. a8 T$ f

# ?: F9 _  Z  M




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