|
|
<?php9 x/ I0 b- Q' Y2 e9 w8 ^* H
function Connect () {
2 O! i- h8 E! ?5 P% qmssql_connect('Server','UserName','Password') or die('Error: Connection to DB $ t4 n- v3 {8 f4 ^% D1 T0 C) y
' w, N, R0 _4 _6 L- JFailed.');' ~. I" Y0 B$ a- o$ K4 }! x8 q* |
}1 I, I; m) ^, n( O% x: j
Connect();* u) U- f3 q% W) N& p
; ~8 W) i( R7 N3 t: _ t9 ~function InitForm(){
6 a; L4 t; m% ]1 u//layout for the form5 L# V: q& z& Z+ T
echo "<strong>Send Items.</strong>- M. R! e1 I& l% |: z; q. A
<form name='select' method='post'>$ W. p- h0 l0 q1 \( ^2 r) {
<lable>Character Name</lable><br/>. [3 ?3 _( F* }9 V( {( ]3 L
<input type='text' name='char'/><br/>
. N; L% E8 W2 w6 e9 M" z6 G4 e<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>0 _5 v2 U& m7 x3 { R
<input type='text' name='item_name'/><br/>
, F; f: J: i" G0 }& n* O<lable>Item Amount</lable><br/>/ k, r0 ^0 ?( H3 H, H$ l. R4 B
<input type='text' name='item_amount'/><br/>
. _: a3 h1 C* C8 a5 Y% }! [7 a<lable>Item Upgrade Amount</lable><br/>) r% I6 z+ G% e5 Y+ Q/ {
<input type='text' name='item_upgrade'/><br/>
; v* f9 M- G4 V6 p& I<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
* E) l3 g2 r, M j* t& \" s; [$ h5 Z: O- Y- N
</lable><br/>' U+ W8 M8 L( E
<input type='text' name='item_element'/><br/>; U% U0 Z; s6 S# t3 E6 S' Y9 K
<lable>Element Upgrade Amount</lable><br/>
% W4 S7 {" {- _# x<input type='text' name='element_upgrade'/><br/>
8 k9 S! d' J6 L& R<lable>Pierced Amount</lable><br/>
# `# X8 H+ m4 T<input type='text' name='item_pierce'/><br/>
2 A- \# K% V) V2 h" R<input type='submit'/>% i) N/ _+ k. Q
</form>";) n5 ]+ C$ L' [! n; r
}7 S* h u/ J9 @- m8 z( K4 }$ C
/ S8 E- }% J6 T- [# e% v
function PostListener (){
9 b6 { v1 G/ E; x8 `$ a//Add more post variables if needed and add them to initform() function aswell
" O, }) W! v: S9 a- y
) l# @. l; m6 l################################ H& Q% D# S9 ~. i9 P- w* N' S+ h
##### Connection and Post ######' h% z( D! F# Z
################################
+ P$ y7 i: R2 S1 D$name = @$_POST['char'];1 V5 ~& i1 q# i% k* x7 p
$ItemName = @$_POST['item_name'];
/ F% b3 ?- l. X" G5 G! a$ItemAmount = @$_POST['item_amount'];2 c0 K4 D, y O+ L& z# T G% g
$ItemId = @$_POST['item_id'];9 W ?. U6 l# ~1 o
$ItemUpgrade = @$_POST['item_upgrade'];; @" Z, g! `" |/ |2 z( P9 a' k
$ItemElement = @$_POST['item_element'];" ~- Z8 q/ r$ v! Z
$ElementUpgrade = @$_POST['element_upgrade'];
* e. e% S2 A. t3 E. @0 E3 u$ItemPierce = @$_POST['item_pierce'];
! c5 s1 n' f" s# S################################
) N$ c& M! ], x j% Q3 w w! Z' M
; P) ? ]3 M. k" B z, L# J% \//Check both variables for empty value
# E5 G! p0 q2 @' n4 G
& j# t. V( S$ a/ \4 I+ R, I/ v9 rif (!empty($_POST['char'])){; n F8 a/ L+ @& P
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where & ? j: U W" T( U& s ]
8 q/ ~5 j% W; S4 ~5 {' pm_szName = '{$name}'");
w- j9 q7 k: r+ M; G/ Lwhile ($row = mssql_fetch_object($find)){5 F) p7 {% B3 p0 m2 o3 y
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";2 s( f" m$ s2 D% w/ S" I
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], C0 _, E$ I( \/ r
! Y5 [! K; Y+ T& V* B) j
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], [" g. D1 z* { V$ H8 U
6 C, A- ?, _8 m5 D( Z[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 3 Z5 Q: K3 w6 f% z' D- C
8 h4 |4 F% a T& i3 U
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', $ b2 _. Q3 L1 Y
6 N1 G( x9 W$ z7 @' S
'{$ElementUpgrade}', '{$ItemPierce}');");
8 ]/ [- H; V5 s}- @! j. f) j; I
& c0 k, M7 j6 D, ~# d6 T
}: P" j% L/ e/ Z9 H
; u {, I1 a; o+ J$ v
} T6 Z. o% |% v; M4 f4 Y4 Q
8 [" M" j" i2 @) P4 X. S$ P8 \$InitForm = InitForm();* z+ }- |& \: ~+ _: a+ ?6 o x( [4 G% u5 ]
$Listener = PostListener();& i+ r; g) y |
l, k) P P% O5 V E [6 `
?>
# U9 z: ?, w, K; l+ ] F3 j/ B" C9 S) M2 f- C3 r
0 p; i8 y8 C; N! t, B+ G" ^, `5 g, C
* o, L) J$ V0 w
- ?3 U! J9 Y- V v! z n2 q- m
|
|