|
|
<?php3 [- t) q, n ]$ c2 l* s! t
function Connect () {/ v+ o& B2 w: g* W3 x
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
2 r" w. h8 L0 y2 k! P2 n2 D {- f+ l' D3 O+ R/ [( ?, E+ Y0 s
Failed.');
: \# {# O, M- O6 P1 k}
: C" ~$ {" W m3 ?% a; b, S( d( R4 kConnect();
2 r) W' d7 G3 N6 a) X8 k, |( y7 O, m0 i0 Q
function InitForm(){
! h' e5 ^) N$ H$ C//layout for the form/ u. F) D, Q9 S; V% D
echo "<strong>Send Items.</strong>
$ r* l& t$ b% V2 }<form name='select' method='post'>: t8 Z. Q" A; ]4 {1 j! {& k
<lable>Character Name</lable><br/>. R m G2 N6 [% J& {
<input type='text' name='char'/><br/>2 ^' w- {5 S+ Y$ ]% H
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>8 `* o9 t2 H4 Z) H' g Z) W
<input type='text' name='item_name'/><br/>
: I" D: e% \4 v- X0 W: t+ s<lable>Item Amount</lable><br/>
& P0 k$ v- Q0 M<input type='text' name='item_amount'/><br/>
9 Z3 K. t# |3 y+ M( e/ c; L<lable>Item Upgrade Amount</lable><br/>
! F$ X- y# U0 I! ^: h) ]$ D<input type='text' name='item_upgrade'/><br/>/ _3 b9 ^5 T6 N3 E$ I1 q6 S
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
( I! A4 b$ I! B% c# I7 a. E3 @ p2 P% n6 w7 C
</lable><br/># }* t7 P) p. R* y$ N! |
<input type='text' name='item_element'/><br/>6 m K$ y2 j3 X. \1 \
<lable>Element Upgrade Amount</lable><br/>
3 H# c+ Q& e( ^( ?5 @$ U; ~<input type='text' name='element_upgrade'/><br/>
" H" x4 n; ~0 Q<lable>Pierced Amount</lable><br/>1 ~: w0 L$ E# f- W! ]% y# v
<input type='text' name='item_pierce'/><br/>& l6 o# s1 U# t; b. T
<input type='submit'/>
. e. |1 r9 W1 O8 u) L</form>";
& I2 f8 u$ U4 O! `+ A}
" I; [1 H4 r6 m7 ]2 [8 f9 \$ }1 {8 s3 k
function PostListener (){
4 F! I$ ~# i3 F# R# P//Add more post variables if needed and add them to initform() function aswell% h) R5 ^ @! k7 M2 z( C
6 z: w$ z* S7 i6 }( ]8 |& F
################################
; w1 I7 @1 z5 P) b; ^ c##### Connection and Post ######
! v( W* h4 t+ ?" `! K3 P' q$ e################################4 P% t4 M6 p W3 q' \
$name = @$_POST['char'];
8 a/ ?$ {* h \$ `3 B$ItemName = @$_POST['item_name'];# s( H. h% ?2 c
$ItemAmount = @$_POST['item_amount'];
6 Z: S* t- r% x# ~1 z$ c: Y$ItemId = @$_POST['item_id'];! F0 X) Z3 Y# U" y
$ItemUpgrade = @$_POST['item_upgrade'];7 P9 S& r! h* Z! Z
$ItemElement = @$_POST['item_element'];
" e& S6 L9 p, [! ~$ElementUpgrade = @$_POST['element_upgrade'];
9 G& H8 p: K+ \$ItemPierce = @$_POST['item_pierce'];
+ H- J4 d$ b3 m, O' E################################* E: Q+ a6 h! v) D w; M( J: O3 X
& d! C) {6 ]% q( t5 I, S# a
//Check both variables for empty value
' y1 v2 k. Z9 W) S- o# j8 S7 Z% r' |* ^! m) G
if (!empty($_POST['char'])){' Y! ?/ g% \5 T3 O# R1 ^: g1 O
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
* z- f8 h4 K. u% e. a/ ^5 J- ~) Z E) w% U. i- I; F
m_szName = '{$name}'");$ F3 s0 _; k8 b+ K/ _# v# n! u8 ]
while ($row = mssql_fetch_object($find)){( A, a2 Q! d' C7 G& M: q# C( `
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
@$ k8 v* [8 z8 E9 }$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
+ X. w0 c" [$ \8 {% `' p
2 ~! T. w5 v0 V9 {6 f8 M3 J[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
, G# O$ H2 d! {+ r d" a e. @1 q& {, k" m# o" ~( y; N
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
0 ~( ]7 R4 N/ d, }; |6 f& e, G* w3 o! Y+ N; Q3 G
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', " ?4 i1 b% L4 Z
# F- h p' `" r [: B, e8 k' z9 h* Z
'{$ElementUpgrade}', '{$ItemPierce}');");8 f! q+ V' S) S" H# a* u
}" t0 o# G2 \1 i! g7 A( q* `- y
1 I$ C( G$ o# v' J( G0 s9 U
}6 I [1 [1 E- `' V; r2 x$ n
8 w0 t+ w% a5 }8 i}
* ~2 S A" F1 i) o8 d- b
. I5 t3 j' S& M$InitForm = InitForm();
/ d8 {+ a( ~9 o) r$Listener = PostListener();! B; v0 S5 N4 s
" Q2 b% l9 Y7 _
?>
7 g- k# K0 T( {+ v6 z3 ~% a
, |; U; T$ @) j# G; l6 {8 J2 ^( N5 q& i9 b6 X" r
# Y) U4 X! `$ H |( n2 F+ o1 N
1 ~8 q/ I. D! Z
|
|