|
|
<?php
8 U$ U. ^. }8 u6 t2 |: J) f8 zfunction Connect () {6 t) c5 f5 e, h1 E) s& g
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
; Q9 L# V% ~& C: Y" ^
/ n2 M9 k8 ^4 t* K# F+ a% m; dFailed.');
3 p$ `8 x3 e9 g}. }+ O+ l0 J) U! e9 e
Connect();
, A) Q* A: ~! t
1 b. g' Q* C% I) C' Dfunction InitForm(){$ U8 X5 `: ]- ^) t5 G% a4 X
//layout for the form
) P: I: h( B) Q6 j& q- s) Iecho "<strong>Send Items.</strong>
- B2 _; o% X7 u! \<form name='select' method='post'>
5 e, j! M! x/ Z<lable>Character Name</lable><br/>1 ]* k. Q4 m- t% B" |9 _
<input type='text' name='char'/><br/>
G: h& E( ^. D4 Q7 T<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
, E8 J3 e3 e* }3 v3 R& X<input type='text' name='item_name'/><br/>0 a4 V) k5 s. x# h- |$ V
<lable>Item Amount</lable><br/>5 c) R. O! ~, z" m W' t C! S5 U
<input type='text' name='item_amount'/><br/>
( G8 u5 t- G3 I. n<lable>Item Upgrade Amount</lable><br/>
& V0 o. o7 ?$ {2 D<input type='text' name='item_upgrade'/><br/>
% }0 O% W( T8 U! s<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
4 [3 {5 M' c4 Q
. L9 o9 `4 P* h8 K n</lable><br/>
' q8 {9 E/ |7 J, F G<input type='text' name='item_element'/><br/>
1 O3 a' H, ~' p& q; s3 Y' J% F<lable>Element Upgrade Amount</lable><br/>
/ A. M+ H9 R0 w<input type='text' name='element_upgrade'/><br/># X. x/ C5 D8 x
<lable>Pierced Amount</lable><br/>
6 E$ c. K9 P8 b+ g* Z9 k<input type='text' name='item_pierce'/><br/>$ l# \5 }4 c0 w! V C9 C
<input type='submit'/>" J5 x P+ C! g
</form>";/ Q6 V+ B) `& Y; }8 W8 f
}
) P% p+ D. s1 p" b
+ v# K9 S( ~; Qfunction PostListener (){8 _0 x1 v- {0 R5 I- I, F1 K
//Add more post variables if needed and add them to initform() function aswell. R5 b+ ^4 J3 N: L3 t1 H4 m' T
2 ]1 X( Q) O/ j, \8 O3 t2 Q! m################################
; a' H& u. _- n2 O##### Connection and Post ######0 A& i. C/ }- j# J B$ b% [
################################
8 R. e) @" v G4 H" x3 K( ]) X( r$name = @$_POST['char'];/ u' ?- H; w1 J( y" L
$ItemName = @$_POST['item_name'];% E* \: o( u9 ?: s9 ^: L
$ItemAmount = @$_POST['item_amount'];
- J, a. G' O/ m0 F/ l$ItemId = @$_POST['item_id'];) @5 u& S0 T1 u! k% B5 g T
$ItemUpgrade = @$_POST['item_upgrade'];
' D) H3 t Q* T+ b0 e, V$ x$ItemElement = @$_POST['item_element'];
8 _- c$ a. N+ d$ A2 _9 H0 X$ElementUpgrade = @$_POST['element_upgrade'];
9 t P4 H0 N- z3 m' ?$ItemPierce = @$_POST['item_pierce'];
, f( q, n* i" V2 h, T& W################################3 ?* ]' e; r+ [( @ |& b
4 E" E8 C/ }" `( V: }% u* O4 m6 u//Check both variables for empty value
! ^' R: s9 D; T7 R" v7 }" {7 K% e& N" a' M& A( G
if (!empty($_POST['char'])){
% t3 \+ q( c6 C5 Z- q$ ]$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
; K# k1 G, L8 O
1 m1 n2 C" z- r2 g5 Z) z- @; d: om_szName = '{$name}'");, B$ A/ k2 l: S/ X/ T0 o3 W: x
while ($row = mssql_fetch_object($find)){
+ r& K1 d6 q+ d, k3 V" y0 L/ xecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
! s% L+ C9 X# G+ h! j s9 D9 W$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
8 L c3 j) ?, ] L" W9 W: G0 Y; V) e- z
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
$ Z N- n! O6 ~, g
- r; @8 g) B! w[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
' G w) Q% B- f2 v' T T( j8 E
. X7 y' k c3 F4 S% y% T3 LN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
4 n% `' C6 O: Y1 J/ p5 F) F1 y( x
'{$ElementUpgrade}', '{$ItemPierce}');");
0 f! }7 |1 [# H5 W. n}1 k* `% r9 C4 w S- k; W; r
9 [4 j3 B$ ]$ A- y1 s% C5 q
}
8 i9 w* u! u6 y- A
1 B- {& d$ o; \* s}
" K0 G9 Y% D* Y' v N/ G6 V( o# c, r3 h z
$InitForm = InitForm();: e1 I' {+ O% N6 |8 T' A
$Listener = PostListener();
# X& q n6 N. X0 n) Q& @, c- h c+ G1 u ]
?>6 J* k! j- u$ w5 s8 N9 U
9 [4 c6 t5 N/ h3 A; k9 }9 F
% |6 ^4 Y, ^% N3 _* U F( Y
, m% k) X# F0 W, D0 C, c# O) J$ Z6 F E6 L c7 [/ D) ]3 R& u
|
|