|
<?php1 n( c$ |: W. Z* W. P3 s3 i
function Connect () {/ y) w6 K# e3 Y- B
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
( f& C K. B/ \& P0 s/ Z$ N8 M2 l- v, z0 n# N' G. D
Failed.');2 ]' J) J3 P4 M$ U' E7 W, `9 u
}
- T. s3 b# y+ V6 B/ z# w, kConnect();
; D0 y8 ]- @$ \, X$ [. s
* P r6 D; Y c0 vfunction InitForm(){
# O* l# S$ u% X+ w+ T" s) a4 L//layout for the form
6 m: ~& D, j, y/ V" Yecho "<strong>Send Items.</strong>
) Y, \! M. z. P) ]7 _<form name='select' method='post'>* s V0 R l4 s6 @2 g; j6 q
<lable>Character Name</lable><br/>1 i' D4 Q5 y, H1 V
<input type='text' name='char'/><br/>
% }0 S/ f1 k) n3 T$ c ?% Y<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>4 |. d$ Q- Y5 h* `
<input type='text' name='item_name'/><br/>% P* _) f5 c f4 I& {1 a
<lable>Item Amount</lable><br/>1 x5 V" c8 [0 m0 T3 l2 |
<input type='text' name='item_amount'/><br/>
' s5 r* N4 K' Q: A$ I" |4 L% z, {<lable>Item Upgrade Amount</lable><br/>, W1 U F0 F5 q; Q6 l( r
<input type='text' name='item_upgrade'/><br/>
0 s+ ~% G2 P& ]0 d9 q$ {$ h, P/ o<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
, a0 w1 z4 t3 i& b0 @; M! d2 _9 H
3 y1 a5 u, P5 [) y, J, E</lable><br/>+ x- o4 q8 v' b6 _
<input type='text' name='item_element'/><br/>
. l4 L! G+ r& B; q; [/ u( e<lable>Element Upgrade Amount</lable><br/>
+ f6 u9 T" Y1 I) T+ p3 P$ a<input type='text' name='element_upgrade'/><br/>
! W( s7 i0 e2 j( Q$ }<lable>Pierced Amount</lable><br/>
) L' j3 d/ B) ]' q) u<input type='text' name='item_pierce'/><br/>9 K; @( N4 }2 |) p8 Y* \' z- Y& {
<input type='submit'/>
, u# m5 q4 n: U1 I1 l9 ^+ i4 {# m</form>";$ Z! ^& \3 K' q5 q" t
}6 _2 y; c2 \! B8 M' x8 J: X1 t
$ W2 I3 U! b" |; r$ G! T! s
function PostListener (){
2 Q4 O; g" R2 `' Q4 U3 g//Add more post variables if needed and add them to initform() function aswell
1 X+ K3 K X0 n8 \ U1 {# F$ V s: \, Y0 `' B( y' K
################################
: a- J% L0 P3 U* U' P. O##### Connection and Post ######
$ i$ U4 v1 _. n9 i6 |7 {4 \################################
% b7 |9 m* |/ x4 w2 { U) B$name = @$_POST['char'];
% f* d/ f* [/ o) {; H$ItemName = @$_POST['item_name'];
8 L$ `2 \0 {7 k1 C O) o$ItemAmount = @$_POST['item_amount'];; r$ h/ q& b- C/ u
$ItemId = @$_POST['item_id'];6 U; i1 `8 I9 o! Q% y4 n
$ItemUpgrade = @$_POST['item_upgrade'];
$ H( w' X4 E! Q ~; B5 x$ItemElement = @$_POST['item_element'];
. G' ?# k, O5 i" P: Z4 U5 b P$ElementUpgrade = @$_POST['element_upgrade'];+ Y- [+ ^. O5 z: Z
$ItemPierce = @$_POST['item_pierce'];' W Q) R( K$ }* v) A- P
################################
0 |$ q6 u8 h N; i. t7 n
+ c3 Q5 a* e' B) k) B//Check both variables for empty value
1 P7 X& o" `$ X) @: a2 A8 h8 s2 `2 d$ u3 d9 q' H
if (!empty($_POST['char'])){
7 h- }5 h+ ?( a" h$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where ( @) t8 ?5 t ^
[6 `4 R/ f# y! @6 Pm_szName = '{$name}'");
$ E9 w- y0 j; U; \/ i7 iwhile ($row = mssql_fetch_object($find)){
' x, |! j, R2 Kecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
$ W8 e; j; X5 C" w0 X- x$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
, B" m7 O8 S; p! ]
9 }: o" f6 s4 ][serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], i/ a) [/ a- \/ J
" r7 ^& Y3 s5 _+ h
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', & @6 r( k6 a$ a1 }8 u0 k
( G1 K" c q5 @% L3 j( z% T
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
! L* B7 s' n" M0 v7 l0 j! r* w8 k
'{$ElementUpgrade}', '{$ItemPierce}');");
: l1 ]& ]- K" K8 J/ e}
! ~& C9 o9 p3 A! B
% E' Y7 {) Q6 w1 T}
( b5 ?9 t1 s; Y0 p+ z1 s/ Z T6 I% }9 j: b2 p! J
}0 h# d% y: b! g) u
0 ?- g& @2 U( E8 h$InitForm = InitForm();. h3 }, z$ @( Z1 h4 K
$Listener = PostListener();
( }8 `7 X/ B1 k& Q- S* ^% }6 L5 b; c1 [; @$ w4 W
?>! e! K w4 ?( h8 ]2 l- f2 C
0 J8 J; R7 [1 D7 \0 [& x& `+ B2 T
; d' @2 B4 F4 i
; Q% |5 N4 ^# t. C$ @) m# H
0 r" N& \5 \4 u4 d
|
|