飞飞世界论坛
标题:
物品发送脚本
[打印本页]
作者:
admin
时间:
2016-1-10 03:43
标题:
物品发送脚本
<?php
9 j( U' v! {: _' F8 R
function Connect () {
9 E: o. r8 k: W7 w T0 R/ Z
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
9 A4 D8 r4 m# v) `9 O
3 o! L8 f8 ~1 m+ b% Y9 w
Failed.');
: @& A3 [, c* G/ a$ F2 T/ ~- A
}
- G6 E' r. \$ \, N' g* `. u! I
Connect();
4 a4 Y. f N$ N" B1 Z: s3 Z4 o
. f$ K, e6 ^5 e9 w% B7 D- ]: w* ~7 F
function InitForm(){
3 L7 m# I$ }$ P c# `( S
//layout for the form
4 V6 e) v9 t* Q1 ?9 z
echo "<strong>Send Items.</strong>
1 n: y6 m2 {9 p4 a4 l
<form name='select' method='post'>
+ G, q$ O3 k/ _4 u
<lable>Character Name</lable><br/>
8 f) z" O0 c" \+ l" I+ H5 F6 g# w6 _
<input type='text' name='char'/><br/>
7 P/ O4 R7 A2 n5 r& v
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
! v, u, v- s. o. i
<input type='text' name='item_name'/><br/>
, f& C6 S* E# T) l! N, p" Q
<lable>Item Amount</lable><br/>
$ r5 q9 ]$ q( a/ Z
<input type='text' name='item_amount'/><br/>
/ ~, f8 C' v, i- O7 t0 N. p
<lable>Item Upgrade Amount</lable><br/>
/ N' l% ~; v1 P- \) F" B, I1 h& k* P
<input type='text' name='item_upgrade'/><br/>
/ P$ Y5 B& c' e; P! n; f
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
' f% K1 A' |$ ]
3 x9 [; T: p0 i2 |
</lable><br/>
; K6 W. y; E( r9 L, e5 x
<input type='text' name='item_element'/><br/>
" w, l j) B1 {
<lable>Element Upgrade Amount</lable><br/>
) ?& e# a, ^: q, I
<input type='text' name='element_upgrade'/><br/>
/ Z4 b- v- e5 D* o6 i
<lable>Pierced Amount</lable><br/>
! u) D3 P' F- Y4 u
<input type='text' name='item_pierce'/><br/>
& Z6 s- }2 |5 B" b) Q
<input type='submit'/>
' p- b* b, E. E! X' T3 x9 l
</form>";
2 Y( ^! j' X" L. w8 n2 ?* V
}
1 B/ ]1 I/ z% S4 t
. T% J# @. `, V: O# `) A! c
function PostListener (){
# T) E- S" a4 k9 A; J1 e
//Add more post variables if needed and add them to initform() function aswell
$ k' m9 f8 j- w. `, A6 L
_9 b( C) F- @! g
################################
/ x# `0 ~3 J5 S& Q& F1 n
##### Connection and Post ######
+ a& P7 N# E! w2 e& \9 E. G9 |
################################
: h$ m/ Q Y. k* r5 N
$name = @$_POST['char'];
6 ~; |# A6 k7 a$ p2 I
$ItemName = @$_POST['item_name'];
' }4 m+ Z% P: j, o6 P$ ~) b
$ItemAmount = @$_POST['item_amount'];
: A8 A: Z4 C$ P; d# a0 j3 j+ i6 D. T
$ItemId = @$_POST['item_id'];
4 W y" x8 V8 S3 `0 }- j
$ItemUpgrade = @$_POST['item_upgrade'];
1 Z7 p" J5 W" Y! I4 {% {
$ItemElement = @$_POST['item_element'];
& T, }# B& S/ S
$ElementUpgrade = @$_POST['element_upgrade'];
$ W. F1 Q: M; [* l
$ItemPierce = @$_POST['item_pierce'];
& \8 h) W( _. X2 X" `
################################
0 a* Q8 M+ `* N; w5 O) V
d6 t, j5 b& h$ d. h {0 a9 i6 Y6 o) E
//Check both variables for empty value
% _# M) r# N$ r9 i
& n8 k% j1 w4 F% b4 E1 ^7 n
if (!empty($_POST['char'])){
" @& H0 ~6 M1 H5 l/ d. x
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
I8 E5 W3 r' B& o
4 n4 h1 U8 y0 M' _
m_szName = '{$name}'");
; D: h1 J( n& `# ~; n, I* ^" q! G
while ($row = mssql_fetch_object($find)){
( R1 y' W8 r/ D& H% M' |
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
. Z5 \% z( n9 J' i) I/ B
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
( `% Q- \0 ]- U {
& J. H& E7 x" h4 E3 Z
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
* k2 W9 _' r- ~% [
% z3 R9 x" H* X( y; |, |
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
7 k# P- m( l. w: a7 k
1 j" q6 s& Q D7 z
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
5 K F N, @9 H/ s
. {# _! P& ]5 L, D) H
'{$ElementUpgrade}', '{$ItemPierce}');");
- r1 r; T# R0 h! V2 }
}
! p/ a* H% V1 V8 P7 F* h$ y
1 T* d5 e! d F
}
( f9 A8 [! z( E% Q
/ p! }- [3 ?. }3 [% X. \7 L3 ^
}
+ s& x5 N1 a3 Y" s4 h
6 I+ h0 q& B9 u' ?" T; `
$InitForm = InitForm();
9 U3 W' a# |0 y. T5 \
$Listener = PostListener();
( X# \" T7 r4 }0 `4 G5 C4 a( \
* b! k) ?& f& t5 k) q
?>
+ c7 \2 x! K2 Z+ }
( g# L, G) h* x; S
9 t4 ?( W4 B4 t8 t' Y
6 C& q3 [. ?2 F- p: @9 ]7 ^0 H8 P
0 y& ?. k3 \$ q/ N
欢迎光临 飞飞世界论坛 (http://www.ffwold.com/)
Powered by Discuz! X3.2