飞飞世界论坛
标题:
物品发送脚本
[打印本页]
作者:
admin
时间:
2016-1-10 03:43
标题:
物品发送脚本
<?php
6 c M. T3 L/ m: E6 m& F
function Connect () {
* e. A6 J; z8 e# v
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
* n5 o8 O2 m" r5 j% b C+ k
7 i6 R4 c; \0 Y6 D& D: O
Failed.');
# _) F9 \+ a5 x8 m: x5 |
}
; Q: I/ Q" N) Q5 v
Connect();
& G" n# t1 O" K# r! ^& [/ i
" u f1 }5 c. e) S3 \9 Q2 w* f
function InitForm(){
5 X6 r4 N. W" F$ V- A! N& M
//layout for the form
8 B. ?& ?5 t0 |" T" S3 J V
echo "<strong>Send Items.</strong>
* q: s" h* W: ], E& {4 H* |
<form name='select' method='post'>
5 N* I. R7 s' O% m- S- Z
<lable>Character Name</lable><br/>
5 n& x2 y& i! z. g' h! Y4 O, c
<input type='text' name='char'/><br/>
# b) P4 ~7 ?" ^$ J* H' f: C
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
) `- b! w) c" K/ S1 E; {
<input type='text' name='item_name'/><br/>
9 G }. K2 U0 Z7 Z- ]3 p; U; P# y
<lable>Item Amount</lable><br/>
+ r9 y @; ?9 s+ y
<input type='text' name='item_amount'/><br/>
6 v- `2 k7 ?/ @3 S8 K( L
<lable>Item Upgrade Amount</lable><br/>
1 u7 f: T# w+ d( Z. f
<input type='text' name='item_upgrade'/><br/>
. c2 y7 J0 v9 G2 T" |. e$ H0 f
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
! R2 F" E2 [) } h k/ |4 O
; _% f2 ]3 o- Q% ^7 i
</lable><br/>
" S Z' |& D" U
<input type='text' name='item_element'/><br/>
# X6 _8 u, E' Q) S
<lable>Element Upgrade Amount</lable><br/>
1 W: x; B, q& o. }
<input type='text' name='element_upgrade'/><br/>
% C0 J5 [5 I. I- ]7 M. e) j' T$ O
<lable>Pierced Amount</lable><br/>
/ x# T8 X0 d3 n
<input type='text' name='item_pierce'/><br/>
5 D# X$ Q) ?/ K* u* L) E
<input type='submit'/>
# b7 P& K/ u: m5 ~
</form>";
/ g$ c2 ]' v" P! V( ]* M
}
6 R1 U. ]; K- s/ ^$ F
( E2 r& U2 J, H2 c" }3 [
function PostListener (){
V7 _9 @# R- V G! |
//Add more post variables if needed and add them to initform() function aswell
4 a" z# v8 r$ z) v- T }! W
z6 V5 I1 E$ l; M$ v; U; |- y
################################
" o% H/ v7 K" t% k3 |7 e
##### Connection and Post ######
) O k/ ]) \9 ?- V6 e! x* }
################################
9 Z6 P0 v. c( n% \0 J
$name = @$_POST['char'];
. f* ?% q* Y) b' s. h: y+ i [
$ItemName = @$_POST['item_name'];
, d. n3 J8 C" z/ k7 s. U
$ItemAmount = @$_POST['item_amount'];
5 q, C, O) ^) d0 n, V
$ItemId = @$_POST['item_id'];
( U; U& O( U( d! ^
$ItemUpgrade = @$_POST['item_upgrade'];
4 u# ^" J5 Y; t/ t3 B9 {: o
$ItemElement = @$_POST['item_element'];
7 @' Q& r0 }4 ^8 ~4 n: S/ \, D4 G
$ElementUpgrade = @$_POST['element_upgrade'];
# y. m0 A8 x* T
$ItemPierce = @$_POST['item_pierce'];
0 J2 u5 h2 h+ v, h T T( ]
################################
4 e0 y. r+ } i2 n3 @
! F' K: a3 m+ ~" E' x; [+ g
//Check both variables for empty value
! O' x- }( u4 c3 @5 ~: N
- [+ G- [7 ~0 j: Y0 O9 n0 Q& R
if (!empty($_POST['char'])){
4 w) ] n) V6 i2 G7 @4 o( I
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
9 i9 ]$ F% A. o6 a1 z$ D" p
$ i1 ]7 N+ v8 e- \0 |! n* s
m_szName = '{$name}'");
, f8 _! J L, i! x/ x6 O# X8 ^
while ($row = mssql_fetch_object($find)){
/ |$ M: C2 H# q# \( E
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
- ?$ M, B3 u0 L! ?) h# a1 {2 z% f
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
( @" o/ j I7 [7 s2 ~: G0 _+ D; G; M
S/ I& a* d# v w- _
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
G' ~+ G4 s: R1 {
" }2 }: O; W# ]0 @
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
* q( v/ Y2 [2 Q. R
8 i7 y' X' m! x' g
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
4 B, r6 A% J4 n1 J& R8 a6 i
3 b( K, c; B/ n' w; N0 ?% _
'{$ElementUpgrade}', '{$ItemPierce}');");
/ w x5 g, a `; K* G% r7 k% U5 i
}
/ Z+ r# H; a8 _% v5 q( b' `
, C5 h& V& k7 `# q: @& \7 ^! c
}
1 p: w" R- D2 ~* y
, ^. \ D/ F X5 t1 m
}
3 L9 b! ~+ z% m$ h" C1 W) f
$ |' d1 x# r- X
$InitForm = InitForm();
$ L5 v1 \" k. v
$Listener = PostListener();
5 U& w- N9 E. ]+ A: J/ K; \2 D4 C
+ X+ O$ f# V8 w( ]3 S, Q( N. N
?>
( l/ R9 U, a7 g
2 W6 P4 P: A& v1 K( i& c
/ F. a. f: G/ X4 t2 r* W' ?
2 b) q) y; k% V, h- _8 B4 m
; e6 t6 {! T: Z" t0 }
欢迎光临 飞飞世界论坛 (http://ffwold.com/)
Powered by Discuz! X3.2