|
|
<?php6 V! K: P* I9 N0 n( r& W
function Connect () {
8 s: h# \1 o2 G5 `* w+ Imssql_connect('Server','UserName','Password') or die('Error: Connection to DB 3 r6 D4 s5 z% ~- N8 F
9 S+ t6 l( W1 H* O
Failed.');
& `' l$ n7 n d5 y}3 Q8 L; S$ Y H8 v
Connect();
, @: s! Z1 S! J$ e# o; c
$ W* n1 v0 k+ T$ P1 `4 F2 g6 Sfunction InitForm(){1 Y! }3 `, ?1 C/ E( e& s
//layout for the form
5 G1 C+ K9 f: i! [7 {) c1 X/ j+ vecho "<strong>Send Items.</strong>
: Y R9 t& F: b- u* ^<form name='select' method='post'> `# e( W0 g5 r! [, e- Y
<lable>Character Name</lable><br/>
+ U" Q) C, b) p' X6 W<input type='text' name='char'/><br/>
- R7 d; E" {* C4 s8 z" y7 F, r: C<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
4 D7 M* F) c" V* ]6 I6 q+ U<input type='text' name='item_name'/><br/>1 k9 u; _9 \% e# R9 E
<lable>Item Amount</lable><br/>
! g+ J/ r9 U# X2 [. U$ y<input type='text' name='item_amount'/><br/>
+ R) Q0 o9 Q6 R! ?9 W4 z<lable>Item Upgrade Amount</lable><br/>% h" s7 `. Q9 d% }! q
<input type='text' name='item_upgrade'/><br/>) Z' B! e2 k, k. I, O! k
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
, |/ W! a2 ~2 A) V5 c2 X; |$ J9 z
# l! S6 t6 q: \3 j7 ~</lable><br/>4 Z. N: p6 d: \# p/ @7 c7 G
<input type='text' name='item_element'/><br/>
: d: A1 M# E+ M3 k$ A2 i4 W<lable>Element Upgrade Amount</lable><br/>1 K2 B6 R& Z0 B( ~8 p- Y8 @
<input type='text' name='element_upgrade'/><br/>) I" C' P& c& s" ~0 R6 W7 @1 Z3 c
<lable>Pierced Amount</lable><br/>
+ C* T8 K! d: r5 [ M<input type='text' name='item_pierce'/><br/>- K* x+ I( o- d( k+ r9 s
<input type='submit'/>+ I' G. w9 M2 H8 W6 ~
</form>";
2 ^, O# u7 X9 V: H) n. Y}; A2 O( X3 m- L6 R
) M/ @: I7 q3 E4 t+ A6 xfunction PostListener (){
2 ~: \! W) h2 @4 ]//Add more post variables if needed and add them to initform() function aswell
1 A/ i, `8 D3 C; b" A$ @) \; b) b! @4 n/ T( s
################################4 Q' y: P) ?( s8 ^$ I
##### Connection and Post ######% }( g/ T' ?) E; d6 c
################################
4 }: W, ^' f0 W C4 S$ C3 b( e$name = @$_POST['char'];
$ v# [- @. s1 A; E/ R: p+ `+ t) h$ItemName = @$_POST['item_name'];4 _# F9 r/ X0 @9 V8 v/ x
$ItemAmount = @$_POST['item_amount'];* @7 B/ b" C) t( J! L
$ItemId = @$_POST['item_id'];, g% C: a; V3 D; S
$ItemUpgrade = @$_POST['item_upgrade'];0 x/ ?+ J* Z# B5 Q4 l
$ItemElement = @$_POST['item_element'];7 @6 h4 n' _) T% s! S+ d' a7 d( s' X
$ElementUpgrade = @$_POST['element_upgrade'];, l, x, l n3 j s5 A
$ItemPierce = @$_POST['item_pierce'];4 H. C0 N; a! ]8 }7 B+ g
################################* Q! @/ |) W. x) o r, t
+ s' q0 V4 F0 o2 _1 g3 t9 ^
//Check both variables for empty value1 b7 _ w/ ]0 k6 |- e, c
% l' P' n3 B* {5 ~7 @3 s5 l* @
if (!empty($_POST['char'])){, A( I* | V, g8 N3 [
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
% l, X5 |; S; ^3 Z9 U' b, Q) x" F6 ], @! w# F
m_szName = '{$name}'");0 @6 \! }( @" ]
while ($row = mssql_fetch_object($find)){9 U+ H6 }) _5 g
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";+ p; j" o8 j- N4 u6 ?/ c" d: J
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
8 A$ U( F3 d5 R
; ^* D) i$ D' ~0 J& w7 m. M! c[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
+ A# A$ f- X' }! R/ h' w' L+ `" ]/ g# r6 O9 U# g
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
( Q% x8 e0 J1 h" e6 Y Z# U
% q+ D/ H- Q) r. ?) QN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
+ z; q* _9 Z( _ E7 m" q8 b3 J. r. H5 ?& ^' n
'{$ElementUpgrade}', '{$ItemPierce}');");1 c* D0 K, q0 t
}; ^& Q/ J" G5 P, ]# o' d8 M5 C
. R, y# \9 g2 C}! `- t8 D. b6 p! J& I J; B
6 t; |9 H2 a5 p$ r- u& ^0 \# ~
}! Z/ O9 C" c" }: I h
0 S( p5 A: T M) \8 h8 m2 x
$InitForm = InitForm();
. T1 \+ o' B3 ^$ f$Listener = PostListener();% a* ]6 H' B4 ^; w
+ c3 E$ h' x0 K" ~' X: R) t?>
! m+ g! Y4 a) m- R: \
: z9 M& j5 s9 B
/ ~# e" B8 g& z+ _# U
5 H' R* _8 F! M4 [1 N: N& l" H/ |% B4 }! V* {+ R0 F
|
|