飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php% ~  \5 _+ {8 d# `8 q( n# }& C4 M
function Connect () {
* D; q0 a& t2 {) s( V$ lmssql_connect('Server','UserName','Password') or die('Error: Connection to DB % U: P! Y5 Y% s, h6 y/ S4 K- _
) N3 O$ ]% k  b* m; L: s6 P
Failed.');0 z* X7 E$ q2 {6 [$ c& z6 J
}, }/ G! I3 B$ x; H' }9 j- ]9 R
Connect();
3 J/ L4 q2 g7 ?+ i
  ^* d0 K( L: U6 Y. E' b( Vfunction InitForm(){; J/ X9 Z' q9 s
//layout for the form4 r2 o' V, A9 g' }( T5 H/ [
echo "<strong>Send Items.</strong>
- s# q' Q/ W6 Y  m% f' ~4 r, ^<form name='select' method='post'>. B2 `9 d6 q9 |  Y- Q* z- c, h& u
<lable>Character Name</lable><br/>% o# f' ~+ R1 P' K/ O% V
<input type='text' name='char'/><br/>5 R8 R3 ?  l& Y- y5 S# k0 [* U( E
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>3 \$ K  X7 w- A
<input type='text' name='item_name'/><br/>- g! C# S( L. r: j/ j; L
<lable>Item Amount</lable><br/>$ K  |) g. ]+ @6 c# N/ g# V
<input type='text' name='item_amount'/><br/>' n" E- _8 ?: `  K3 N0 Y$ W, b5 |  w4 R
<lable>Item Upgrade Amount</lable><br/>
0 J1 E2 {' l( V4 K<input type='text' name='item_upgrade'/><br/>' G( s4 X7 v2 c4 C
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)7 i' s, C# b1 n& U/ o- f
7 D, M  }+ ~: R& C  D
</lable><br/>
1 _$ ?' J$ V7 a  s. M6 \6 [<input type='text' name='item_element'/><br/>
4 m2 n' L/ B  i% q- q  n<lable>Element Upgrade Amount</lable><br/>; d* F8 ^2 V7 ^
<input type='text' name='element_upgrade'/><br/>
9 G- A$ w$ v( J& F<lable>Pierced Amount</lable><br/>! I1 N* K4 }  b' ~: p* j
<input type='text' name='item_pierce'/><br/>
9 C+ O# U8 R3 c7 n- d<input type='submit'/>% d) S& Z; k1 i  g  a; Y
</form>";
$ f) w; g; L" w}
* i' r& T" t' c5 t4 `6 O* J0 L
" @" g4 \) E% |2 Afunction PostListener (){! e7 |: f. Z: `( t6 @  `
//Add more post variables if needed and add them to initform() function aswell. A3 K' a4 J- p$ f7 r6 ?1 l" L% V

; V9 l4 k6 v6 D  d1 i; B' s################################- y" I3 s1 t) c6 R
##### Connection and Post ######& ^8 i0 u- I7 [) M- K
################################
1 x7 ^1 h, }7 y6 e8 z$name = @$_POST['char'];! P% N. N7 J  X3 _7 I" D
$ItemName = @$_POST['item_name'];
3 [6 Q; u) K+ {: \$ItemAmount = @$_POST['item_amount'];% X& [. S6 j- |' S2 n
$ItemId = @$_POST['item_id'];
- U- [3 Q9 D5 Z$ItemUpgrade = @$_POST['item_upgrade'];$ R1 ]+ Z0 `8 s# {
$ItemElement = @$_POST['item_element'];  S3 u; C4 @% t% ^4 Y
$ElementUpgrade = @$_POST['element_upgrade'];: q7 P) v$ f1 A4 ^4 b6 _7 Z# _
$ItemPierce = @$_POST['item_pierce'];
1 b" d# b, g& t8 z: f################################
) n/ ~* b/ f5 k. o5 J4 a
* w/ ^3 w, Q! y! A5 p//Check both variables for empty value
6 o, [6 q6 g4 n( [* P$ A1 f0 s+ I, ]. i/ r3 O, r+ ?# J
if (!empty($_POST['char'])){
  k1 o* @/ Q, {: a/ u- [# D$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
* R; I- o" N5 J1 v: N8 x, A6 ^+ V# O1 D) `* u& i
m_szName = '{$name}'");% L  X, H3 j  f  ?% K* h5 n5 l, s- t
while ($row = mssql_fetch_object($find)){
1 G4 i) W7 ]. r1 x+ S/ Jecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";- V/ b. x7 q  \- X9 R) p* i2 E) \# |* _
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 2 x" w4 I% `/ d# k( d7 _  A

2 P2 A0 k4 O& e+ w! I7 ^3 l[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
+ k  o/ K+ Q+ H) F! h6 v
  r8 G5 d+ W; Y: F+ g/ C[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 0 l6 W; B9 B: k$ Y- o

# S5 Q8 o9 f+ m+ G2 S/ d+ f4 @/ mN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
5 P$ _( M$ T& E8 k7 j. ?0 u% Z8 y/ S5 S5 j% K4 s6 Z/ E
'{$ElementUpgrade}', '{$ItemPierce}');");! S8 B5 C: n4 g6 M# H$ L9 I& k( S
}
# O- U4 T. ~# [! _, m- L1 `8 {& B7 ?7 y  B" q
}# i% C' f6 D" a  `9 h* w! [
# h& @% b- \) N% J4 q
}# }# F. Z. ]( j  a) S, K

! e- x8 |% A" P' b8 J0 G$InitForm = InitForm();
% V" ^2 `6 W5 e% a$Listener = PostListener();
$ w: ?4 j& v  d3 K. s6 I; c3 N, n- T1 j! w  |; A7 n
?>
3 V9 r3 x5 m! A2 e/ Z: g! T4 s5 b' {4 `! G; e# Y
. @& W; L: A, G$ Y
8 p% C2 ~0 b3 v

- t7 m9 ~, y: T8 {- ^
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-20 21:09 , Processed in 0.059996 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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