|
|
<?php
- T( P, U. B7 Q7 nfunction Connect () {4 ^) l- Y2 m+ d2 p
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB " O: s8 y6 N% _2 r' e( y( e# m
: E; t9 c' P- x9 w
Failed.');
* c+ b8 P7 j8 v}: G* x- M i$ p( I" ^
Connect();' G) K2 W) w, L5 i2 k8 w
: n8 M% D" w( q) E$ Lfunction InitForm(){
" k8 L% ^1 Q: y# Y- k6 `0 h//layout for the form) p! }! l) v) s+ ^
echo "<strong>Send Items.</strong>6 y0 Z' f! y% N! d V; F
<form name='select' method='post'>
3 q/ a, A" w3 m5 T& n8 \' L<lable>Character Name</lable><br/> @2 B$ Y- g) Q7 j
<input type='text' name='char'/><br/>
9 L6 P) B" \0 A6 d4 G<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>, M8 S# g6 u$ ^; a- ]% Q
<input type='text' name='item_name'/><br/>$ K P! P. L, ^! N' J
<lable>Item Amount</lable><br/>
; m" q& g4 k; n* x) t% n; j! x3 |. Z<input type='text' name='item_amount'/><br/>
2 I- W6 v# _( g) W g' t<lable>Item Upgrade Amount</lable><br/>& @9 v8 T% ]& W! u5 u# g/ ^3 U: ?$ Z
<input type='text' name='item_upgrade'/><br/>( L9 [3 H6 h( y/ Y- }/ {" q; U
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)4 Y0 w* J0 N9 w& Z2 X
" }$ X& ^. i! N" a' \</lable><br/>
' Y0 m, V8 k( c; n2 k8 D# L l* ~4 ]; z<input type='text' name='item_element'/><br/># j6 b; h$ F) B" F5 a
<lable>Element Upgrade Amount</lable><br/>3 h- @) N; z9 m
<input type='text' name='element_upgrade'/><br/>
0 \2 ^8 B& ~$ L+ l6 j% c6 m* B3 n<lable>Pierced Amount</lable><br/>- {# [ ]5 |& P; ]8 d; U3 w
<input type='text' name='item_pierce'/><br/>% X$ T4 j5 i$ i) N
<input type='submit'/>
5 T- L6 B) P1 J4 L+ v8 b</form>";
# e/ P8 J/ _/ y. a6 E}
" v: C/ w3 v* N% z1 Q/ J
; E9 F, g# G+ C* x |function PostListener (){
# L4 C3 g u; [/ ]; I, d U//Add more post variables if needed and add them to initform() function aswell
$ Q& S# z! o7 c/ G- x5 ?1 D8 d! d. P: y! K$ J6 L
################################
5 Y+ P3 ^" u9 R: t##### Connection and Post ######
3 [9 P+ w0 G) f+ @0 }/ F################################* w4 x3 f4 V' C& {, N
$name = @$_POST['char'];/ h, B& N, A6 ]
$ItemName = @$_POST['item_name'];
! R$ d7 |% J5 T+ J6 ~$ItemAmount = @$_POST['item_amount']; t$ M7 e* u3 B$ I/ H
$ItemId = @$_POST['item_id'];/ m4 w. J" k# c* G# x" i
$ItemUpgrade = @$_POST['item_upgrade'];
7 C% w! k/ S8 L) E- g3 i# S$ItemElement = @$_POST['item_element'];
" o* s" k0 O8 i5 r. K" W3 f5 c+ z8 W$ElementUpgrade = @$_POST['element_upgrade'];" S( Q7 [1 R5 U3 r& H
$ItemPierce = @$_POST['item_pierce'];9 D$ [: q# k* E! K, {% S! {, v: E: C/ k; b
################################
; q z3 I8 D$ |. ^" E
+ o1 R7 X2 s3 c( p% b: u//Check both variables for empty value
% G6 q# j; v4 w7 X
8 d; q4 M7 z2 A5 m+ I- D9 qif (!empty($_POST['char'])){. Z! J, Q% g: b% r3 N4 L; [( T$ }+ L8 k
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where % [0 U. K/ Y& {! {7 R
6 U, w& _- `9 U! ?' c. |' om_szName = '{$name}'");# ?; G; U; _% ^/ M* W$ k2 Y- w4 V
while ($row = mssql_fetch_object($find)){
* V2 e5 H! n8 C$ P% y6 necho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";4 A" @' u5 u. J7 {; H( @" H7 Q
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
1 U p/ m7 P4 v: z: @9 k& [* G. C6 A$ ]
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 9 O9 R& q$ \1 Z; z7 u
# J( w, D2 k3 g[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
- G; W9 e$ X! U5 m9 V+ U) s9 B9 _! Q! n5 P! [( {! s' t
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', - X% a) j. O% R& c" O) _+ K
* g7 T0 m* N6 L9 v( K3 U% u% H5 O'{$ElementUpgrade}', '{$ItemPierce}');");( u* K! o3 F2 }) Q5 f ~. q
}
- y& L* _" p# k) Z7 Y: [2 c& ~6 v7 A: z# E9 ^ L/ m* u8 U
}& A7 D6 R) q! p/ c! E ?, v
* k8 z# S3 n( F
}2 F# N- R5 U! _) \, Q
4 ^2 R& U5 g4 m2 h
$InitForm = InitForm();; x! @, ]; N% ] H
$Listener = PostListener();% r, \/ r/ b- ], ]7 }) X9 f
9 G4 F9 J E. u; D' w, w?>
9 ^. A% h( {' g0 ]. G6 j/ ^6 ]- Y* }1 F4 n$ C% u M/ d' \
' O! V" a) I5 D B' K; B
$ H* ] e9 N/ o: Y/ m
; ]( f9 R. w! Z4 |8 }4 M( c9 s6 ^0 W |
|