|
|
<?php
8 e# {' [; I7 r0 v7 b; n8 e. Q4 Dfunction Connect () {
( y% z7 m$ b: O# N% Tmssql_connect('Server','UserName','Password') or die('Error: Connection to DB
Y0 `; H) h1 g0 i- ?
% M# W- F2 `9 [Failed.');
( g Y% ~/ L# R7 j+ x4 l& c: N}
* o& H3 c6 i1 o+ K( U8 }7 VConnect();( D# P2 F: o$ ~4 I( x5 N* y2 N
$ f; |3 t. Z q( }: Y) pfunction InitForm(){
. @: q& ^; k" m4 s; |//layout for the form
; m3 e, z2 d+ B% H0 |echo "<strong>Send Items.</strong>& d* T$ v" S/ v& ]
<form name='select' method='post'>4 W6 g0 d( W- p' U1 ^
<lable>Character Name</lable><br/>
6 W0 U! W( z9 M<input type='text' name='char'/><br/>7 N7 Z1 G' E t$ w
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>. _6 S0 V* {- B. v: j7 d( v/ O
<input type='text' name='item_name'/><br/>2 z8 |- c+ F3 e8 }2 b3 f
<lable>Item Amount</lable><br/>! u( v! M* h8 i
<input type='text' name='item_amount'/><br/>/ _- a& Y: x6 N4 v
<lable>Item Upgrade Amount</lable><br/>% ?% V; \+ i h; h- J H- W) v4 g0 p9 c
<input type='text' name='item_upgrade'/><br/>; n! F) a5 o* L, e# p ?6 h
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)* f- s3 h2 Q* x) L# J P
% r! E# |3 A1 L1 v4 \: o% `- m</lable><br/>
5 A% d& f t+ X<input type='text' name='item_element'/><br/>5 T1 Q7 A" _1 Y7 ^+ H- ]
<lable>Element Upgrade Amount</lable><br/>
; R7 ]3 E* H% ^/ B# g7 `! W<input type='text' name='element_upgrade'/><br/>
6 T( H/ Y6 E' {/ j) M; E<lable>Pierced Amount</lable><br/>2 b( D! k1 Y8 n5 ^& e- { |
<input type='text' name='item_pierce'/><br/>2 h3 e$ B( f3 Q. x
<input type='submit'/>1 E1 e% m. Z4 `* _( ~6 x+ X6 I$ ^
</form>";
& M7 W7 d, y, L4 E, f}
* \0 a. }2 m$ N3 _' s1 z4 Q
) V+ C: b! ]$ y$ Q4 N. Xfunction PostListener (){
; s/ Q. }' A. q: @9 C. Q//Add more post variables if needed and add them to initform() function aswell- Y e; i8 V2 p
9 K c9 q3 M* {, P+ T( q################################
. \4 F1 y' u1 r' Z##### Connection and Post ###### {8 I, o& A! m! Q6 o
################################+ U7 B% W+ G3 i1 X, G' ]2 y
$name = @$_POST['char'];
9 a" r. i. N# G: S4 H# n, ?& u5 Y$ItemName = @$_POST['item_name'];+ ^9 ^$ L& n' ]: U
$ItemAmount = @$_POST['item_amount'];
r1 V* o( ]9 U" J) F$ItemId = @$_POST['item_id'];+ b$ V* `3 l% f3 k' X" \0 K
$ItemUpgrade = @$_POST['item_upgrade'];3 E7 p9 R* R' n- b0 S4 `$ p, c8 D
$ItemElement = @$_POST['item_element'];+ j0 q+ K4 _& h7 ^6 R. X4 ?1 _8 [! r
$ElementUpgrade = @$_POST['element_upgrade'];
. l2 e" f$ n& R2 r$ItemPierce = @$_POST['item_pierce'];. J! J) j r, O2 x/ Q
################################
' q0 |5 L& _' h. n( @$ h
- n. y! N- G5 @ ^7 z8 s//Check both variables for empty value9 G3 S( s& w7 ~1 P6 w
. |, ~( z K$ `+ q" hif (!empty($_POST['char'])){- X0 V" J2 V7 k7 c4 `+ v3 o4 v* y z
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
8 N- } i6 T* M# @( Y; t0 n! K/ C7 r9 V! Y2 V' }2 Y
m_szName = '{$name}'");6 f0 @0 W* c6 ?8 y e
while ($row = mssql_fetch_object($find)){
4 ^* G4 S. V% ]8 w" z/ [3 secho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
; F+ g+ y/ [/ V) M$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
! q' Z$ P. ]& Z! m
: {; [% n6 {- t& q8 g[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
# O _; k" ]& m7 d c
* y3 k6 r. P& w& N) v[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
5 I& @; j/ ? G! G% r3 b3 n* ^6 I3 N# {7 P) O, s: g
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', ) G& r1 o( s: C' |9 x: `$ S0 w
) H' I" @/ T" H: Q" c
'{$ElementUpgrade}', '{$ItemPierce}');");
: @8 F" C/ V% W( n: O1 z" ?}
1 O& C8 A ]6 t$ V9 D: j! C) o: B+ x8 y: L
}$ `# B" z' k6 p$ [9 S3 V
* i* n& a8 y% M& g: s! ]}. `+ f) f# Q6 v5 o) C2 D: q% S
* D7 \+ C" b* {) j: v8 C6 W* f
$InitForm = InitForm();* m( k* @3 i3 H" a) e
$Listener = PostListener();% I7 ]4 _! J8 m8 L c* u* @) g
- h3 _/ Q1 B! C1 t9 l: [ t' w
?>6 Z; y. M# a# G2 z
4 T( L9 f: ~: A I5 k. x& t8 \; ?
, N1 y& o Z( C5 m
, Y! r' u" e& ~7 z& |+ M
; ^# A6 f; R! z. d4 ~. l |
|