飞飞世界论坛

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

作者: admin    时间: 2016-1-10 03:43
标题: 物品发送脚本
<?php
. Y- V3 D, Q: V( X7 H6 c4 qfunction Connect () {
% A/ M( a9 D1 kmssql_connect('Server','UserName','Password') or die('Error: Connection to DB
2 |* u% w8 v8 ]! j
% a% `$ |" K$ A% U2 x5 ], l' [- XFailed.');
: ^. p2 Z+ P$ h; ~8 {}- i7 ^$ i: Q$ B3 M4 I
Connect();2 G6 l% X/ m- z6 a, l$ q# p/ a9 _

4 ?, d) w7 [9 F2 X$ jfunction InitForm(){
( h+ ^6 I8 @; z$ x1 x9 w: p, m//layout for the form
3 ~6 Q0 V! I6 B0 T% Eecho "<strong>Send Items.</strong>
0 W- G0 N3 ~9 T! F" h4 g+ b! ]1 M$ Q<form name='select' method='post'>
2 W/ @9 C/ L! |# Y5 J8 o* ~) o<lable>Character Name</lable><br/>
8 s0 e# \' U7 t- ^4 v& j; ^& m<input type='text' name='char'/><br/>4 r+ {$ R# t  g2 r9 s
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>* D3 T% Q' I* \* o! |! J$ n1 }
<input type='text' name='item_name'/><br/>
+ K* d4 `0 }$ [( @7 F( P# ^/ p; G<lable>Item Amount</lable><br/>: B2 G& v9 [0 e# Q
<input type='text' name='item_amount'/><br/>. ]9 ~- x* S9 ]" R" a
<lable>Item Upgrade Amount</lable><br/>
5 L; u# \6 n+ f4 m& ]) F<input type='text' name='item_upgrade'/><br/># v' |8 i* C, {$ X* T, _
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)* ~, p5 {7 u5 z! O4 X3 O5 n! h

" L. C! x8 X: S: N0 S$ I2 D</lable><br/>% x8 l" Z4 l, @  ^( J" P1 `3 h5 v
<input type='text' name='item_element'/><br/>
  Z* t8 t9 V  m% [<lable>Element Upgrade Amount</lable><br/>
% k# j  h7 r/ w) ?, Z& ?; s# N<input type='text' name='element_upgrade'/><br/>$ |: D1 |2 t; Q3 v) `5 l4 L
<lable>Pierced Amount</lable><br/>
) ]# a2 x( ]9 G( {) \) Z- Q<input type='text' name='item_pierce'/><br/>% m( Y8 U. W+ n0 A+ I2 X$ |
<input type='submit'/>+ ?( ^8 U1 f3 @5 s3 g1 s
</form>";& y+ F' L8 a9 x
}
; o/ ?  k$ ?5 M- ~# W9 R# [! ]  }$ r; s
function PostListener (){
3 x& `1 g' k0 f0 |/ W, g//Add more post variables if needed and add them to initform() function aswell
1 e+ Y: V$ H  t4 Z# @) m
0 H" |% X$ D  y" C################################
* X& v$ x6 y) g: s) ~##### Connection and Post ######0 i7 ~" D" @" O  N3 G+ l( z$ j. y. d2 a
################################5 b# U5 I7 c: a" U8 d  @
$name = @$_POST['char'];
: _/ C, t9 d7 B! s1 V( e4 K$ItemName = @$_POST['item_name'];
- d. D, X2 e* P+ N) z' ~9 ^& q$ItemAmount = @$_POST['item_amount'];0 f* D  H# C& m0 z' ^) l% d
$ItemId = @$_POST['item_id'];
. x  _1 e% h* X) ?. \$ItemUpgrade = @$_POST['item_upgrade'];
  K9 ^$ r# t9 K9 I9 r; ]; `1 r$ItemElement = @$_POST['item_element'];& M3 @5 B2 @- v; Q
$ElementUpgrade = @$_POST['element_upgrade'];
  A# @6 @) d% k$ItemPierce = @$_POST['item_pierce'];
$ Z4 F( ]% x- i7 a7 x################################6 `4 n0 U# U3 }1 ^% w1 U* Y3 t

6 ~% _0 _9 W: u# V  a7 y3 h$ F//Check both variables for empty value
9 F; p6 c: o* w: q0 p% M/ J5 R  b9 {4 G5 [& q. x/ S0 M' w  C/ c# h
if (!empty($_POST['char'])){
) D8 c1 G1 K3 ?0 P' H$ n6 F; k6 C$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where % Y5 N( ?3 C. t' ~! q
7 B9 e1 j5 G2 M% c! `
m_szName = '{$name}'");
8 B- E& U; W; zwhile ($row = mssql_fetch_object($find)){% C, ]2 L" ]& h+ R: V8 z8 j
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";) [7 Y/ n4 B7 G$ T  E. A$ k
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
  B; O' }0 q. z% m9 P6 x* J0 s3 v' G; M. k
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
* M/ [$ d! y7 n- v
: ~" B& h) R5 d7 v/ c) t[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 1 c5 |+ E3 q- P2 {2 v3 `% m+ {! b

2 u4 f1 w/ r' b9 h* \+ N# UN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
+ i* x% N& V; H1 o
: ^; S( A+ i: D. N1 A' l'{$ElementUpgrade}', '{$ItemPierce}');");
& |- }7 {: U- i7 k$ Q& [: t. `% D}, W+ {) B. k/ R+ u; y. B2 X- c# F

8 B( a6 i6 F: h3 f5 ]- [}
; U- F$ d! b: m+ s( j/ j+ S, \$ }5 h( j: w/ V
}" h' _5 J  t+ o! n( F7 I; m
/ K, l+ I2 D& x
$InitForm = InitForm();
, E' E4 p  V' H+ _8 s& D$Listener = PostListener();- ^) U0 I  C  c4 X- U5 O( N

4 Y  P: F8 U$ X8 l?>
: D0 \( D( _- ]0 U; y) i) Y* Y/ e& K0 f: N9 s5 ^
! e$ J# y* n3 C' e4 {
/ B, e* w: `+ Z. \: K

5 Q1 t# w2 K+ ~6 w0 O' L8 u




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