|
|
<?php% r H/ m) o7 ?: C! S' Q+ j
function Connect () {# {! o: c- V c
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB 6 X' x& r6 O. V D
( x! e) @6 X5 {Failed.');& s9 g2 Y, g9 A6 j* A
}
+ c. m2 W# I9 z: s4 y% \/ _2 RConnect();
4 y3 r! {+ H$ |7 ]' P
; s% C3 {6 F9 J k' _$ S6 Pfunction InitForm(){
. Z. h4 o/ N) o& @& r7 y2 F//layout for the form
$ S" l1 J3 L- o6 V2 U0 X0 Necho "<strong>Send Items.</strong>
4 {/ G$ o5 ]8 M<form name='select' method='post'>
0 r0 \- b/ m) c1 g5 W8 ?3 K# ^& f* |1 A<lable>Character Name</lable><br/>
6 s% {1 E1 b w5 {4 u* d<input type='text' name='char'/><br/> W. C" H6 v9 [ T/ Z% ]5 E) i
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>' ^: \) W' S# J+ ?9 s
<input type='text' name='item_name'/><br/>5 B- O# h$ L( q- n5 ^5 U
<lable>Item Amount</lable><br/>
# w+ [$ I. l0 c N. Q4 `2 N, ]<input type='text' name='item_amount'/><br/>: |: I K4 w7 W! t# a. _
<lable>Item Upgrade Amount</lable><br/>
. y. r: I# c/ n0 O<input type='text' name='item_upgrade'/><br/>
+ p8 s6 d4 o/ [ k0 ?2 c<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
$ J! S; A+ K& O1 g& I, f! \
9 c( R9 F% i3 D# w0 P</lable><br/>' K" c! C% l3 n7 H7 H0 n
<input type='text' name='item_element'/><br/>
1 C* }* F9 r& K4 D3 o<lable>Element Upgrade Amount</lable><br/>
& {. J+ m/ u/ \& k7 w' N3 n: S<input type='text' name='element_upgrade'/><br/>% f. M1 A; ^6 u9 l
<lable>Pierced Amount</lable><br/>
0 X \# b& x" X* b+ l$ A<input type='text' name='item_pierce'/><br/>
8 M# F4 C% l; ]<input type='submit'/>
, ^ X3 @, B4 {2 R& w2 i Z$ \</form>";
. o$ H4 t E- l( {}
: t9 ~8 C& I1 A. h* u9 a# E7 r
3 a9 N8 r6 a3 pfunction PostListener (){
# K: y( l# T2 w7 e4 T' M0 T/ k7 m4 L//Add more post variables if needed and add them to initform() function aswell
8 Y% k0 i$ E8 c+ e$ i
" J3 u5 L ]! [7 K' k################################' V- b0 E- b8 G6 m
##### Connection and Post ######
7 {) h# W1 w6 |3 l/ u+ J################################
7 h4 G0 S( \1 G7 V$ S. ?$name = @$_POST['char'];
/ e% \3 X6 \& b2 {7 f$ItemName = @$_POST['item_name'];4 Z6 u- B+ B! [2 T6 E1 m
$ItemAmount = @$_POST['item_amount'];, w! r% n* b$ m& N f
$ItemId = @$_POST['item_id'];
! v# k( L$ z8 y _( {$ItemUpgrade = @$_POST['item_upgrade'];
- U$ g' u$ J3 }) w6 i" [% w' u3 Q$ItemElement = @$_POST['item_element'];
. @; m2 s7 z, k& ?3 E3 H$ElementUpgrade = @$_POST['element_upgrade'];
5 I# ]4 |7 C7 M, x% _) J# P. }$ItemPierce = @$_POST['item_pierce'];
7 l; B9 B. ^; w9 q################################
; F$ b7 Z9 ?2 Z/ `) z' O& p0 ~" i3 ^( a& E; l0 n# A$ x( b8 r
//Check both variables for empty value% ^1 {3 F4 X1 Z a$ a) J5 J2 y3 r6 |0 O
0 t3 G. M. k0 v; I; Uif (!empty($_POST['char'])){$ O) ^% c3 W& ?. g* t( \
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where ' N3 l3 H2 C) l$ _6 J" |& J
( c& G7 y/ n* fm_szName = '{$name}'");
* G8 H1 C; F: o# R& b% gwhile ($row = mssql_fetch_object($find)){% C, O5 w* |$ r3 {" f! S
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
8 C' K/ e# _7 t$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], - z8 m, i( ~0 _# Z n
/ {& ]8 w# o% `. O$ q# l' A3 ?
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], % w( w2 l( Y p, C
( D" n; S" W( S% c, e4 b, G1 \
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', * Q- q4 {. f% N& X0 j# \; p
( I! d0 ]/ M2 L* eN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
- e9 {+ G4 Q5 j! ?* i! @1 ^' F7 g, k% S: m9 x
'{$ElementUpgrade}', '{$ItemPierce}');");5 j$ X2 Q* D# \0 g. F
}
7 o7 l6 `1 \; Y( C3 I% W$ T' P
/ N; E; R# E7 V9 O}
, `! w8 f1 F f2 C7 z0 g- F5 P
0 j j1 l7 P/ T) {' a}6 b% ?6 Q1 c L* ` @
3 a. n" z* t# f3 f8 w
$InitForm = InitForm();' W( G; w2 @+ B5 p9 s2 n0 `1 |1 X
$Listener = PostListener();
c& @3 _* P$ {% y1 Q U+ Q8 R& q/ z% n% y1 e
?>3 y U* L" H$ B% N8 Z
8 d, ?! |- F) [, `4 z4 o+ K
2 {3 E" E" t" L. q
- b8 V! b" a0 ]/ A
3 A) R2 `1 t. ]$ k; E9 d! X8 ^
|
|