|
|
<?php* A; A/ O8 z S, A' h; B
function Connect () {' p& a. c) @3 Q
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB * {& _- L( ?4 _, U) N/ T
/ T! G( Q) W3 N2 q2 w+ vFailed.');
7 ~" \4 V4 A; g# T; S' T}7 _4 I7 O. j8 X: b
Connect();5 e; B8 }: r+ J% c# L
$ r3 l' ]/ C# k4 G8 {function InitForm(){
1 T2 n! k0 r' Q( l//layout for the form
* ?' _1 z; n4 Mecho "<strong>Send Items.</strong>8 Z( \& F$ g5 K
<form name='select' method='post'>
- b9 T: Y c% g% k/ o% H2 h! O<lable>Character Name</lable><br/>1 K# u! s% J2 j8 Y
<input type='text' name='char'/><br/>+ f8 r' ]7 u* `+ b; k( C- k
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
. j# u; F( \# w' v<input type='text' name='item_name'/><br/>
! {' A: t! k9 d. S* {2 ^<lable>Item Amount</lable><br/>
9 L! ~; }- i* f7 I<input type='text' name='item_amount'/><br/> q7 {7 S/ [$ l9 z. c
<lable>Item Upgrade Amount</lable><br/>
% W. S) y* [" J) C& e( M+ l4 N<input type='text' name='item_upgrade'/><br/> f/ U, b, Z9 y; ?
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
1 S$ U2 \" I, X" @; C9 x- _4 H& f4 q \# F2 b% }" E
</lable><br/>
: F( d9 ~. h. t- c& z( \/ p% t<input type='text' name='item_element'/><br/>* q( `2 M6 J# g5 _8 p
<lable>Element Upgrade Amount</lable><br/>
% x' q% I1 O; [3 U, E<input type='text' name='element_upgrade'/><br/>
) Y* l, f; N9 R. a<lable>Pierced Amount</lable><br/>
9 L1 \3 z1 S/ m/ g7 x P<input type='text' name='item_pierce'/><br/>
/ @% m9 R4 _+ g<input type='submit'/>1 s% n3 i0 V* X i
</form>";, t- V. U% N- \
}
" g! @/ B" X' f" n" q
+ c. w9 a1 N; V1 ~6 e- Ufunction PostListener (){
( C$ r4 V2 `8 Q' G//Add more post variables if needed and add them to initform() function aswell
$ \- Y6 K2 `4 J3 P2 E8 H$ k$ ]
$ o4 r: j8 ?: j5 l################################9 c" l: p8 x4 @. r
##### Connection and Post ######2 L2 w3 m6 H* E1 m! y
################################
$ C" z5 ? _) z) w( x: \, R. i$name = @$_POST['char'];
) @) @6 B% R% t4 j$ItemName = @$_POST['item_name'];
) _( n! D( U+ y5 `- Y; m$ItemAmount = @$_POST['item_amount'];! O! K4 l! Q/ C3 W
$ItemId = @$_POST['item_id'];! p+ t- O2 k. b- O3 v
$ItemUpgrade = @$_POST['item_upgrade'];8 H) y3 E0 I; s& A O& N0 ]9 V0 Y
$ItemElement = @$_POST['item_element'];7 u ~: L! k- Q) b1 D
$ElementUpgrade = @$_POST['element_upgrade'];
8 `4 m* w# z( D- h% _. V$ItemPierce = @$_POST['item_pierce'];2 ^; m' E% {9 e, G: D+ f$ D
################################
+ Q3 }# B+ l8 ?2 e3 L0 U$ b+ }0 E9 H" K, Q+ R* r) u
//Check both variables for empty value
! Q. G; m& i3 ?3 E& h) N. S, }3 ~5 [6 J# T
if (!empty($_POST['char'])){
% @( B" M9 q; B& t3 }! x$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where / j9 z$ {# ?2 x
" P8 r" V3 _1 Z. s3 Y# O
m_szName = '{$name}'");
1 b- n7 h( j4 f' B6 dwhile ($row = mssql_fetch_object($find)){
) c4 z& Y3 p3 Cecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
- e7 @! Y- \; g: N+ b+ M$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], \9 j! M# [& _
2 T0 l5 b) @; a8 m5 \' P6 ~" v' m
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
# u/ o1 p+ w R0 ~% }5 E3 J, P/ `; T s; I' X
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 4 n2 U$ T; E+ X7 }4 v# {6 D1 x
& R7 P6 m8 P3 d ~N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
3 {- r4 D7 z [# T1 M* k$ z9 v0 }8 j, o# U' H' I7 X) w% m3 d
'{$ElementUpgrade}', '{$ItemPierce}');");; w8 ?( N. x1 J, n5 F: j( J/ J: [2 ?5 V. A
}% j' c! R$ S5 k; q* M0 t' X/ w
2 _, i( B. A5 ~! i4 u1 l0 V+ ~
}$ P5 {8 M! ^# \- u- T& C" s5 N
! d0 T5 d1 J: ?2 D' _5 ?2 Z4 M/ }, ~& ]
}$ f% h! x$ V, f0 `5 O0 ~
, a! c: Y) q& N X. K5 v4 r. X$InitForm = InitForm();
& F9 d9 ~3 ^% D: | p8 Q$Listener = PostListener();
6 C/ W" Z( p0 _1 `* M' d
$ Y4 H, l/ Q- m# h* [8 v- S?>4 X' X! l; q6 S# O, ^/ @
: I8 q+ d8 o0 y
9 q) D {: {- K4 l" h
) U4 p. A0 j* R+ d6 d7 s4 W: ?6 o0 m b$ u0 B1 w5 M7 X
|
|