|
|
<?php
# i- ~" k C+ M/ y' |9 N& ^function Connect () {# v, X j) D) Z: }
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
2 F! S9 B, [5 H/ f3 B- E, ?+ A `2 g6 l* C- |
Failed.');5 h. e, U8 R- q5 S
}
7 f- e6 G: V: eConnect();; ?/ S' w1 [5 S n( w
( X; \7 k/ S$ Ffunction InitForm(){" k* ^2 i( c) ^7 d( p: C
//layout for the form$ e* ^0 d/ z# I k; q2 O+ G9 Z
echo "<strong>Send Items.</strong>
! T$ K) ?* D n7 T" z' `0 s<form name='select' method='post'>
3 F& b5 g* E N: j' F) k I<lable>Character Name</lable><br/>% ^1 g+ W% p3 O$ t0 U2 F" H
<input type='text' name='char'/><br/>9 t. M+ \' O$ s$ d* V+ O1 m
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>8 Y9 L9 o7 m: \* p, _$ c/ N ]
<input type='text' name='item_name'/><br/> r% z/ A: X) {7 l& w: c! q
<lable>Item Amount</lable><br/>! g! B: c9 C/ h9 d L8 g! H
<input type='text' name='item_amount'/><br/>2 y3 W* w0 \4 M' b9 o
<lable>Item Upgrade Amount</lable><br/> ]6 k3 \8 o4 b, \1 F3 D
<input type='text' name='item_upgrade'/><br/>
& ]# i5 E* J( J X- n& L<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)8 h& r7 b) b* n) y
7 |% o( Y! D9 S+ g4 B8 t; g/ a
</lable><br/>
" x1 t5 N) \/ z<input type='text' name='item_element'/><br/>
! V/ E0 ~8 R! ?2 s8 l<lable>Element Upgrade Amount</lable><br/>* P; i7 w( V7 ?, N0 b
<input type='text' name='element_upgrade'/><br/>, s$ K" e' k: V1 C# r
<lable>Pierced Amount</lable><br/>
( G$ f& [; L1 Y<input type='text' name='item_pierce'/><br/>
# P& ~1 v5 u& H8 f& Y<input type='submit'/> L5 y1 u) I1 g$ n" e4 q: G
</form>";' m% T3 I- n+ ^$ O
}/ C/ _, }8 L' d. o0 B1 y8 E8 W) c
$ x1 S/ J/ f2 [* ?# W& jfunction PostListener (){
) n Q6 U. s: y2 t1 f$ x//Add more post variables if needed and add them to initform() function aswell
9 u) ?3 Q6 e) [: Q- g3 o( J
5 T) r A! b5 |0 P1 Q+ f% Y################################
/ e+ l0 B6 x, \$ J1 B- M- Q##### Connection and Post ####### t/ i, D' ^9 A- i# n% ^: o, ?' j
################################9 V& e: {& ~- u# T$ T5 C" b
$name = @$_POST['char'];! [; e8 Q3 i# m
$ItemName = @$_POST['item_name'];+ T8 _+ E* x; L; b; V* w" Q. g
$ItemAmount = @$_POST['item_amount']; ]6 }3 }8 d" `! N* `
$ItemId = @$_POST['item_id'];
" V& O6 f5 D# b0 V9 o$ k$ItemUpgrade = @$_POST['item_upgrade'];2 L7 \1 S3 k& ]) C |
$ItemElement = @$_POST['item_element'];
! x6 s* u8 d6 K. i/ O$ElementUpgrade = @$_POST['element_upgrade'];( G- D b8 U W5 F/ f
$ItemPierce = @$_POST['item_pierce'];
0 \+ U$ ]. {3 g- G- h################################
$ C8 F L; P4 v% T& t+ w
( O, g7 c4 F+ V- ?8 F' f8 H: y//Check both variables for empty value9 U, {: L0 l& }
- y O0 P$ [, ]6 D
if (!empty($_POST['char'])){+ s& {; J8 I. q8 X* |- z
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
+ L: b, s7 w4 v7 G3 n( b
, V6 `- _6 n3 I& k. ym_szName = '{$name}'");' n; g- a5 Q+ E
while ($row = mssql_fetch_object($find)){
R1 {5 y. A, ?0 M4 l" i) decho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
9 E U* e/ s. f9 t, X$ T$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
9 t: I/ K/ P b! U5 i
8 M) U( I& q7 t; b! m4 A, B+ J[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
% A% C+ {* R. b' b
" }) B" C7 \( K( t9 @. g ~; \" L8 o[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 2 a; b: H& M. u/ f- ~0 {4 f- }
( q6 A8 p/ \7 @. |! J
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
$ G- j, T3 I8 w8 \1 b. i/ F
1 i- `: j9 s- `4 |! ~! {'{$ElementUpgrade}', '{$ItemPierce}');");
; f. R" i. z( \' p& V' h}
6 V/ ?7 |+ _: t9 J6 v) n' L5 J# P# ~- Z. v
}3 @6 z+ {9 m) n# }! g. {0 h; H
* f6 X5 N" f5 u$ _- L' S; j2 s}0 `3 m% R$ i% V! H, V9 c
+ A, P9 x; _, I' \0 s$InitForm = InitForm();3 j2 {9 U0 E/ X& I+ j
$Listener = PostListener();, Z# I* `2 ~) A+ L) L
- i/ _$ v8 @% B
?>3 |* \3 k, Y% I3 G5 n
4 ]* s: y/ X- X8 ?( w; e( z7 y5 b# N8 n
$ j2 p, S9 h& }- U m& n0 V/ D
0 c2 P, Z' ]" x |
|