飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
<?php# t3 F/ q8 H7 v( O; D* G
function Connect () {8 n( M5 U7 V: p+ }, G3 X: z
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB $ E7 @8 Y. x, J) Z
8 r! g- }! ~( r! C& ^/ M& R
Failed.');( K" R9 I' Z8 X3 I; r0 q
}6 W/ ^7 m9 r8 {: S: ]
Connect();
6 U& m3 H8 r( _/ N7 ?/ }1 `7 j  C+ N- H- L
function InitForm(){
4 \$ v0 |& y. Y# T4 C7 B3 B8 r//layout for the form' P) o, f( \- L# j8 B
echo "<strong>Send Items.</strong>
; z* W$ ?. M, F( |# U: o$ d( }3 A<form name='select' method='post'>$ b4 a* A/ M: i& ^
<lable>Character Name</lable><br/>% I# S/ ?' Q# G6 f" h) W) c" r
<input type='text' name='char'/><br/>* @: _# D4 r5 b: }0 g; p
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>) [* Q3 A8 S( O- S( q
<input type='text' name='item_name'/><br/>* p" X  w/ H& f
<lable>Item Amount</lable><br/>( T- d/ W; N  a4 f: T5 F; J% k" y
<input type='text' name='item_amount'/><br/>; R- q! g. j- g, ?
<lable>Item Upgrade Amount</lable><br/>6 t: O8 _( ~  k3 B+ n+ Y
<input type='text' name='item_upgrade'/><br/>4 r; V, R1 C, y- H! G$ @8 ?/ y
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)- t6 p) g, r$ X# D; Z

, @! M- `- P! a0 R% y6 y7 Y/ E</lable><br/>% ^! D: k( d/ |
<input type='text' name='item_element'/><br/>! z2 t" z7 B4 g3 @
<lable>Element Upgrade Amount</lable><br/>1 y* K7 Q. ^- {
<input type='text' name='element_upgrade'/><br/>
& ~7 e3 F, I  w9 m+ O+ W+ r<lable>Pierced Amount</lable><br/>3 C* c( L# p& R: {3 a5 o6 [
<input type='text' name='item_pierce'/><br/>0 d, _/ a# k' \' e/ ?
<input type='submit'/>: O' B/ @/ j2 j, [7 q, F" F& @; a2 [
</form>";0 E# Z9 s# d* r) l
}/ j' p% w- F! W, [5 x: K

# q3 f/ c# m  `+ }% i7 }5 k. Ifunction PostListener (){
& i- [3 h; ^8 M3 C) I//Add more post variables if needed and add them to initform() function aswell% X9 @" x$ V* F. ]

0 _$ T3 f  Q! T! b9 E, A################################5 X9 Y8 P% n; Y) m
##### Connection and Post ######
8 L! K! l$ h) U2 s, ?) T3 _################################
& h( X$ O/ a/ ^1 ]. R3 K0 {$name = @$_POST['char'];
% M3 g! `2 D7 W$ i- w$ItemName = @$_POST['item_name'];/ u* U( [: {( n/ T
$ItemAmount = @$_POST['item_amount'];
5 Q& O# M% s3 l( J) d# \8 l( T' a$ItemId = @$_POST['item_id'];" k8 T. {8 s. k/ B, s- ]+ F- A
$ItemUpgrade = @$_POST['item_upgrade'];
, k" ?1 }! h. P' N2 H) E7 X: ?! K$ItemElement = @$_POST['item_element'];
" B  Z5 G2 [0 j$ElementUpgrade = @$_POST['element_upgrade'];0 O2 [) n% j1 @
$ItemPierce = @$_POST['item_pierce'];3 ?* W" k$ e6 p4 X+ g& u& ~
################################. o" T+ W$ e3 L5 S3 C7 E8 G7 s

0 I/ U& V2 U2 |1 z//Check both variables for empty value3 q2 o7 U( S- s4 z" Z. {% ^, b- N

) s' M2 N- r$ j; z. O  \) vif (!empty($_POST['char'])){
# Y6 E3 R/ g: G2 }, f3 p1 F1 V% E$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
& K6 A  J/ p+ o. a& [. k3 N9 J$ G( w1 U: ]) F0 @
m_szName = '{$name}'");
! Y- E" V8 \3 a1 a5 a' Swhile ($row = mssql_fetch_object($find)){
/ Q1 e& h1 w% becho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
$ D! `. F+ `: |; y& t  `3 t3 x$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], / N& Q& [/ O: m9 ?( X

9 K9 T+ G# g+ n1 }$ @[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],   W  |$ R, v0 ^$ f& q/ m, u5 q  Z

6 R2 J  n8 C# g) }- q[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
$ c) f: V3 N% m* h
) S- ^; H! L0 w- KN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
5 B1 s+ u2 e9 B% B, A6 f
4 C! G6 ^; c; F9 j'{$ElementUpgrade}', '{$ItemPierce}');");* Q% k0 F/ Y6 N
}
. \0 Q  e; K3 n7 H$ _! t2 j
+ [6 `/ C" x+ ?' p}9 B5 c) H, f# ~( H5 Q  ]6 L# m
* D5 z, t0 l, |8 K/ E
}
  Y+ v6 s: ]# b/ J6 m
) G% b8 l9 ]1 D- D% ~$InitForm = InitForm();
0 p5 m, d: H2 q4 i' h$Listener = PostListener();: }4 F6 X  M& m0 t( u8 ?
: [0 [* h! W9 |8 V( @
?>
' s6 e4 n  |5 v6 }! k* J8 Q2 _) u2 ?. B9 W8 A
- b# S% I, D& v
' e# H  @( v. H8 o

# W' Q( ~+ z! A" g6 s* e
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-13 08:52 , Processed in 0.062511 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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