|
|
<?php
b9 i; x5 _! N! F' ?6 Lfunction Connect () {
! N3 w) X# s9 D9 n9 Cmssql_connect('Server','UserName','Password') or die('Error: Connection to DB ' x& J" E2 D2 d1 u$ ?( t9 ^
" e. R5 N7 h( Y) a7 BFailed.');
/ b; [- K! s& \$ ~( }$ y$ B}& O- F& ^% T! }: F0 u* H
Connect();
4 |, X( C/ i% {6 c; b7 N3 j) T+ ]8 I; U9 a, Q4 m
function InitForm(){
$ k4 r L7 c6 ]//layout for the form
4 P# Z* M( F, @1 |echo "<strong>Send Items.</strong>- X6 o* R2 u& Y/ o3 @9 t7 t3 T9 g
<form name='select' method='post'>
. A' g9 s2 [' D! B6 _9 y<lable>Character Name</lable><br/>8 V4 J, z0 @; u5 W4 s1 N
<input type='text' name='char'/><br/>8 g" f$ X/ w; h9 T$ ]1 J% i
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
* r, N8 D( M3 { S$ D<input type='text' name='item_name'/><br/># g' X' b5 s1 U" l9 `8 c
<lable>Item Amount</lable><br/>
i9 n1 U8 a" \6 n x2 Q<input type='text' name='item_amount'/><br/>
- w; U6 p( ~- K. q/ h9 U. U+ z/ S<lable>Item Upgrade Amount</lable><br/>
$ c3 l8 R% N) B" |<input type='text' name='item_upgrade'/><br/>+ X' K G2 m: a3 S* |; x% o, X
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)! R/ e8 q1 l) `) N
' F& R6 P, y! E# K; k4 j( Z</lable><br/>6 t' t; u# t! h/ H# {6 V
<input type='text' name='item_element'/><br/>' m2 o' y1 ?/ P$ q. s
<lable>Element Upgrade Amount</lable><br/>
. x5 v% l1 Q8 @& {. f: L<input type='text' name='element_upgrade'/><br/>) j6 z! D3 L2 j- C& b/ n$ T5 |& m- B
<lable>Pierced Amount</lable><br/>
; A. z0 m4 Z, i# y5 @4 A<input type='text' name='item_pierce'/><br/>8 S+ `) r* a) p2 P
<input type='submit'/>
- t: R* W9 V0 d4 v/ _</form>";
& f/ L+ r- k" o1 l, R1 a6 h6 N}
$ b. N6 L2 u% C( s
; \2 c. @! y% u* l$ R, Tfunction PostListener (){0 |; J. M8 ?) l0 n
//Add more post variables if needed and add them to initform() function aswell
' v' p8 e/ A( M4 ]* W) P# ?( X/ a, t1 y+ m: P5 m" m6 h3 O
################################' x& ~3 E+ q! [2 ^# I
##### Connection and Post ######
- |+ V* B+ k2 A& i3 H################################
) Z2 ~ X# F: V | j$name = @$_POST['char'];
/ D1 c! X' Z, r5 C: P; T4 @' b$ItemName = @$_POST['item_name'];
2 N( ?2 C. [* X) ?$ v: r s5 `5 Y/ E$ItemAmount = @$_POST['item_amount'];5 C$ @% ]9 |: }. ^' y
$ItemId = @$_POST['item_id'];
8 Z4 m% u* W3 R) R7 C. l; I0 [3 K$ItemUpgrade = @$_POST['item_upgrade'];
6 W# s E3 Y2 g8 Q% \5 F2 R' p$ItemElement = @$_POST['item_element'];
: Z9 J! Q& Q1 ?0 G+ b$ElementUpgrade = @$_POST['element_upgrade'];
9 q& r4 b0 u a* x5 C$ItemPierce = @$_POST['item_pierce'];9 R. h# i0 r& V; U) G
################################
; y6 W9 @' N0 j! f+ p) V
2 F6 l7 _5 _" `; V1 h4 ?//Check both variables for empty value* l2 y8 l/ V8 |
0 v S' u& J# j* ^- F- j
if (!empty($_POST['char'])){
4 T, t* Q3 E9 d% `1 B$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
8 h& U/ p a3 F0 j% {- ?$ L' R* L9 }# S8 N" d8 x
m_szName = '{$name}'");
8 w9 Q# G' `% E/ [) H% Lwhile ($row = mssql_fetch_object($find)){
! n7 @" _5 ~ h( ~- C6 s% S, Oecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
* ~" v4 V; r; V* M' P% k$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 8 d) d# I& i' b: D2 c
, _$ D7 |* ]9 d% @! k/ @
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 4 p& H& u4 m+ o. e8 A
, I0 F' z. k% E5 Z2 @
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 3 T/ ^% _( g8 s# E9 e, w0 ~7 ^
) S' C4 r' E0 U! a, [7 h4 M
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', / O) }# T0 G* }" `
3 w: k+ @1 K: b( _2 B" ^'{$ElementUpgrade}', '{$ItemPierce}');");5 \( {2 P3 s9 ^% B8 b
}
) g" G+ x6 Q; M9 {+ J/ T7 N
& L/ `- L. x; X H6 M$ o& a6 t}1 n# H2 q& [% x2 |; C& W
) l0 H7 i1 i- F+ T
}3 S4 x A7 m2 J+ G" v6 [- N
* s0 b, e! p( ]2 C: O7 {
$InitForm = InitForm();
: c1 G( a2 q I1 E5 |( X$Listener = PostListener();
' U; W6 f+ d( G5 Z+ P$ o7 _4 h' l9 D* o6 B& ^ {( Q+ M
?>
/ A# F3 a; D w% v
$ u/ p! a" z* D5 C
4 Z5 h% N- t( ?1 ^9 y' m, d' n7 W9 J. b$ J) B: M$ D$ v# j9 C
) u$ J8 u2 P, Z/ b8 y; M
|
|