飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
& d6 }) D! E% W5 qfunction Connect () {
4 a6 J' ^1 @8 i1 umssql_connect('Server','UserName','Password') or die('Error: Connection to DB ! p' s* f% |* H8 V; x: Q

* W+ T  G0 \- sFailed.');# Y3 L) _2 Q) _) ?6 d* U( z
}
) \( m, z, w* h, u; bConnect();
2 `) J) D3 e9 T9 S1 M
6 ^4 l3 b( H" a+ efunction InitForm(){* ]; I. S8 y3 K% x
//layout for the form! A1 V. H5 @2 G. ?5 m
echo "<strong>Send Items.</strong>: Y' ^3 @; t1 Q2 @
<form name='select' method='post'>
& c5 ~8 A& Y4 j/ x2 x9 ~- X<lable>Character Name</lable><br/>2 U/ s- X( S8 y) W7 |; X
<input type='text' name='char'/><br/>$ s+ d$ G4 g8 c. [! M/ J5 \* \
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>5 i. ~) y6 Z" C+ `% @0 n
<input type='text' name='item_name'/><br/>6 v2 y) y( c" b8 J) x+ m8 u
<lable>Item Amount</lable><br/>) F& h2 D* P0 ~8 p6 Z
<input type='text' name='item_amount'/><br/>
1 X" N  R/ Y. k: W<lable>Item Upgrade Amount</lable><br/>6 X( G% j% e# u: `! v' \! Y
<input type='text' name='item_upgrade'/><br/>
2 v7 Z9 [* u1 z( g  q% c2 p<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.). q3 C4 z+ f! }3 c7 `4 k

/ H8 _" g1 @& t; p4 |; p</lable><br/>
9 }7 M  m# z! M1 V: B; w<input type='text' name='item_element'/><br/>
/ C, K7 k& p. d; w; H3 d. D<lable>Element Upgrade Amount</lable><br/>
. T9 n( V# J5 @$ U<input type='text' name='element_upgrade'/><br/>
6 J: w  H9 e0 R: u, M! Z<lable>Pierced Amount</lable><br/>3 j2 l1 J1 H( i1 A# U- A( j. G
<input type='text' name='item_pierce'/><br/>/ \% r# \% j/ N0 B4 v" ^
<input type='submit'/>
( j6 i$ _1 T3 u  {& ~+ m  M</form>";
" V: @& R- t- f% C6 V# k8 g}: w3 I) K8 o( v
' R" p$ O9 I2 u+ R, {2 f
function PostListener (){
4 |7 l% ]5 s/ q' u4 F% V//Add more post variables if needed and add them to initform() function aswell& w# _/ r" _* l7 @' N+ z
6 x% ^, a+ D: }/ O
################################
. ]! S9 t+ P4 A. c0 H2 I0 a##### Connection and Post ######
1 K3 T8 e3 r( C+ e% [################################
  k* u: s, e* _0 j$ L, J! N$name = @$_POST['char'];, ]/ O) A/ T% P+ |& I
$ItemName = @$_POST['item_name'];5 g3 f6 p2 _, P5 C" w, e
$ItemAmount = @$_POST['item_amount'];$ ^" j; q! f5 t5 p' Q& r+ q4 n
$ItemId = @$_POST['item_id'];
) y4 r  M+ u- [# m+ _! ^; H$ItemUpgrade = @$_POST['item_upgrade'];
5 P' N, C& ]5 v3 e- u3 h, T5 p, _$ItemElement = @$_POST['item_element'];
* h% ^; b, ?8 ~8 T" i" Y$ElementUpgrade = @$_POST['element_upgrade'];
. D2 a$ i2 {) W* g4 k) W& O$ItemPierce = @$_POST['item_pierce'];
  ^; H$ B$ l2 p0 C################################8 f! a5 ]) Z6 U3 U8 F9 f

9 I9 C" x* h% Z6 x) g) \2 K; W* [6 e//Check both variables for empty value) o4 D& s: B# j5 {

9 V* t  V9 |7 u1 }6 x2 {5 Wif (!empty($_POST['char'])){: e6 H0 a4 r. U3 Z8 Z$ s  ~7 K
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
' L! Z  g* i- q4 d% P0 @& M& A) A" \1 }: ?! {
m_szName = '{$name}'");
- }+ b' g, \2 j7 u( u0 Y% pwhile ($row = mssql_fetch_object($find)){6 ^4 G& c1 J1 m9 E" N# e
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";1 w+ a; f/ X5 {* t5 a+ c
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 7 Z- F9 A7 I6 _7 B; b$ z  r

1 S5 u- T- y" P( T1 \[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],   F% j- g; [  m4 B3 p8 _5 o

6 h9 F/ Z2 Z0 l# k[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
/ ~$ i- ]6 Q. Q0 Y' i: K: C, ?& Z1 T5 I
5 j; W# I4 r5 ]N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
3 k7 d; Z; U6 U$ \( s& W' Y0 l
( k8 I& r$ t3 c7 E6 _'{$ElementUpgrade}', '{$ItemPierce}');");
! @# P5 `' |% l& ^& d/ A/ c4 `& M8 a}
$ q& q, P4 g1 ~( p" n/ W  X9 i* s" ]* ^5 x8 b1 K, y& j) k
}
) }2 J! i9 e/ n3 r* G& V) ]% O
! y/ m; ^6 q: x6 K- T) K) A0 p}5 `+ W) O" ~7 m# s
' L2 ^( `& w! {& ]; F$ r0 u
$InitForm = InitForm();0 F* S/ @: K! n+ k8 n5 ^( T
$Listener = PostListener();
4 J8 w) P) r. a2 b" ?4 s$ \# l( U" p- ?# T
?>
3 X# N3 [  ?  q( M
3 z/ B( M1 E& n. O6 k, s  l8 h* l. I

4 d8 C: h2 F8 c0 h/ |% j7 n4 H- H0 R+ y* u
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-3 23:14 , Processed in 0.070241 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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