飞飞世界论坛

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

作者: admin    时间: 2016-1-10 03:43
标题: 物品发送脚本
<?php/ F0 S0 G% d- ]" J
function Connect () {
7 a2 u: S# e- }mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
, p9 }/ R& h2 J+ n! d6 ^( U$ H: \; C& Y+ `9 G. ]; g1 @  b
Failed.');
  k& Q, x7 E! C% r, b& t" @- w}/ f/ ^0 f% {; _, }
Connect();
9 {3 ], M7 S4 F: P- O
: A+ P, f, @8 X5 V6 G6 |function InitForm(){
2 F7 |' Y0 c9 a+ @, E  e//layout for the form
4 o" E1 R5 f) _$ u1 Fecho "<strong>Send Items.</strong>
( Y/ W. x( Y0 E2 I$ g<form name='select' method='post'>
  ?4 _4 ?+ C. P/ \9 T<lable>Character Name</lable><br/>4 j% N/ \! [8 W3 u; }$ n; y. i
<input type='text' name='char'/><br/>% r  ^" ]3 x7 d$ n
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>1 f0 {4 L$ L, q. X+ V
<input type='text' name='item_name'/><br/>' N/ ^. q* `2 O- W
<lable>Item Amount</lable><br/>5 D( F+ x+ M& @/ n
<input type='text' name='item_amount'/><br/>( ~9 b( Y$ H7 c1 d  s
<lable>Item Upgrade Amount</lable><br/>& a( L( v# T8 u
<input type='text' name='item_upgrade'/><br/>
! T/ \, y( J5 C2 o% k- W<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)$ g" g' d! ?+ ?) r* s

5 b% u: \( I/ B. P</lable><br/>) w1 }2 C# M4 T2 J- k/ X
<input type='text' name='item_element'/><br/>
% F1 [1 X' h( T( C7 d0 g+ T8 T) e, ~$ ]) h  Q<lable>Element Upgrade Amount</lable><br/>8 d, L+ y6 [- u8 p2 m" H3 U! a7 A
<input type='text' name='element_upgrade'/><br/>$ E0 G2 n0 a* k7 Y' ]
<lable>Pierced Amount</lable><br/>
  Y# u$ v# M' y<input type='text' name='item_pierce'/><br/>6 a% ^4 b: F3 Q- g6 a
<input type='submit'/>
7 `; i8 M7 B# _; h2 \" ?</form>";+ t+ U$ {0 ^5 B2 i, b2 N' e
}7 m* G' j1 T& F; E2 }( f0 S
1 k; {* B) R$ t4 U0 ^( R$ n6 ?- x  |
function PostListener (){% ?% |/ ?3 W' O$ q
//Add more post variables if needed and add them to initform() function aswell
' w, v6 G  K. t
+ b2 [+ S8 v$ G: q################################! f# {( e0 C. O) i4 k# Y  N: z
##### Connection and Post ######
0 I7 O! P0 _, |, H5 s" W1 V################################
& _& o9 o6 J& G! T3 ?9 Y$name = @$_POST['char'];7 |/ Q+ x+ l0 ~& L& Y
$ItemName = @$_POST['item_name'];
3 l+ z$ V& k4 }; `& W) q3 u$ItemAmount = @$_POST['item_amount'];
( S& U5 b& q, z* U2 P* w; e& l! F$ItemId = @$_POST['item_id'];1 ?4 O) `" r: J* i) M. E! [' j" x6 l; t
$ItemUpgrade = @$_POST['item_upgrade'];" Z/ B2 J+ M: t5 H; O, t6 D9 ^
$ItemElement = @$_POST['item_element'];# X8 D0 i9 |! [4 k' a) n2 C8 ]/ L
$ElementUpgrade = @$_POST['element_upgrade'];
- @8 a" m( O! j$ItemPierce = @$_POST['item_pierce'];) w& L# ]' s) ?: `) z0 y  B
################################' j1 J8 M$ _5 c$ ]6 V

' c: B; n0 |6 h7 \//Check both variables for empty value
' V8 n+ J# A- Z$ ^( E! n% A5 }  F$ y1 D% y, t
if (!empty($_POST['char'])){
; y- X+ t) }1 B7 v+ K$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where . ]- b5 g' {3 E  m- }
. a0 P0 i4 v: {/ l" A. |
m_szName = '{$name}'");! a0 J& P- B( Y  @7 F5 z* S
while ($row = mssql_fetch_object($find)){
. T5 L1 }' p1 j* |0 Qecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";  ~$ \1 g% K5 {
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
  z+ [* Q7 U. Q  W/ U( V7 R8 ~; s, {: ]! s  A) X3 ~& ~  Q7 W" q3 J
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
  Q  i* f* _7 j2 b" I9 ?( {2 ^: s* I! W
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', * Z; H' S; Z5 ^7 U1 I+ ~4 f2 n

% s& C- `+ x2 V$ c% r7 Z# FN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
" W: ^# o% G* b0 y* L8 A8 i8 d
6 b  ]( m6 Q3 X+ o* ^- i# t0 w" I'{$ElementUpgrade}', '{$ItemPierce}');");9 W$ ?( x& A, }" h5 v7 {5 G; N
}( P/ f3 ~9 R* i: n% u
0 L2 ]1 D2 \. S2 T0 s$ R
}
# s( a/ E4 V. O
! U6 ^2 _* \9 O, ^}* y7 s2 M' L$ f# Z
$ a8 J' m$ _; O/ `
$InitForm = InitForm();1 l! s+ [, o; R4 E4 O  n
$Listener = PostListener();
+ Y; r! P% ?5 T4 o3 n/ |6 h% y" E: d) s: v: P" q1 [1 \
?>
8 m! v; t6 U4 n5 }( e0 P7 E2 ~( V& i
: v; b) t5 q$ @4 l  l9 A
  E3 y- [- v% X3 z- R, h; q' K4 q
) J* I1 s) x8 q- E0 J- o7 \4 y# q; ]' M" B





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