|
|
<?php
2 B+ l U) s7 Qfunction Connect () {! P2 P& f% q: k) u
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB % ~: Q" ?: \" F8 i* T* y
; e( B7 u4 R/ l# d" n: J5 e; ?; e1 {Failed.');, P( y$ u7 i6 E C0 o r( H
}3 T/ w: Y5 }7 F. c" l
Connect();5 b5 g- j# g9 V( R
) d# b5 p# X4 s: [" L, M' c
function InitForm(){
" U; r5 |; _6 Y8 C//layout for the form! n% y! ?6 A; b6 S) _
echo "<strong>Send Items.</strong>; w0 p. i- z, I; C
<form name='select' method='post'>
0 w y# p- X3 G! Z$ W$ J, u: Q& o<lable>Character Name</lable><br/>$ R8 c( d4 l% g: `* Z
<input type='text' name='char'/><br/>3 E# g8 e& t5 d' j- H% S k& N
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
% s8 F1 P1 ]; v3 G5 G2 P<input type='text' name='item_name'/><br/>- A6 j+ H+ c1 s; d
<lable>Item Amount</lable><br/>
. u, z$ {& P3 X; `7 F5 g<input type='text' name='item_amount'/><br/>
) J3 {: o% _$ e8 u# M1 C1 n4 ?2 w& c<lable>Item Upgrade Amount</lable><br/>
( n( j0 M% }1 m7 M6 d- a, P<input type='text' name='item_upgrade'/><br/>
. G- B0 D& c7 A/ ~* \: T) O: C<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)( W G) b7 n. q8 D* B2 F* Y4 s
) r, H/ }$ V8 B1 g; _! I
</lable><br/>
# S) r* \# y7 @<input type='text' name='item_element'/><br/>3 ^$ P8 y& |0 u% J2 ?" ` p
<lable>Element Upgrade Amount</lable><br/>
) V% w+ W6 C1 ]; I" [<input type='text' name='element_upgrade'/><br/>
9 ~8 h' {3 n* J; a<lable>Pierced Amount</lable><br/>
* k+ n( T) O: C! C<input type='text' name='item_pierce'/><br/>5 c8 D& N# a" @/ W5 u) I
<input type='submit'/>
[; } ]& Z! _ M</form>";4 j0 H% a( R: c: y. z: o
}
2 k- P0 |+ w6 K8 I, }
! F0 X* p" e9 k4 @. }! c2 ]function PostListener (){. R8 ?! Y; U& x2 K Y
//Add more post variables if needed and add them to initform() function aswell
& ^+ n# U7 H4 H8 I1 d: [3 F. {# j$ e" ^6 Z, N* M; G+ V
################################: m( g* v) w8 Z
##### Connection and Post ######- M9 `0 ~& z! L' Z8 L/ e
################################% e. A: \1 o& W% |# Z2 o0 v
$name = @$_POST['char'];$ ~1 I0 I: R0 Z9 G- b; G
$ItemName = @$_POST['item_name'];, G- r$ V* f$ z U' T4 v6 k! U/ U0 x
$ItemAmount = @$_POST['item_amount'];
$ s' W" U, `5 m# s$ItemId = @$_POST['item_id'];
: N5 C& X2 j: S# b. N, y- l$ [$ItemUpgrade = @$_POST['item_upgrade'];/ H$ X* I: \8 i% w, P
$ItemElement = @$_POST['item_element'];- B3 U7 n3 y2 y6 W
$ElementUpgrade = @$_POST['element_upgrade'];) F: c5 ?5 \. c: V' U& [
$ItemPierce = @$_POST['item_pierce'];
, u9 H) \* _! t, b2 R################################
/ u/ U8 d3 G- a* ^3 C/ h/ S: b7 N' z# [ j4 \5 Y" ^
//Check both variables for empty value$ d1 b9 X! Z2 @% h
8 b/ e: F! A) F! u5 F
if (!empty($_POST['char'])){
& u7 H) J9 \1 O+ ?; B+ R# A% G& b9 Y$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where . p* B+ o9 k+ n U
l o' r2 I- u8 N8 Q4 e
m_szName = '{$name}'");
2 L5 q9 K( Y& r ~- b0 N3 Vwhile ($row = mssql_fetch_object($find)){
0 [) [" c, U# b7 _$ Gecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
2 T0 g3 p, k w, a- R$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], ! _" b6 N8 n6 c
- f( b; _: ^. R1 K. u5 M[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
% S2 d) M8 W! w) q. y& p# u0 G% I2 Y! v% L; R8 k3 Q Z+ _) t
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', & b0 g& m; e' C* Z$ \7 d* a
0 L& F) e) @/ lN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
( Y5 q3 o/ u, G% N4 d, D, Y" ~7 U% g, f$ g8 e1 _, X/ R3 X
'{$ElementUpgrade}', '{$ItemPierce}');");
2 ~- u8 _. x& p5 Q( r}
4 o' a! L: r* j6 ]
1 l5 [8 C6 X8 b0 ~9 n: k# H}
" `, x( U: T1 A7 n, j; u) l
& d, w$ l/ [0 }( n( G' D* r- ^" I}4 y% k/ J" }; Z& ]
! e, H* e, g4 F! l$InitForm = InitForm();
+ G A" g: J' R1 G t3 z1 E3 K2 n$Listener = PostListener();
; X5 @0 q# P* D4 i
/ _% l0 [2 i0 M?>
' K d; C) C" \) j9 d& y! X! ?7 f! W P$ [) G5 W4 @
5 y4 M6 e! W5 v7 O! E* I* a
0 X. p4 O' a; k* e/ ?0 t; M" I3 v1 m
|
|