|
|
<?php
1 e* Z7 W T' N- xfunction Connect () {3 `) B2 u9 v' f8 Z
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
6 P& V2 o3 }3 H# Q8 j
4 t8 G) k' q o* N' S4 xFailed.');
, z7 x1 {- O- s; r2 e3 y1 S}
: U* c8 u+ `2 @: R, G' M6 [/ J6 ]Connect();
% V8 t( _7 N" d u
! y5 R" F; k1 _/ f% [% ?function InitForm(){
1 k! S1 D& v" Z, C5 b& [7 Q//layout for the form: Y) X; l# r" J. `
echo "<strong>Send Items.</strong>
/ D" B, Y( `1 h2 r- O+ K# y& ~<form name='select' method='post'>* b3 E8 c; x3 n: E* J
<lable>Character Name</lable><br/>+ g7 T$ }5 R# @, v
<input type='text' name='char'/><br/>3 R G: ~$ K/ y- j1 P- n3 q ~/ W
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
4 h2 e/ u: S, v2 c% e+ g8 O<input type='text' name='item_name'/><br/># U" J, a( [( y/ I9 S9 w. Q0 s9 r+ W
<lable>Item Amount</lable><br/>
$ d4 R7 Y! a6 i2 @7 A<input type='text' name='item_amount'/><br/>; J" j6 B: M2 t
<lable>Item Upgrade Amount</lable><br/>6 V0 G2 \5 T7 Y% x/ P" i* ^$ }. z
<input type='text' name='item_upgrade'/><br/>" P* t9 H4 g/ S* f2 J
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.). w% X2 {5 h( B
& m0 D5 w7 P+ ^' h9 ~! Z
</lable><br/>0 x( T0 _* _& C8 l3 v
<input type='text' name='item_element'/><br/>
1 l6 b6 V6 G7 \2 S2 L% y<lable>Element Upgrade Amount</lable><br/>
k: [! ~: g0 t) Q& H! f: n<input type='text' name='element_upgrade'/><br/>
]* }6 N9 g' E0 w<lable>Pierced Amount</lable><br/>& a: g6 r; {, g& r
<input type='text' name='item_pierce'/><br/>
$ }3 ?& J o* A3 {" X<input type='submit'/>) C. p5 L( l6 C- j
</form>";! |- I9 A& N# A; s7 B7 ^
}
! e# T/ ~4 B5 J9 _' D
( S9 Z9 Q7 x: xfunction PostListener (){/ r \) \$ Z/ G" }, C& V
//Add more post variables if needed and add them to initform() function aswell
6 }0 |5 f% Y- y/ M4 k3 q6 N1 H6 l4 n3 G' T$ p# Y7 k+ J
################################5 p; h2 p4 P# P
##### Connection and Post ######+ d q3 ]/ n: L% \7 L" m% _( h9 `' `
################################) R7 A+ \- B% C. U4 n0 Y H' o
$name = @$_POST['char'];
& D' U) p# M+ z1 z t$ItemName = @$_POST['item_name'];' L% q1 K3 S0 O$ h# o
$ItemAmount = @$_POST['item_amount'];0 h; P- z6 t$ v3 F" q
$ItemId = @$_POST['item_id'];, C/ w1 |# c8 H
$ItemUpgrade = @$_POST['item_upgrade'];
3 [5 _2 F6 E5 W u1 X2 O2 H( Y; y$ItemElement = @$_POST['item_element'];
0 D1 Z0 K7 R' h7 N' l9 a$ElementUpgrade = @$_POST['element_upgrade'];
8 h) d% f& F! e( {( i$ItemPierce = @$_POST['item_pierce'];0 T; ^. l+ i) g5 n3 C& \
################################4 x$ U4 a {8 n
' Q" t( h& Z1 k3 m: T+ Q* U, ]0 X//Check both variables for empty value4 q7 L G! i% u* R Z
2 V+ m3 ^) q) f/ _( bif (!empty($_POST['char'])){
4 ^" ~- J6 F% A7 o9 A! I5 X2 D$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where ; o- i4 g5 X' `# V4 R5 `
5 p- g) O; X9 x" S- O2 km_szName = '{$name}'");9 I; v/ o% y3 _$ O. q' L r
while ($row = mssql_fetch_object($find)){
% f" b: d0 E K8 y, ^ kecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";" Q [$ Q- y* ^) {- u
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
8 d4 o6 D; y2 ~' m( Q5 R% p8 j4 n) @1 \+ b# g3 @
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], ! [: o7 p6 B p5 s+ H# [* x
/ R% \3 x$ O a+ f! M5 J
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 1 x( y2 {8 D3 ^& J
5 w/ C% ]7 x- ~. PN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', 4 G3 A' m* i9 I1 m3 e
p+ C; ^: z% J/ G3 S# g'{$ElementUpgrade}', '{$ItemPierce}');");
% `: v ]+ t, z |}
0 Y: G" F- N* ?7 V* d0 W9 X$ }& L$ G0 s$ R1 O- k& |6 x
}7 o+ v, O, n5 d; X' c
6 g' m# n, A) v! Q. Z* N}
% _; _4 n# |- n8 g! J. ]4 d- c) k7 p B4 T$ ]) D
$InitForm = InitForm();
/ p. J w [/ _4 X$Listener = PostListener();/ {& ? J( ~( c2 a; A7 _
# ?. v9 s! Q+ y/ y& H
?>/ b$ b S5 n+ N: E: D( U
8 @/ Z! `3 i2 i( x! Z6 [: s+ D& o
$ u5 u- b9 E+ ]: t6 M; k3 N& b9 A# f7 T3 f# a @0 ^+ x
, b$ I- \, w5 d: R
|
|