|
|
<?php0 ~" ~. D0 I: Q2 k `1 C
function Connect () {
+ r7 p3 m. W3 @* W9 R+ H8 V% pmssql_connect('Server','UserName','Password') or die('Error: Connection to DB $ @/ a# U, u+ S( |/ A
6 Q7 A/ ^0 d9 \8 gFailed.');# K+ d9 T% s6 M8 @2 G" m9 W
}
: _# q0 E0 f% ]" K* x3 @! AConnect();1 a4 k8 \7 w' U
5 e4 X; w4 W9 q- I5 H3 ~function InitForm(){/ U6 ?" Q! y( ]0 ~/ y2 K4 P H
//layout for the form
; Y. [/ Z1 J& \* `/ |echo "<strong>Send Items.</strong>
b; g$ [2 H' Y<form name='select' method='post'>
- y1 l- f1 o C<lable>Character Name</lable><br/>" @' U2 {- o% I7 [1 r5 }
<input type='text' name='char'/><br/>
) V, O1 y& v; B4 F& P: H1 q9 q# @<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
: Z: p: d" k7 v% s- }. V/ Y% j$ {<input type='text' name='item_name'/><br/>
; t' j* H, ]8 W( D& g' d+ }+ D<lable>Item Amount</lable><br/>
# K1 Y! |" B* U<input type='text' name='item_amount'/><br/>
* B1 J; j6 E: m2 d( _: d<lable>Item Upgrade Amount</lable><br/>+ G8 B/ l5 a! _7 m
<input type='text' name='item_upgrade'/><br/>
5 _5 o! `8 o5 B; Q# a W<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
# Q9 t) }( I, r! _) N# o) [+ p7 R' Y3 s* ]; H
</lable><br/>
5 Y/ [- d$ I# L7 |<input type='text' name='item_element'/><br/>3 J3 B0 z3 u8 P' a$ e2 t5 p
<lable>Element Upgrade Amount</lable><br/>* ^0 W& l* A2 K) g
<input type='text' name='element_upgrade'/><br/>
2 _2 K; R, p( q<lable>Pierced Amount</lable><br/>
. K+ {6 y& r0 n2 S<input type='text' name='item_pierce'/><br/>. f. l" l; m' z( v
<input type='submit'/>' c1 _, _" l% @! K1 S
</form>";
! t: X( f5 ^* b}. l7 }$ ~6 o4 \+ S5 d/ M
( F8 F# i7 T3 ]6 Y+ H& a9 J& P
function PostListener (){
: i/ |( F4 u' }% w0 ~8 z//Add more post variables if needed and add them to initform() function aswell# M$ c% ~, v) |. C
' ~8 q3 d9 Y% y/ K3 M A1 M& y
################################ Z8 [: p& F, }- d1 O, O) ]
##### Connection and Post ######
$ S0 I1 Q/ n* v! E, H5 l################################
# p. W6 a% ^* r: [* D- n$name = @$_POST['char'];
7 k8 B" `: j% o- ^$ItemName = @$_POST['item_name'];
# n# H; F" P$ f# q+ u% I$ItemAmount = @$_POST['item_amount'];
& x7 G& a. ~5 y, |! t( J1 k: W" ?$ItemId = @$_POST['item_id'];4 \1 U" l' Y6 _
$ItemUpgrade = @$_POST['item_upgrade'];
8 [3 M+ S" ?; y4 N% T+ q+ A! u3 @$ItemElement = @$_POST['item_element'];% |' {1 b* X% h& e' n
$ElementUpgrade = @$_POST['element_upgrade'];
; G( b# B; x9 S }9 D2 h5 N$ItemPierce = @$_POST['item_pierce'];
1 m8 F( x& x5 b2 x" l################################( R* N, h0 j: `9 O# Z R
. A% j7 P( h8 A
//Check both variables for empty value
3 M/ I3 U7 y6 p! _$ S9 ~2 P, c3 j0 e
if (!empty($_POST['char'])){2 a( Z$ b2 G7 P
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where - w: O" H. j7 v" p4 `
% H+ [. s( Z8 {2 S1 t& \m_szName = '{$name}'");" j# L, S3 F7 w2 _
while ($row = mssql_fetch_object($find)){+ R8 ^4 F3 E: p, G3 t3 f
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
3 f4 {: l& A8 B/ o8 ]) H; q$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
I2 o4 |' Z; P' w3 U4 r9 F \- i' p# L$ Z5 Y. L4 g' ~' d+ @
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
# }; A7 F1 g9 H: q" t$ \8 g/ }
9 N e, o2 H$ d[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', ; Y& P7 G% Q3 p0 c* j6 Q/ w
& s! g5 z3 q" Q0 w: b. b3 q4 U
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', ! n9 o, a# N# u0 F+ u5 D
) O( E$ h( I& T3 v( W; Q7 O
'{$ElementUpgrade}', '{$ItemPierce}');");" w* S) y9 `/ ^: N4 r9 d. `
}; O& l' L7 O) h5 D- ?; b
& ^1 B( G. i+ F8 c
}
% j" X+ m* o/ b8 S: _" I" D0 ]
: R5 x0 {9 Z- z1 ~9 O9 K! E. R1 z}
9 W: O) U3 B b: C: O
* q# E: M/ Y: e: ^# e$InitForm = InitForm();4 Z o2 N9 S6 q( c& V$ @
$Listener = PostListener();0 ^ H* Z* X; a: D6 _- f
/ V" e5 {5 R/ a% I" e0 o* E?>% W" h( n' c2 k0 l. _ o/ u3 j) O
5 l' v+ a5 I3 T1 T' L3 p
5 g+ y3 Z' C- T5 h3 t
- @3 x& o8 Z4 f% F* w& Y5 }
. F+ Z% {' w2 e' H. N
|
|