|
|
<?php
9 C1 d# q; M0 K, u8 r& a9 dfunction Connect () {5 Y- f+ ]5 r9 N2 q
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB $ \) Q% {. }9 Y9 M3 n
2 U9 d& a, f$ q6 ?" e4 j
Failed.');
( |& A1 N3 S1 o+ r) e8 f- o}
/ S+ q5 Z% S3 P0 e9 b/ r% }+ {( ~Connect();
1 [6 z1 r8 n1 M. O- F& H& C$ M T8 z& F
function InitForm(){
! h; {+ D( r7 I//layout for the form
" L9 q" Y, [( _, _0 [+ t) i5 mecho "<strong>Send Items.</strong> G l2 o0 ?, h$ n, w
<form name='select' method='post'># E. r8 d. B$ Z3 d N
<lable>Character Name</lable><br/>9 q! `' w+ U# n% E! n# ^5 X3 B2 q) ?
<input type='text' name='char'/><br/>
) @& E, v x8 }' e' U* B<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
0 w {! `8 @6 o; B* m+ Q; U<input type='text' name='item_name'/><br/>
! a4 L, o9 h+ `0 `<lable>Item Amount</lable><br/>
: H, ? H- V4 G" L! {<input type='text' name='item_amount'/><br/>
7 P; ~1 l' C0 P( }. o+ p<lable>Item Upgrade Amount</lable><br/>
% [2 c- e! T: @$ G<input type='text' name='item_upgrade'/><br/>% J$ m4 \; V2 J* W( S! }1 }
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
) H2 i! d6 D: a0 R5 r- w
- Q6 F6 m1 H' h</lable><br/>
/ i( a( d( K$ J% H. P2 V% y$ t<input type='text' name='item_element'/><br/>
3 V+ N, Y: ]* I3 \! r& j+ H<lable>Element Upgrade Amount</lable><br/>! f. [( l/ ]- _+ _
<input type='text' name='element_upgrade'/><br/>+ u) J7 C. B, Q a# s
<lable>Pierced Amount</lable><br/>
( V2 ^3 o; v2 x' E* W! B* _<input type='text' name='item_pierce'/><br/>! S6 {6 h2 B8 T; D! c- n" w; `4 o8 O# W
<input type='submit'/>) j- {- W T) \7 V5 P4 }% G
</form>";/ L' B/ {& l2 r; H6 z0 I& }
}1 \8 y0 Y! s; c8 y+ T
5 P* b+ T, h p( T' H: t( Efunction PostListener (){. G0 m [+ [/ z b
//Add more post variables if needed and add them to initform() function aswell
% O: T2 S, z7 |! B5 } W9 c, E; V B' [" a: e/ n
################################; e$ d2 U! C) Q8 U
##### Connection and Post ######1 `: {4 }9 }& H/ p- _4 N) @2 F
################################
2 q6 ]7 q4 R0 o b! `* v2 d0 j$name = @$_POST['char'];- W; a) Q& l; U6 f# ~1 C- }
$ItemName = @$_POST['item_name'];3 |$ ~; i& X) ?! y& F* g7 t
$ItemAmount = @$_POST['item_amount'];
4 R: \& I1 Z; s: X& @$ItemId = @$_POST['item_id'];* j1 h* g0 R+ @% i1 y
$ItemUpgrade = @$_POST['item_upgrade'];
; o4 H( y! j2 t2 f8 X6 j/ M n$ItemElement = @$_POST['item_element'];9 F& u8 f8 u, L- f
$ElementUpgrade = @$_POST['element_upgrade'];7 l5 j9 ~, ^6 N; P
$ItemPierce = @$_POST['item_pierce'];+ j0 n& l/ Q6 V' x" j9 t
################################
) q3 o: M+ S& @" M
2 t# o. H0 A6 V4 U+ e. I//Check both variables for empty value. h0 D4 U7 a1 F0 _9 e" J+ ^
( ^+ s. ?1 N! c3 z: G' Z3 D+ f
if (!empty($_POST['char'])){4 H# K# Y* M; h$ p8 I
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where 4 x/ I* t: E- I
I9 f0 k3 j' m5 m: c* j0 ~: im_szName = '{$name}'");/ {9 m. Y; `# H) z, |; k- U
while ($row = mssql_fetch_object($find)){5 {3 O% I6 t) L
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";8 I. w9 t0 P: ^, u& k8 T
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], * ?& D! K1 {+ c8 W
6 j( W, J3 v- K0 v. ]- K' Y0 F$ |8 Y[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
! z5 R1 \; @! X# E& F9 X2 P
, b B# E; T# O, c% }7 f[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', ! x& Q& z$ o1 q
% B; U' A8 w: j# x( n5 J
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
1 R' b9 t: M( P* F3 O5 R
7 V! x* ?1 Z# n7 @) ^& O" L7 Y# @'{$ElementUpgrade}', '{$ItemPierce}');");
' }- ]1 T1 } F1 H}
- C2 c% X) h9 p5 `4 |
+ V. S' `( y: z6 O4 Y}$ L8 ?% |0 S7 i0 m. a9 f
8 g' m$ t. H- ~$ P6 {7 n2 r/ [}
, H, R) H2 G8 F$ O0 r" f9 e- A3 l+ k- y4 [! V5 `9 W
$InitForm = InitForm();4 l, v' }+ V# @5 p
$Listener = PostListener();9 H3 ]& X! k+ S
5 d$ ?; k: B, f9 U L
?>
) o) f3 W! S4 }# S+ U
2 |) g" x( n# M8 D$ }! R+ R0 h: j" |
. r% C* T! A, f# t! a
3 x0 b p1 V7 M. U2 F' i! _' ?+ a |
|