|
|
<?php- c% L' i) k5 n5 O5 S2 d
function Connect () {
1 b- n! G5 a1 d7 V1 U! v" mmssql_connect('Server','UserName','Password') or die('Error: Connection to DB
6 y& [; E4 L0 S+ I' U2 H
5 D" U) w$ ^+ ~) QFailed.');
3 ^; m* k P `}
0 L* R4 }$ ^0 t, N. f1 l! |Connect();
$ f. n# ~9 a4 u% L4 G1 a. g! G3 l4 t7 j5 z
function InitForm(){
9 W" Z9 f% K0 B! s& B/ h8 _//layout for the form, }" o0 m* H& n; P& V9 G
echo "<strong>Send Items.</strong>
5 Z, @- Z0 N k2 F<form name='select' method='post'>1 t" [( W1 `& o+ V+ F4 ~7 Y% d, b
<lable>Character Name</lable><br/>
) v: O# \6 Z$ d0 F<input type='text' name='char'/><br/>
7 Y* l3 Y4 G* A# I- x, U" W<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>9 ]! j! `/ _( v0 L. c
<input type='text' name='item_name'/><br/>7 }1 B! P, u3 [1 J
<lable>Item Amount</lable><br/>) Y+ L5 B( o& j. h4 a7 r
<input type='text' name='item_amount'/><br/>0 G8 \" q& L( a1 K0 L- N$ l
<lable>Item Upgrade Amount</lable><br/>
" W! |1 L, ^, d f<input type='text' name='item_upgrade'/><br/>
& _5 B2 A- J" d& X! R<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
1 ^. j& H* E3 n: U& W; j) o
7 v3 @$ ]2 F* z# m; d4 o</lable><br/>
2 ^/ J- R2 X# s8 K<input type='text' name='item_element'/><br/># A+ T ~$ z& s! [9 d6 i8 p$ w
<lable>Element Upgrade Amount</lable><br/>
( t( q) P/ E* m# I% a' L<input type='text' name='element_upgrade'/><br/># d, U: q; O9 k$ M
<lable>Pierced Amount</lable><br/>4 m$ c+ s6 q( N$ C9 K
<input type='text' name='item_pierce'/><br/>1 g" o- D8 E; n4 _! E
<input type='submit'/>
2 B6 r' v7 I% ^$ a$ H</form>";$ p) [4 G7 _3 T# e
}
, g9 b+ C- P7 a3 W/ y5 [' F
6 S5 @ S2 a @7 Q0 i: t) kfunction PostListener (){
5 V" X# L" u& |- U4 x2 R) i//Add more post variables if needed and add them to initform() function aswell" l9 Q* G: x$ J% ~
0 X. [/ v9 c/ w$ n5 G/ I% K" L0 E y) J: T
################################
9 L6 [* g6 B1 w% N1 }: H6 C$ G* w1 t* c##### Connection and Post ######% W7 Y9 E# a, T5 y( P+ s
################################
8 o" T3 Q7 i; {, o. C; L$name = @$_POST['char'];
- ?9 o/ ^, Z# H9 I$ v$ItemName = @$_POST['item_name'];3 F0 p8 @3 H# s4 N' L1 p
$ItemAmount = @$_POST['item_amount'];
0 c" j4 X5 j0 g p: w$ItemId = @$_POST['item_id'];1 D. Y. r4 D+ }# _0 i. i; [4 D
$ItemUpgrade = @$_POST['item_upgrade'];
9 M7 X% w; L9 U9 R' t1 N$ItemElement = @$_POST['item_element'];
( D; e1 ^; k9 ~+ T6 L$ElementUpgrade = @$_POST['element_upgrade'];1 [% z3 L) |* x1 f7 g) ^# F
$ItemPierce = @$_POST['item_pierce'];
5 G f2 ~3 f4 q8 x0 y% d( D################################" u+ |4 I( L" h4 t; ~3 g) v
) s+ E' x" T! X3 I0 {, c! e# B/ Z
//Check both variables for empty value
, @2 j' s& ?+ [% u. r6 ~% M
# G# |% r% Q3 rif (!empty($_POST['char'])){5 P2 A/ Q% O/ \
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where + s$ {" E% Z0 [
$ C. |* S6 Y2 o1 v+ a( [" x
m_szName = '{$name}'");! @& b( b6 [8 W! A! \7 z) j
while ($row = mssql_fetch_object($find)){( L3 p$ z/ N3 P* Z
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";" F4 t) Z& j9 f2 Q/ U! G. G
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
) y2 P( |1 p" S: u: E$ k1 W$ `! X. d& R8 n& m* X
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 4 o' F! T/ P* b7 s" V
" {6 z/ R6 I- M+ T1 f
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
' U1 q0 O3 M B1 z& {( k& B: q4 ?( A" r) {
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', 6 g( A: J) T# ~2 u: P+ i5 x
3 A8 h. @ ~5 l' v: M
'{$ElementUpgrade}', '{$ItemPierce}');");
) F% |% M- R3 V6 F2 K/ w}2 f. E8 s2 g9 H; y2 |8 c9 ~
! l# Z% L0 M; E$ ~- [4 ~4 k
}
5 ~1 M8 v! s1 K$ p& C/ ^1 ]9 A+ G( e# j) H! F. n
}3 {( S2 {" i* i) q. Y/ g
( B" v# @5 |" U
$InitForm = InitForm();
. Z' x! }: r7 q& A+ K9 B. D2 S$Listener = PostListener();
8 l+ V. F8 ?3 S( ]7 j0 _% N0 \1 h7 @! A A
?>( [) d* E% I$ [( I1 i: g
9 |) |" h4 ~' Z& P A
7 h6 L% e- z! p1 }" Z5 K, ^
) p' l8 i* v" _0 l. Y5 o2 M
% E1 N# Q; }: K; J. s! E5 A |
|