|
|
<?php, J* b0 E* C+ z
function Connect () { _# v5 f1 C1 n( q4 T5 }! @$ ]6 e8 P
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB 4 B( j, A# N5 Q9 {& ?' g
* e0 h, P2 P, M2 J# W: C/ [Failed.');' ~6 `1 R @+ Y" ~+ c4 R
}
- _3 u# P1 ]4 k6 X0 FConnect();- l1 Y; G& u1 d$ j3 H0 R& r& M: ?6 ~7 B
8 r* B* p) C5 A% `! T" W' w; [- `: M
function InitForm(){4 r2 q4 F, ]( D( M6 w
//layout for the form2 Q$ M. E3 G7 V- U) q( k& H: M! A
echo "<strong>Send Items.</strong>; W' H5 e7 h9 c- ~8 |% k
<form name='select' method='post'>
& y1 s6 V# S. x- H2 P<lable>Character Name</lable><br/>
0 v/ e7 j( `0 d: k3 ]1 l<input type='text' name='char'/><br/>8 b) B0 R# H3 D4 r
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
w% c* x. L0 P3 N( m, p<input type='text' name='item_name'/><br/>* C+ d0 u$ E4 G U
<lable>Item Amount</lable><br/>+ a) v& M: A- a1 W
<input type='text' name='item_amount'/><br/>* C- W/ Y3 p- j. [; x+ B7 V
<lable>Item Upgrade Amount</lable><br/>- B9 v/ ^" v) ^
<input type='text' name='item_upgrade'/><br/>8 K. z, h5 b" w
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
5 k1 ~# v8 t! z. q# g! `( `7 @3 O C$ j _3 l* v+ I; {
</lable><br/>5 f# I$ ], U5 [
<input type='text' name='item_element'/><br/>3 t" u* s$ Q3 n n$ i
<lable>Element Upgrade Amount</lable><br/>. W2 h! f/ |$ N6 r
<input type='text' name='element_upgrade'/><br/>
/ E$ l3 R' O5 F+ O: ^& U% d3 T4 o<lable>Pierced Amount</lable><br/>
9 ~. b; z; n9 a/ u( o7 }1 g* `<input type='text' name='item_pierce'/><br/>; m( P$ q7 ]4 T
<input type='submit'/>
7 l, b, w' s+ j7 G% g4 p</form>";
3 Q: U; z* q5 @% W6 E}
1 l2 B5 }" }0 l9 v' H: N: v1 C
# b; J% i" o; W% E0 _- [function PostListener (){
4 {2 {/ J; g" m6 {//Add more post variables if needed and add them to initform() function aswell7 Y6 l$ Z A( M5 @3 r4 m. a4 n
0 E) y- X: ^4 [6 x8 o) `) [0 t, g################################4 F) h+ C$ V @/ H7 e
##### Connection and Post ######0 Z$ U h5 U% ]- A
################################, E+ e* ^3 X3 Z& V
$name = @$_POST['char'];3 y+ i& j, X& B' v' j& \
$ItemName = @$_POST['item_name'];
8 x' ]# l5 X2 V* k' c" d* h$ {$ItemAmount = @$_POST['item_amount'];1 |+ a0 i! l$ R) I( a; O
$ItemId = @$_POST['item_id'];
0 ]0 W7 X; l: Q9 k$ItemUpgrade = @$_POST['item_upgrade'];
2 z, Z+ I9 y1 P$ItemElement = @$_POST['item_element']; M) D$ R/ o& r* J) t* @4 [/ S
$ElementUpgrade = @$_POST['element_upgrade'];
% j, t) d8 v9 T f3 h) a4 D$ItemPierce = @$_POST['item_pierce'];
# G- c6 d" C3 ~: D+ M################################% j. O+ V: l! h9 N
2 Y& e# G4 W1 {( V, I//Check both variables for empty value
6 I1 R# }8 r( q/ v1 r4 a* G. R/ y9 K2 q( b+ |9 H
if (!empty($_POST['char'])){
% R" ]- R* L& Z$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
, f! g6 d4 M5 r \; m9 W
) L4 Q' ~# |9 W' q/ J0 Km_szName = '{$name}'");4 h% U' {8 q% \
while ($row = mssql_fetch_object($find)){
4 B3 d% z. {% v x3 lecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
, M+ U8 E: K4 w$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 9 f6 a2 z1 r+ @6 z7 T1 V
, z c! }% z& j- h4 p/ H. R& Q2 \[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
2 C, o1 o: n. G$ J- _
. |: ?& g) {) [, u[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
H# C0 [8 t6 U' C
9 ]) U& D! U5 O8 H' [N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', % e3 C4 }: v4 Q+ l1 Z+ Y
! X' }2 k' y! [$ z l'{$ElementUpgrade}', '{$ItemPierce}');");+ o c7 W6 _7 {! M) H9 R
}* o Q0 r% E4 W2 R' C2 I
1 _( Z" m2 C q+ F; H; }
}' n3 Y7 H- z. \ C# |0 @
! d- v' n0 s/ |+ G0 t5 L}$ c; e ]# h% O: [# K+ g
# M. }, O& R& y" ] r$InitForm = InitForm();* h5 F- N7 R, F
$Listener = PostListener();
0 H o/ N1 [8 ~( N4 z) h
" ~ |0 J8 m6 a8 N4 S8 E2 ??>
/ [& x3 X% @* a$ h2 Q, i
2 a; R+ ~9 u' k4 \ R
Z4 c% ~, p0 ]/ N( h3 W V, A0 O6 Y8 c5 R0 e; A/ L |8 y$ ]
8 ~/ [+ K8 ? ~, w8 A4 N |
|