|
|
<?php8 K: S# p. P8 Z& X# p3 N3 ^3 U: i
function Connect () {- ^$ f x B4 K* o& ]
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
. s8 U) G: s+ L2 C2 A
; t+ R; L, w+ a1 I4 ]& CFailed.');. K4 Q6 Q7 j- C( s, N
}/ U8 {( Q# o; d3 i( z0 N
Connect();3 O7 k" [: y, v3 M2 s) ]* @
. l: N/ J U- M2 F' o+ n, Wfunction InitForm(){1 y0 Y: V8 y0 h6 `+ R+ c$ Y
//layout for the form
4 w A9 z Z2 ?echo "<strong>Send Items.</strong>
4 e1 J% A8 n( ?& v5 j<form name='select' method='post'>1 t) ^) X T+ _1 @$ f1 Q
<lable>Character Name</lable><br/>
! t/ G) }1 @8 `1 W<input type='text' name='char'/><br/>
% t0 {0 P) p+ R7 t<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
9 K0 L8 R6 ~; ?2 L% T! g- T3 q9 P<input type='text' name='item_name'/><br/>/ y; X$ U3 E1 X0 u4 g- Y
<lable>Item Amount</lable><br/># a& D; w0 l8 P. F) x& g R
<input type='text' name='item_amount'/><br/>
8 W- x# L& ~8 k" o% b<lable>Item Upgrade Amount</lable><br/>
/ y8 z u* Y! b/ H5 v8 Z<input type='text' name='item_upgrade'/><br/>& \0 \& W) E& D6 o& Y
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.) W' z- ], U& w) h" g1 x
% ]1 K# P7 x y' ~ s3 Q$ I</lable><br/>
3 F% J- p5 k4 [9 N! d3 Z3 x4 n. k9 u<input type='text' name='item_element'/><br/>
/ }) e+ e A3 i8 S9 n& C( g<lable>Element Upgrade Amount</lable><br/>' e- Z* A9 B& Q
<input type='text' name='element_upgrade'/><br/>
! ]+ M" l- \6 a+ t( C* Q" m+ v3 Z0 E<lable>Pierced Amount</lable><br/>+ }, x, U7 L# D# v* j% o+ W
<input type='text' name='item_pierce'/><br/>9 ~, r5 Z: Q- T' G( r
<input type='submit'/>
7 h, k8 Z. o) E8 _</form>";
* g6 O: t; [1 k" I* h- Y% z}
- N/ R! m- V1 @: m! _/ ^$ A$ _: f5 A Y" y# F( |
function PostListener (){( k( F, E+ k- j' i5 w
//Add more post variables if needed and add them to initform() function aswell8 C! o+ M% B8 k
w9 s& N: n. E2 K# d
################################
0 t5 }1 M; h% A8 E' w##### Connection and Post ######+ U; k2 R: h/ N+ d, x5 n' ^
################################) m% L4 A5 y8 a, T3 a- f, ~% R
$name = @$_POST['char'];
. k# @9 j* F' S$ItemName = @$_POST['item_name'];
M; ?7 }* A" `2 u$ G0 H$ItemAmount = @$_POST['item_amount'];
& M1 g( z) t9 B$ItemId = @$_POST['item_id'];. t+ z% y4 G: ?$ W5 K
$ItemUpgrade = @$_POST['item_upgrade'];5 _7 Q1 N& O2 U* B( }) R
$ItemElement = @$_POST['item_element'];% L& V' E4 Y$ N/ W( t
$ElementUpgrade = @$_POST['element_upgrade'];/ M2 w' G! k; R- `
$ItemPierce = @$_POST['item_pierce'];: P# ~$ j* m( f0 u0 S, U& e
################################
) @: F# B8 j7 ?( d% Y
# C2 v) u2 K8 b" U n' p) A//Check both variables for empty value
) g1 J# [/ f; m* f0 H0 Z5 s0 b* t1 H X4 g! B, I1 t" V
if (!empty($_POST['char'])){7 w7 a( f9 t/ y( y
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
6 e l, B+ F3 C
$ @0 y( g5 Y/ H. o, l% p" n2 F" gm_szName = '{$name}'");
7 p0 o& H( e! W$ Y) uwhile ($row = mssql_fetch_object($find)){
" k9 g( g" S2 p4 Iecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
# {1 j; _ ?/ E) E( ?$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 3 x& D1 p$ x8 g
`+ ]6 L1 `3 ?; y- _. D[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], ! M$ v2 S5 p/ M( w9 L
6 L$ J& x8 s/ u2 T& W; c c! Q$ A
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', - i7 Y$ S9 H! d0 Z. W. @
5 k# z: ?! Y1 r9 F/ y- v. Y8 k
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', $ G9 K+ A! g1 I+ @9 D% l, J
, x' U2 Z5 _/ G0 ^; v' Z'{$ElementUpgrade}', '{$ItemPierce}');");! l3 V9 G% _) [4 J2 x- Y' F6 z, `1 H) z
}
: E" E% p- O, @ K& d: [' U) B! w* ]! i
}
* G/ {9 Q0 S7 x* N
B' ^# h; A$ Y/ c}
6 x S3 A! L O4 A
* w8 O) i- [( h# Y$InitForm = InitForm();' G% E# E! V* a$ o0 x6 c
$Listener = PostListener();
$ z/ {: H) }9 L5 R5 i* M( I. `! E8 P
?>1 T7 z n, A! B% P1 p+ |- q
1 o. ^1 p8 B+ a4 }+ R
$ J) N2 z( ~$ s" C+ i6 Q' T7 v2 d5 ~4 u! y1 M, t6 x$ r2 V
' i- {8 U2 r5 u/ l0 v; C
|
|