飞飞世界论坛

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 8663|回复: 0
打印 上一主题 下一主题

物品发送脚本

[复制链接]

200

主题

203

帖子

984

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
984
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
<?php
3 Y* M9 F1 y, }3 S8 ~8 bfunction Connect () {
; @6 i0 T: p9 w! A' C* nmssql_connect('Server','UserName','Password') or die('Error: Connection to DB
" i$ D  Z0 T- Y$ ~8 H( a/ m0 T1 O! T& ^$ r1 w" b4 Q: G
Failed.');
" J# c/ t$ L0 S" f: }: I& v$ l) G}, D% W6 G4 |# r2 o: M9 Q- P8 v
Connect();
  i. G8 ^* `4 ]: t8 z# E( E" C  p, U9 V4 |+ |# R
function InitForm(){. l! X6 i3 ~1 y3 J
//layout for the form5 c0 X/ L: K& s$ i# m- l
echo "<strong>Send Items.</strong># b% Z* a& U8 {2 I. q( H
<form name='select' method='post'>
) u6 `4 f4 B" m( Y<lable>Character Name</lable><br/>
8 Q0 s2 t. J( M1 b5 I<input type='text' name='char'/><br/>  Q7 L, O8 l/ g( E6 L# ~; j# s
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>. y0 ~5 X* Z3 `
<input type='text' name='item_name'/><br/>7 E# G/ ]1 ~- I, H* O7 i) x
<lable>Item Amount</lable><br/>+ t/ |! \3 F* E( o1 N  }7 K
<input type='text' name='item_amount'/><br/>
+ w& k8 q3 W4 I. e<lable>Item Upgrade Amount</lable><br/>
: m$ h' b! ^0 w! |# U<input type='text' name='item_upgrade'/><br/>/ _# ?6 }0 }. \
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
* z2 ]" v- N+ |% I1 n, A9 G( p6 l2 G% p2 e/ h
</lable><br/>" G! K# F+ E9 H: A4 d$ z
<input type='text' name='item_element'/><br/>1 j" W/ v# W% _
<lable>Element Upgrade Amount</lable><br/>4 o% x: b& D% {4 q% f( q- S" o
<input type='text' name='element_upgrade'/><br/>
: s5 P$ p- a5 K- M<lable>Pierced Amount</lable><br/>
. s# l6 _. N% Y<input type='text' name='item_pierce'/><br/>
: G# k$ ~3 s% G  P4 I. c: I+ j<input type='submit'/>, ?# Z/ I6 A: [* I, S- [" p: O( K
</form>";3 z! p1 ~/ V: t2 `* m
}
1 h5 \; ^# c/ Z( ]' N0 X- I! d
: H7 e; k8 S0 y& X! efunction PostListener (){% X' p) W! Q; X
//Add more post variables if needed and add them to initform() function aswell
: z& f& F2 _' x& }
% ~1 s/ [; J# |# O4 v% ^" ]6 W################################& s/ f# ]& Q3 A/ J
##### Connection and Post ######+ x) G. X. A2 ]0 ^
################################4 i7 B: l6 }8 O% {- X
$name = @$_POST['char'];
! ~! y) C1 D2 z& C$ItemName = @$_POST['item_name'];
. ]; X+ b# n" I' ?$ItemAmount = @$_POST['item_amount'];( H3 s& I; q& y* Z
$ItemId = @$_POST['item_id'];
& V; n# n) u8 P$ItemUpgrade = @$_POST['item_upgrade'];" W7 b' @3 d' f" z
$ItemElement = @$_POST['item_element'];6 X; S! A. J5 Z$ v
$ElementUpgrade = @$_POST['element_upgrade'];
$ D" N7 f4 ?" w* ?$ItemPierce = @$_POST['item_pierce'];
: q, W* u+ F% }  \; a################################
5 A% n' l+ T6 B6 o6 t7 X6 Z. z4 M1 J; {4 a
//Check both variables for empty value
0 V8 c* ?* a% `6 k/ q% `; N! |9 l8 T' O; r4 v& S+ \% S* M- `) K
if (!empty($_POST['char'])){/ s8 |. Y1 S6 R; J, ?8 t9 ~+ X
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
5 S6 m1 W/ B% O2 [* Q! W( z" L0 _' F9 m* }
m_szName = '{$name}'");  G! S6 g: o) b$ m: N
while ($row = mssql_fetch_object($find)){
7 B3 B. j5 s3 M6 B' \echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";$ {& u* R( ^6 N* @
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
) M' K6 O! A+ I. C7 ~! i8 f6 Q" g( |% e% B8 w: Y3 k
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
5 ~6 k, ^1 S$ ^. Q: Q& a5 S3 j
. }. j7 R/ j" H8 x1 s) L4 [$ N[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 2 L4 q$ c1 M- `; r6 D+ c
( _% {5 }% y) {0 `& l* X! M
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', 2 q* o8 I, u( r5 v" }& Z4 e2 |% \, J
! L+ U. J+ \2 [4 i/ S' }
'{$ElementUpgrade}', '{$ItemPierce}');");
& l$ L) I6 e5 X4 E. @" e6 N9 c}
% n/ I6 C0 m; R# F7 _1 S) x7 p. c# A
}
& r; j1 k( w! L& O8 S$ p5 @4 A, V! D. ~4 x/ ]9 ^2 U
}
, l4 K/ [, n  a
) X/ G7 K$ G2 V# w$InitForm = InitForm();
* s) W0 W4 R+ @& `1 m6 i$Listener = PostListener();
0 _8 Q7 Z, \- z; ^( H$ ?
, q6 B! f# Q. u: B- k+ j" k?>& i4 V) c6 D& \

4 w9 T* K. K& J8 z; ?3 j4 F8 r, t2 Z. m$ H3 _% ]" H: ?" x- f& i
- }2 {3 l2 Q6 h# T

( T+ [4 G% t) v
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|飞飞世界技术论坛  

GMT+8, 2024-5-8 20:52 , Processed in 0.059238 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表