飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1064

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1064
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
% D: T0 S1 D& @9 Bfunction Connect () {5 c. m9 @/ y6 C) f/ z0 G& p! j
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
6 y( M' o! Z: s& \( E. u
0 T8 V1 w" r+ z  Z. X% T1 K* {Failed.');" Z4 b& l  v6 z
}
( D. G$ a! ^1 f+ h4 P! p% sConnect();
) T0 Y9 d9 h7 O5 K( c( A+ f7 |+ @3 Q
function InitForm(){
8 f8 l" |7 s. N//layout for the form
- v; T4 R7 O- S& u0 Iecho "<strong>Send Items.</strong>
- s5 Q8 l) w, D  ]<form name='select' method='post'>
" K  W3 V0 S( I* R; t3 s<lable>Character Name</lable><br/>
% y2 S2 L* l% x9 i4 L$ z; s<input type='text' name='char'/><br/>' @5 f, i& t5 v. I/ _& j+ _) i
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
3 Q( w* C) R7 [<input type='text' name='item_name'/><br/>5 r6 {& H4 P2 `
<lable>Item Amount</lable><br/>9 T3 ~% [* Z' u2 R
<input type='text' name='item_amount'/><br/>
7 y9 V8 Q0 R9 Q& W<lable>Item Upgrade Amount</lable><br/>0 C6 |( }- y# G3 c+ D% P/ i8 T
<input type='text' name='item_upgrade'/><br/>
7 \0 O, C- ^: A* y9 p2 H6 ?9 x<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
/ s/ l/ Y$ Q" F5 |+ ~  N  f$ {1 ~6 Y+ B
</lable><br/>
7 V1 e5 M( U' n/ t* H<input type='text' name='item_element'/><br/>' ~3 D$ m5 q* n. V# X* w( J
<lable>Element Upgrade Amount</lable><br/>
! L3 w* _3 g$ J7 ?7 Z% C<input type='text' name='element_upgrade'/><br/>
" B" g4 U. E9 Z$ ^<lable>Pierced Amount</lable><br/>
3 x/ X! Y$ F  Q! X% V) t' t7 G( v<input type='text' name='item_pierce'/><br/>
2 r) [& u; |2 a9 }7 A+ i" y9 y: \<input type='submit'/>; Q6 g+ t8 \* T% i) ?1 S
</form>";( n8 p) B- d3 y% r- k" Y
}
, Y1 z* g; r- e9 R7 ~7 c/ o5 m$ S/ v, x
function PostListener (){
2 N: O+ @" W8 h8 A. M2 I/ Y( ?//Add more post variables if needed and add them to initform() function aswell2 d& K6 [7 H9 q, C* ~! C/ P" e
, h/ N  C. f6 k& n1 ]# Y6 J( v
################################: b% D; G. G6 O1 c" B: K2 w& v
##### Connection and Post ######
6 {/ N$ M9 c- o7 Z( X/ T' q9 C################################
; e4 l  \8 k+ f0 D6 O2 ]8 v7 u$name = @$_POST['char'];/ W- P" b* b7 S8 f7 t
$ItemName = @$_POST['item_name'];& g& C: a, M; g; d: c0 V& |
$ItemAmount = @$_POST['item_amount'];
$ ?8 D( v' z; {% f$ ]: @$ItemId = @$_POST['item_id'];% O5 u  J( V3 z& _0 Q9 V' I
$ItemUpgrade = @$_POST['item_upgrade'];
4 T. z1 `5 P6 Y$ K4 i$ItemElement = @$_POST['item_element'];- y/ v' ?' ]9 V3 ?2 u4 W
$ElementUpgrade = @$_POST['element_upgrade'];
! ^3 e- C4 U0 ]8 V$ItemPierce = @$_POST['item_pierce'];7 B1 R+ z1 _) l
################################
$ z+ U/ L( ?' L3 Q
# C0 p( m$ E. V+ `% @//Check both variables for empty value0 z' r, t$ U( J0 {2 _: E& r
# Q: L3 x, `. i) T0 E- N# u
if (!empty($_POST['char'])){% {# z9 P! U% z1 {
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where - z% b8 p- B" X5 b& m

; e+ ~2 }; \5 Pm_szName = '{$name}'");: W* G) R' i$ n$ k+ b: O
while ($row = mssql_fetch_object($find)){
; Q0 ^+ M! j) w2 iecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
6 x, w5 Z% O/ r$ D& Y, P" w, M$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
5 R/ V8 A- o. p2 Q/ \
8 L+ G" F4 p! b[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 6 L( ?3 k' L1 X
8 r2 N' ]/ E) c4 w: m4 R
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
' d. p* F0 H1 e. I
4 W2 ~4 Z) C- l( V/ W1 [- ~+ MN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', ( k. O' @' Z9 A8 J# W- e3 @

/ B7 @5 \' d* p. m'{$ElementUpgrade}', '{$ItemPierce}');");: {0 m6 J! E; n2 N" ]8 C! Z
}
: G2 B2 ]  W: j, t! v; N
: j& D) f9 V, ~9 N}, N) G7 q/ d) j' H. j

  N1 i$ |$ G+ F}
: S* ?0 [6 B) A# p: \$ J: x
' H, Y5 v! X- E! J5 T8 Y, f, V$InitForm = InitForm();) ~  x2 ~7 A# {3 e
$Listener = PostListener();4 [6 t' t" z4 l; Z" M

3 f' j+ w/ b! B$ p) O# o1 o1 ^?>
6 @4 v8 s7 Q) n* w8 O1 i2 m9 C$ p1 w" h! H3 e9 _- J# z
5 B4 P- Z; ?2 X9 K8 i
+ n- }) f' s8 Q& }
: F# w: `  @1 L; S
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-7-19 06:59 , Processed in 0.087973 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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