|
|
<?php
5 i( {* P4 C5 U& wfunction Connect () {, B. r0 f% O3 ? b! R
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB 9 [2 K; u8 \: R3 O- E) {' z
0 j5 y& e6 d# ]; K7 l. m3 {7 yFailed.');* A+ X5 m% ~' H
}, P1 t/ P0 e' _ ]( ^: o9 _
Connect();
$ f" ?1 p5 I5 h5 [, Y' A
2 q' U- m! X+ F. x# P; |% ~function InitForm(){
/ G" m& {3 U! O C8 p- ^- ]7 W. i//layout for the form
7 N1 Y2 O* r/ g+ Q8 Cecho "<strong>Send Items.</strong> D/ ?" s Q' G, s- l- h
<form name='select' method='post'>5 t% j4 p9 s& q6 @
<lable>Character Name</lable><br/>+ q ?7 L0 Z% f* ~
<input type='text' name='char'/><br/>; D3 l5 }+ g4 o
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
5 p: k& J' x" F' ^2 s5 m' @<input type='text' name='item_name'/><br/>
+ @8 r: _5 S9 a x4 c0 Z6 k<lable>Item Amount</lable><br/>- ^+ t6 b' `8 S6 g; Z' o
<input type='text' name='item_amount'/><br/>1 f! o1 @; S2 M0 j7 c1 [4 t
<lable>Item Upgrade Amount</lable><br/>1 T4 R/ |/ v3 C% C$ b/ ~
<input type='text' name='item_upgrade'/><br/>
( J; Q0 Q4 u4 |! G- S; B: n<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
6 f- A" {3 f4 o" M" Q1 z
1 u/ D. [: w0 U+ m) A6 \</lable><br/>
0 d: _! G- h/ Z) ]. i<input type='text' name='item_element'/><br/>3 K) ]% }2 ], G3 S$ u
<lable>Element Upgrade Amount</lable><br/>$ b6 }% l9 k, S( g' t
<input type='text' name='element_upgrade'/><br/>- U- ^; W: B5 L$ H7 _( M0 a& D8 ]
<lable>Pierced Amount</lable><br/>
6 T9 o% M$ X! p" j/ v<input type='text' name='item_pierce'/><br/>- o. M8 `- t" ~1 H
<input type='submit'/>& D' l1 V" ` g! u) n, i# y
</form>";+ Z, S/ Y8 j2 @% K( C* a/ Q
}6 y3 i) r+ }% h* N7 @
) c) X; K9 Z$ N8 M4 d* P$ Q& pfunction PostListener (){% B6 ~4 U$ z, E( s+ }" `5 @, ]
//Add more post variables if needed and add them to initform() function aswell' c: D- h. P# ]- m$ @, X! l) F3 t
! z+ W5 R& n7 w: F
################################% N) E, [) J0 W
##### Connection and Post ######2 c8 ~9 B& ~' d3 P! g6 e9 P
################################ L! E% _$ l Z( H" N
$name = @$_POST['char'];/ K) N& o4 I, U8 d& s
$ItemName = @$_POST['item_name'];& U' ]" q1 @" a8 S& N
$ItemAmount = @$_POST['item_amount'];
# |8 M* E) W4 ]+ q, z4 R$ItemId = @$_POST['item_id'];
9 R8 P8 s* ` H2 | _' O$ItemUpgrade = @$_POST['item_upgrade'];
- W7 {2 C2 w$ x) c a$ItemElement = @$_POST['item_element'];! m) N( a5 Q9 c( G. {
$ElementUpgrade = @$_POST['element_upgrade'];: j: B8 [0 t: n6 B! T. g& c: w$ P
$ItemPierce = @$_POST['item_pierce'];- c' _' R9 d! h/ P
################################
7 {0 \! ?7 n/ O1 H. H# \8 Y" I. h0 y
//Check both variables for empty value
9 H- D6 s) f8 A! C" s
- l/ Q) }1 F# lif (!empty($_POST['char'])){% W; m8 |& e1 H
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
1 a: j6 _& v$ K5 [
+ L7 Q6 A% o8 Z: lm_szName = '{$name}'");
: x5 G. I+ X, a6 b7 K2 o; mwhile ($row = mssql_fetch_object($find)){
+ N- n6 K( D& l0 ^5 Lecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
. V, ~/ y: @! j/ B+ c0 J$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 7 O$ r; ^- F) e1 K* x
$ ^% U6 `- i- Z" Z0 Y
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
% F3 t5 p% n9 J; _8 B1 ~& J( b2 d% u) o5 `0 J2 D3 R
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
- @/ x; w" i$ f4 [7 N* I7 P+ o# N0 p f7 D
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', ! @; W7 x8 @+ _% W( y
& P! t0 e4 E( \9 K6 V, y
'{$ElementUpgrade}', '{$ItemPierce}');");
U: Y6 T, u8 h6 X5 O! G}" ~, m0 {, q( ]5 j) w
! c3 C% J4 N9 e$ t* f& p}
, t2 g' D: e6 j& c- P
- @/ g$ {& W& N9 Y5 A1 }}
5 p" o: A+ b/ g* e# ^/ z& ~! Y& t+ O) |2 ~$ Z
$InitForm = InitForm();3 {& T/ e6 E) R7 {% U) J
$Listener = PostListener();: Z+ v; z0 Y2 \- Z6 n; v N
- P/ u4 E( t0 o# T. g?>
2 _; h( j0 M& ~% u; M' |5 P6 |
4 h0 o% N7 I0 o2 I$ w: z
) [. e/ ]9 g8 u* X4 Q/ T& k
" K+ w S& Y r }% G( \. p r+ P3 W8 ? v2 |
|
|