|
<?php
. P/ ^5 U! O4 [9 _$ K& t1 F: Dfunction Connect () {1 U. h5 g4 |8 x5 f" k2 {
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
' n% q# A" ?' \/ G( {" Q& g! f: f9 R' n1 p4 P
Failed.');
& B- T% J/ j' K% D}; a* t3 a- ^) i$ x' Y7 B
Connect();
2 i) H6 @ S: [# F
% M- `9 v) k6 `' N. Q/ ~function InitForm(){. g5 x$ f' n" D3 L- z( Y
//layout for the form4 m2 l _% P7 G5 P
echo "<strong>Send Items.</strong>
/ Y- G; a k: x& H* ]; Y; p<form name='select' method='post'>, R+ W0 T& w- j' o5 W
<lable>Character Name</lable><br/>' j8 E' r1 y+ z) u# _8 n2 u9 G
<input type='text' name='char'/><br/>1 T( H9 j5 q6 n2 W+ ^
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>* `1 j9 E1 ` a) X( z- e
<input type='text' name='item_name'/><br/>
; w6 ]' a9 a3 X. J+ e<lable>Item Amount</lable><br/>
! U) r- h O4 L8 W<input type='text' name='item_amount'/><br/>
: Z. t- w% e# U6 T, f) d( T<lable>Item Upgrade Amount</lable><br/>3 E" h+ [$ I' X a- R3 Y
<input type='text' name='item_upgrade'/><br/>
0 H& F. o! e# h<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)8 Z4 J; F1 ]( O J6 q3 o
% P; Z: p' P% e7 R8 [, j( y- V
</lable><br/>
0 }# f+ r' \* H4 n4 t }<input type='text' name='item_element'/><br/>
, K" x+ \% x& E3 _9 f V3 y<lable>Element Upgrade Amount</lable><br/>; b0 z g' [% m
<input type='text' name='element_upgrade'/><br/>
, J7 V B4 g! o" t! F<lable>Pierced Amount</lable><br/>
4 M4 `% w# `/ Z<input type='text' name='item_pierce'/><br/>' [, {0 B3 f( Q2 ~ F
<input type='submit'/>
0 ]% a" B9 G! _7 b* v</form>";
5 B1 ?" T0 ^: d0 Y" x0 _" P6 g}
' |* D* ]1 |* ]9 S
7 E, g3 o5 m/ C0 H$ g; H8 [function PostListener (){8 ]+ p) S E6 a( {- G* |
//Add more post variables if needed and add them to initform() function aswell' c0 T# L" S& @$ h+ X& w" v. w
) j- ?/ q+ C- r3 [9 F0 [+ M6 H
################################
8 _+ I; O: c# Y- u##### Connection and Post ######
8 O' B8 v& ?! u/ o" @################################
# }9 I7 O- [5 X- o+ H$name = @$_POST['char'];
, }$ M2 e4 c# n$ItemName = @$_POST['item_name'];- E7 M- N: G7 ?3 I5 q
$ItemAmount = @$_POST['item_amount'];
) H& J- P0 T* k! H2 t7 f. }6 V0 d8 M$ItemId = @$_POST['item_id'];+ P: l' i1 ^& y* w
$ItemUpgrade = @$_POST['item_upgrade'];1 @ E" C5 c5 E
$ItemElement = @$_POST['item_element'];
: x5 |/ c& W* n$ElementUpgrade = @$_POST['element_upgrade'];" s" o8 a7 R! a9 @, Q* G( q2 Z
$ItemPierce = @$_POST['item_pierce'];
/ Y. F: R% N5 N4 u/ v% R8 g4 B################################
t$ I8 n* r' F, b w$ l& f2 q8 c. L" j) t! M# t# P, O4 T" I
//Check both variables for empty value
; r4 v+ q3 Q1 |& [3 C0 V7 l; w, p) o' ]* z
if (!empty($_POST['char'])){
2 _9 t3 p; p( T l$ n$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where $ A* H4 l# I$ a7 M. E. Y
5 d! J* K& `0 m0 Gm_szName = '{$name}'");) O$ l0 y/ L' ^
while ($row = mssql_fetch_object($find)){
8 t2 i+ `! o% I5 D1 zecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
$ j1 _5 L2 v2 }( h. u, v/ E$ ?$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 8 h/ H0 L5 _; v+ i
# K& _5 v% R& F2 L8 I
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], ! y! n$ T9 m% A! \6 Q; X5 G
1 M: ~5 X; D) o5 V9 _9 g[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', ) m8 s8 F7 F6 J& g* T" P! R v
/ |$ B4 k. \9 q2 Z2 ?N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
2 M; j' E4 M. A3 G% P/ b U- h3 p
; x0 C/ ?7 h+ |6 K! x l" N) J! N, s'{$ElementUpgrade}', '{$ItemPierce}');");
; l5 _- q ^3 x; q4 u2 a3 z W5 Z}
; v% ^$ i! O4 P; {1 I" i% D! _/ t4 i) L* f# T. t% P
}- x/ T0 ~ r/ N; Z1 K: J
: N5 d4 I" _6 k- Z h}% e9 }1 d6 _3 u5 i
: w6 w* f& e' y$ P) R& W$ d$InitForm = InitForm();% ^% z5 V8 z! E6 H0 |4 F) S
$Listener = PostListener();! j2 y9 G+ B4 b; m: c1 y. [. Z
6 S9 c5 [$ p; B& B
?>
% y$ R% D; P( c1 @& T' R5 r4 ?
3 u& D' G: |/ x' s
7 [) X; u7 ?" z; T% W n. w+ o8 p6 r q$ I
|
|