|
|
<?php
9 F+ Z4 c) K5 [- o4 s/ N9 W. Gfunction Connect () {1 T4 X8 g2 A% _4 e
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB 0 \4 \7 H2 n8 T% R
U( {# i5 D; G+ \
Failed.');! F" ?: ^" D* `3 S
}* L1 ?+ L/ F; q! l& _" q
Connect();" m6 N; k+ e* u" N
- |/ \0 ] S7 y6 o% Efunction InitForm(){
# q2 e/ n1 x8 d* V0 v& t//layout for the form: o7 C6 E ^# F* K
echo "<strong>Send Items.</strong>
+ ?2 } x; {: W) Z f& a$ g<form name='select' method='post'>$ v, s& h1 A, M: C/ N. R# K
<lable>Character Name</lable><br/>5 ^9 v3 j3 f( g* H A ^
<input type='text' name='char'/><br/>
0 L2 k5 B! g; ~' E<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>3 x& @9 O) z( }( L( p/ Y3 ^
<input type='text' name='item_name'/><br/>7 J1 }" x) h. A
<lable>Item Amount</lable><br/>2 R0 R& a* y3 g5 |% H
<input type='text' name='item_amount'/><br/>2 D0 Q1 g! G4 E* a1 I# @4 S2 Q
<lable>Item Upgrade Amount</lable><br/>4 y, O: H4 H( b* g& |0 P2 S/ A
<input type='text' name='item_upgrade'/><br/> F6 x: @& B$ R4 M
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
3 J- P* v$ n# _7 N; l: r+ R s& y+ z" Q! K: h8 C
</lable><br/>
! ^5 e, J ~% I) q* ~4 `<input type='text' name='item_element'/><br/>
! H8 S9 Z, p# V<lable>Element Upgrade Amount</lable><br/>
( O$ V. [0 u' r- R: m! Z<input type='text' name='element_upgrade'/><br/>
. T2 a+ I: f7 T4 E0 A5 E+ H<lable>Pierced Amount</lable><br/>* E5 h( [2 L2 T' [ R4 z7 Z5 ~
<input type='text' name='item_pierce'/><br/>
& N* E7 L. B; e; u0 N. a<input type='submit'/>. O5 F/ R( t2 l4 j1 c
</form>";. p f) H/ v% O1 h I7 |+ R
}/ p6 v3 M5 M- P" s
0 c6 E( V3 \0 K+ Cfunction PostListener (){+ ~; I$ w( ]/ y
//Add more post variables if needed and add them to initform() function aswell) q6 _+ C( f( \ ~6 m& }1 z$ j$ \) g
1 A' g8 F0 X1 j8 U8 A' @0 f
################################
" D. ~/ g# B. f8 T% ]2 L##### Connection and Post ######
& M' k0 Y% J2 d: w* }. P& \% j+ }################################
2 k2 f# N* e9 a2 ?# \6 d: q$name = @$_POST['char'];& a0 r9 C/ w" k) s9 k
$ItemName = @$_POST['item_name'];! q* b f/ H' z
$ItemAmount = @$_POST['item_amount'];
) m+ \# e+ O: t7 R$ItemId = @$_POST['item_id'];
3 S3 a9 _* ], P" j6 S$ItemUpgrade = @$_POST['item_upgrade'];
6 Y/ t0 Q4 |% R4 S0 k& m- y$ItemElement = @$_POST['item_element'];
7 v! @# b" |$ n# [% O9 \4 V8 F$ElementUpgrade = @$_POST['element_upgrade'];
7 B" l9 d* n# v% e* n$ItemPierce = @$_POST['item_pierce'];. u' ^% T5 f# @- v$ U
################################
0 Y0 S- C5 t- [- r w, r0 w& G' z5 E6 D) F* e- [) p: v. d
//Check both variables for empty value
$ G; H! X$ Z5 I3 G8 P$ Y( `
( f- f) a- C$ E+ q- @3 Xif (!empty($_POST['char'])){
1 K) |3 L8 J" z3 D$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
2 l; k9 G3 h& c0 I3 d
# S( |0 `9 g) S0 G( v* s6 zm_szName = '{$name}'");# c! w4 d, F* Q, }
while ($row = mssql_fetch_object($find)){
, p0 f- w6 K6 q8 f* l. }1 \; ]echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";; g6 l9 x; C6 `0 t$ {7 `
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], ! u8 _5 S/ A8 _4 `3 S
& @0 g6 d2 E8 Z; W8 P
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
2 a/ R5 }$ O( I- S' m& ~5 X
. i- i) p* g5 R6 e[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
' }" D' l/ o$ s
$ a. n$ p+ ], w( a& @6 o0 v5 A" t; A4 n) dN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
9 }3 m8 G# `( J, ` l4 A, @5 b% _. ?9 c' o; e5 r# @ j+ L
'{$ElementUpgrade}', '{$ItemPierce}');");. [! k" k- h E7 \* Y; K0 t) H
}. n- o! H; s% ` g, a1 D) t
1 t6 J8 X. k3 Y( m, w5 K$ `( Y# c
}
" B" t+ S' A" [/ ]) o0 J& d7 s c
9 U/ k& v2 O- U% ^}
7 y- C" k( I+ }1 J$ q6 o7 I7 L; U4 W6 b- J3 n. r# C" M0 `
$InitForm = InitForm();9 Q9 Y( a( x& N
$Listener = PostListener();
' Q# @/ i6 R7 H0 v2 ]7 J% n
; _0 S' I6 I2 H1 {7 M7 u" w?>6 q8 ~7 z5 p7 J5 B7 u* b" y
, ] R4 G7 G: _2 ?
- M0 B) ~3 j4 g8 r
5 K0 G5 M: p1 L
# r. ]* g8 h, [) D* d- K0 T |
|