|
|
<?php
6 K, G i4 z' Pfunction Connect () {, q/ s9 j# |0 C, \% \( i0 O
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB . H3 [( [% h1 e* c2 V; L: F
9 _. P4 z8 ?2 w; ~+ Y: d. aFailed.');
# f% N9 t/ a' ~ \}
/ p6 h/ S: \/ C; g% n! g2 WConnect();: S. [& G3 w: W& W- T# J
# g1 k! n3 n: a4 K( _1 ^, Y" n, D
function InitForm(){4 M. F1 B S# z
//layout for the form
! i4 V3 s& E# _echo "<strong>Send Items.</strong>
/ B. T3 ~5 ]' I# [( w<form name='select' method='post'>
2 f) N: }' F7 u Z& x% O2 R<lable>Character Name</lable><br/>+ v6 E+ m. P) R( y8 Z4 L+ ?
<input type='text' name='char'/><br/>
) H# _" k2 Q2 l/ |" D<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>) H- J- Z, u/ D0 ~* p
<input type='text' name='item_name'/><br/>$ r& B$ m/ t! M" Z2 P$ m
<lable>Item Amount</lable><br/>" M5 R: \+ D* O! e- @
<input type='text' name='item_amount'/><br/>
' x* z. v6 R7 F$ K& j<lable>Item Upgrade Amount</lable><br/>5 t- i0 @6 D# H0 ?6 J, W3 L* c6 X" `
<input type='text' name='item_upgrade'/><br/>
0 V' V$ Y: U5 W8 i$ _ W( O<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.), P2 ^: d; W" z
6 y, z" O% M; T& D8 j! t9 C
</lable><br/>6 y% `# |2 p7 c% X2 G2 F2 y
<input type='text' name='item_element'/><br/>
1 j" |; k5 X4 ]4 z<lable>Element Upgrade Amount</lable><br/> Z0 b/ w7 `$ e4 K1 e" @, T' l
<input type='text' name='element_upgrade'/><br/>1 a* t8 o, _% Q$ ?2 O
<lable>Pierced Amount</lable><br/>
2 J* {; b b: q% u% i w<input type='text' name='item_pierce'/><br/>
1 {4 O9 { ]5 `( E2 j( d( U) Y<input type='submit'/>
$ C H1 j4 l# X5 D- J</form>";2 Z8 E& c3 L7 ?+ T8 \
}. a3 Q; g- X/ c% Q2 o; r; r$ T
5 X1 D; w3 h B. z. f
function PostListener (){- B- R, U* @2 U5 M& n; A& r
//Add more post variables if needed and add them to initform() function aswell
, T( s Z+ m% B8 w6 |3 D; ^; {
- s4 x( j( s2 U5 ~ {################################1 I s, P) y4 j/ S
##### Connection and Post ######
, n0 H8 A; Y' J################################3 ?3 Y" _) Q- G( z: U4 Y C9 o
$name = @$_POST['char'];% r9 u7 ]) e( `8 e! p0 j
$ItemName = @$_POST['item_name'];
, W- K8 Y0 r2 s9 I$ItemAmount = @$_POST['item_amount'];6 t$ P3 y! e/ H* s3 A
$ItemId = @$_POST['item_id'];
( @+ Y* f! i8 Z8 G1 P$ItemUpgrade = @$_POST['item_upgrade'];
& O5 R: e) R7 d* i( p$ItemElement = @$_POST['item_element'];/ k ~2 I2 C! V" b0 V
$ElementUpgrade = @$_POST['element_upgrade'];
+ w! \8 G. U6 y6 Q- i$ItemPierce = @$_POST['item_pierce'];! i2 k& x6 `* U/ v& S- T! k5 w, S0 R
################################1 \2 q* H7 h. l; U7 k4 |
% f: R7 ~/ Z. ^8 q3 D: D
//Check both variables for empty value
1 S* y' F: \6 e3 R6 ^0 X/ q6 f1 s3 p* N$ C5 z
if (!empty($_POST['char'])){+ ~' X1 p$ N+ m9 C0 p
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
" j+ ~ B' {& L% ^- }7 n$ T8 W* I0 }- V* h P
m_szName = '{$name}'");
9 \* V+ _3 N2 M3 a+ K8 S2 X. y7 Awhile ($row = mssql_fetch_object($find)){
# A% o" ?2 O( A- m0 a* |6 \7 Zecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";: ?7 \/ P+ `! y* x, r
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
P( m8 w* d# n1 E! P ^
+ G$ X' b( c7 d$ F[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
9 v+ s8 U+ N5 x1 o+ k Q4 d! \' o9 }- m
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', - k- j8 @' P2 G
7 n6 x$ \7 P# K& e x2 AN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
! c8 z! ~0 a; e/ \: o6 I% M+ b; p+ R6 ^5 j- _
'{$ElementUpgrade}', '{$ItemPierce}');"); h! d: ~: h7 ~. n4 i; t
}, O! v0 m t; |
9 O, [: c3 q. @0 H/ i
}- R. }' q; Y& z3 Y& L
. R7 T/ P6 E& _1 A$ |9 y}, s7 o- |( |5 L) L! V3 v
- a! }* K, M7 ]/ v% b+ x
$InitForm = InitForm();
- q5 g' X8 z; p" V5 r/ C, E$Listener = PostListener();
2 p& u+ q6 G+ _4 \" }/ g- C. ?, g* o! S/ T) o! u L: D+ {, {2 G3 ^
?>$ z T- k" f- w3 E; ?. v- D \
9 w2 Q2 B2 W' x/ ^! n7 R$ l% ]2 q+ ]
) T2 C4 f2 m& w% y+ ?0 ~7 P3 q6 S4 V; {: d. y
7 a: }/ v0 \* q+ W2 S* f, D9 m |
|