飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php# @% ?: o3 ]% o- Z/ o- f# J
function Connect () {7 ]% \4 O4 ]0 E# b% @- B. w
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
4 M. d# u. b2 U2 E6 K+ f& F/ w; c, M- P$ B2 I) ~
Failed.');% V& Y& k( R# K2 E' j3 f" R
}- m0 t# Z; R# J+ D8 v
Connect();
2 `7 Q! K& n5 j8 r8 f, P9 b, N! p0 {
function InitForm(){) ?+ q. y: l0 h: w
//layout for the form. o8 ]! r6 A) F1 T. n: j/ l" y
echo "<strong>Send Items.</strong>! M5 v" h, {% }- @4 ~8 ]8 c8 u
<form name='select' method='post'>
7 [0 S( W7 ~+ R, X% T$ y<lable>Character Name</lable><br/>
- l, {7 b0 M. F! R4 B7 b<input type='text' name='char'/><br/>9 O. s0 ?# \" G4 c" D5 S
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>: _, S; b+ q4 p9 j3 k$ k2 P
<input type='text' name='item_name'/><br/>
; ?' A) h5 {  ]<lable>Item Amount</lable><br/>
! z9 ~5 B2 t1 g! \( l# Z<input type='text' name='item_amount'/><br/>
) B( s# w: x# U9 Z0 ^( M& {) A<lable>Item Upgrade Amount</lable><br/>
. [: y7 X8 W! G/ n6 B<input type='text' name='item_upgrade'/><br/>
0 X6 ?4 @5 z* Z- {& F& K4 V<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.); k8 K/ t  r/ T" F0 f/ O

" h" J. Z  o- @5 x  K</lable><br/>; C3 a' L$ q- `  x
<input type='text' name='item_element'/><br/>0 h; f1 \0 a5 C% e# ?& |
<lable>Element Upgrade Amount</lable><br/>
" e2 @( O1 V) T4 ]6 `<input type='text' name='element_upgrade'/><br/>
0 c: n2 _& c4 m; b2 A3 P/ E8 o/ U7 n<lable>Pierced Amount</lable><br/>1 @' c% d% D4 O4 ^8 e0 {4 ^% }
<input type='text' name='item_pierce'/><br/>5 S! A- }* P/ A$ |
<input type='submit'/>
9 A3 _7 M" }! ^9 [6 ?' D4 o. J</form>";
$ O5 w  R2 S' z+ L. u( D( A9 b$ C}
; }# g4 I3 Y; i9 M; P4 W: B
+ M6 D: J1 m# D0 Kfunction PostListener (){
" |$ p+ t& N. D2 f6 V( y! r//Add more post variables if needed and add them to initform() function aswell  D% k1 a) {( A8 r: A6 Y
" ]0 w. [2 e0 p7 }2 ~* `3 W% p+ k
################################
5 i3 y* S: z$ @; @; h# Z, [' V##### Connection and Post ######
" x: R' w& t* U4 D+ X: D7 ~' i################################
+ P- x% a8 K% I+ u! w! a$name = @$_POST['char'];
2 x; _: g4 W- V$ItemName = @$_POST['item_name'];* I: d* o7 K0 {
$ItemAmount = @$_POST['item_amount'];' X$ D7 W1 G3 X  Q$ B- s
$ItemId = @$_POST['item_id'];# H  x. G9 w" x5 T+ q
$ItemUpgrade = @$_POST['item_upgrade'];
1 T  T5 r0 M8 [' f$ItemElement = @$_POST['item_element'];& Y8 r0 v7 \* J& P1 n( z
$ElementUpgrade = @$_POST['element_upgrade'];$ @" j3 n- J5 c3 Q7 @
$ItemPierce = @$_POST['item_pierce'];5 V* y! R% G+ ^; ]
################################3 N# n; L! Q. p$ K

" e& h; b: p6 f- L& l- k$ v//Check both variables for empty value  c9 K0 n3 a1 Q/ I) k; j2 Y
! n* W+ O0 _+ c; \
if (!empty($_POST['char'])){( D$ w& Q. j4 U2 Y4 m+ m$ s& o
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where 5 h* d0 u. k8 X- V
8 G; A8 H: C3 J. R; u' p' w
m_szName = '{$name}'");( T) V- S& I0 Y; o
while ($row = mssql_fetch_object($find)){+ p3 C- t- w5 R9 U- [
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
) p" @5 W5 _# C) E! C8 q4 Z& F$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], & B8 P: c: E  S9 |9 g" l

2 }7 S5 z4 D5 G! x* _( |[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], % Q4 s( T" n# ~

3 ?0 B# \" h- y3 s8 l% e$ N[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
* s- U1 M% h% w2 n3 Z9 L& a# a5 I& ^2 Y' o" W9 [1 s' y6 D0 [
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', 5 E& x8 a3 O/ I) i3 o% \. e
! f' M$ o- ?0 j! r
'{$ElementUpgrade}', '{$ItemPierce}');");8 B) B8 W  ~0 O. T: b" B. H0 k5 {
}& [% }2 f  m4 ?$ R

) m# L6 O1 p! x3 Q# g8 B, n: h}( p3 F- a6 j- _. E2 w

9 z2 }7 Y5 W8 b- [: L2 U0 l}
- h9 L( z/ j6 K
% F  c9 ?& s  z2 C3 c$InitForm = InitForm();" L- S9 E* e+ M1 V5 l, u
$Listener = PostListener();
- q# I0 P" y, D% t& Z# L
: {; ^3 u" w  N$ X( S% n?>
  m5 I/ H. O  Q0 k
. r. m4 c) {; }% o# ]2 F) m3 T! z7 @2 k. p

* l6 Z9 R* N" g: f' a& s9 P( _, {8 u: a3 M% z0 f9 D) ]) Q( T
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-21 11:31 , Processed in 0.060395 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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