飞飞世界论坛

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

作者: admin    时间: 2016-1-10 03:43
标题: 物品发送脚本
<?php
* g3 y/ Y# ]0 `8 q, }function Connect () {
8 `1 s1 n' X$ ?3 _8 ~  K5 _mssql_connect('Server','UserName','Password') or die('Error: Connection to DB , `8 O# l! S$ |* `% N
! N# n2 n, P4 {& N4 @
Failed.');
& \+ a2 e' s9 \2 U$ m3 k}' Q9 P$ v' A+ Z& J7 z- {
Connect();
) V, _% n1 j: Y6 p6 n7 t- l- ^6 o: U0 C" N( x, s6 b
function InitForm(){. _& X: A4 m) V9 c4 r' u' T
//layout for the form
  A. {3 _* |" Q/ b# I: N( Aecho "<strong>Send Items.</strong>; m! z9 r% v* o
<form name='select' method='post'>
( z. R  G7 s5 S( G) e  D" C<lable>Character Name</lable><br/>
$ F$ n- @* `, P7 V. J4 \+ l' O" Z<input type='text' name='char'/><br/>
) E! Q1 M0 }& [. @5 q<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>9 \' I) ]0 l, ?" ~- ~! n# D- M
<input type='text' name='item_name'/><br/># c8 ~, R! v, m! K
<lable>Item Amount</lable><br/>
- x* T, g1 o; L$ L! G" h' a+ E& h<input type='text' name='item_amount'/><br/>5 M# T* _+ |$ j
<lable>Item Upgrade Amount</lable><br/>
- t) @8 n7 g5 L$ V/ S! v<input type='text' name='item_upgrade'/><br/>
5 F8 }/ }# ~8 b: X& o$ x& y<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.), H4 W( i$ a# Q

. W' }/ b( b6 _0 k</lable><br/>
) X; Y3 R+ l, z( F( T# x( V/ h& K6 V<input type='text' name='item_element'/><br/># D' m. `6 N- P) I
<lable>Element Upgrade Amount</lable><br/>& Y' H0 }3 }0 q5 r2 g. y: n
<input type='text' name='element_upgrade'/><br/>
* B1 f/ S9 N6 t: r$ q/ H/ Y+ r<lable>Pierced Amount</lable><br/>
4 Q/ ?2 E' i2 ?  J6 ^* \% @<input type='text' name='item_pierce'/><br/>
1 [( ]' Z4 D5 N) O<input type='submit'/>
! O& c3 S& P( H& i</form>";
! r; f( J2 U, J}
. M* ?3 [! x% Y  q4 }) O7 e" O) S$ ?- x" K& K+ {- J
function PostListener (){) s6 u7 }% h. n7 H/ \
//Add more post variables if needed and add them to initform() function aswell/ k4 Q- \) i9 t/ e9 D! x& f
' s, r# r) }6 P, E1 \/ l
################################* o" x1 g% J- b" b* b6 i6 c9 s1 R
##### Connection and Post ######! ]/ A6 i, `9 |
################################
/ s; K& ?' b) ?$name = @$_POST['char'];7 y8 ~0 J! I- v  O  e' V
$ItemName = @$_POST['item_name'];9 r0 G( m* W+ z. }& i/ a
$ItemAmount = @$_POST['item_amount'];( y' w. D* y3 l1 x
$ItemId = @$_POST['item_id'];
. w/ F+ {" @8 H5 L  A- O. y$ItemUpgrade = @$_POST['item_upgrade'];0 `6 b6 Y9 A+ w) R* i
$ItemElement = @$_POST['item_element'];: O! Z. e* s3 c& n2 A
$ElementUpgrade = @$_POST['element_upgrade'];
" c7 l( ^. y8 t- ^$ItemPierce = @$_POST['item_pierce'];, F3 M% X, P, j! ^+ k
################################
" c& c) `* O( \; C# z2 m2 t7 S# H6 \' \9 A. `; O
//Check both variables for empty value" @- ]! l9 |' U
' M2 x9 a. f: @7 i8 A
if (!empty($_POST['char'])){9 b7 G! k. P  o9 v
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
5 s" T1 [$ a1 M
- @% c0 f! m8 c8 c7 km_szName = '{$name}'");7 J, j* {4 @7 D3 b+ L% T
while ($row = mssql_fetch_object($find)){
$ \. H3 g, j2 ~$ Secho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
+ V6 J0 h& @" r8 @- p$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
- c$ n9 e" N+ [0 A  e( t/ @* F; K% F' J) n- l( ]3 X) h# l5 N
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
- x0 A) f5 w0 h6 |( c! U  R/ ~7 ^
, k% V/ U+ Z0 w3 [( C  V[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
. g4 `/ A8 ~1 H9 S* f/ J0 U7 K; [0 A0 T
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', % V( ^- \7 ?7 g, f& k# n9 z9 g

9 A9 }- U6 G8 P! T- S# L'{$ElementUpgrade}', '{$ItemPierce}');");
/ i7 }3 N- x/ \}) Y- l1 O3 i) |" {. Q( l

' G3 Z( V' C# x6 G}
3 U3 a& B3 f. t. s* w! @2 @3 t2 p0 O" |
}* P. L/ E0 `) o4 d

8 j& E5 b2 c. ~0 D$InitForm = InitForm();
" ?$ [% T! ?% Y3 U5 C$Listener = PostListener();
7 N: ]. R7 `) X7 b: z8 u1 i
/ q( P0 J  z' [- ~9 @?>' \' p+ [: c+ |& ~1 k  O& p; R7 y
6 t4 Y/ o- s$ \4 i$ @

/ m: X" i: G8 W- D* \1 M( L
% |) ^  `& B& }8 G' V% d% M* J' _+ N8 g$ p. a





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