飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php3 W! Z7 M9 X+ V9 }
function Connect () {
! G! z" n2 m4 ^5 E& ?: G: C9 R* o# Cmssql_connect('Server','UserName','Password') or die('Error: Connection to DB 1 O  t2 m3 O# K, D0 t
+ P* J% o+ N7 F3 W# q
Failed.');
+ e4 Z" B' ~+ c- f, D' w}
5 T: w* ^- `* s0 B0 uConnect();
6 q( ^0 `: r1 o
* l0 G" s) E9 `' ufunction InitForm(){! Q2 f$ J- W( `1 F' k: C0 G  g
//layout for the form$ G5 P* P# q1 w) b( g/ a% _7 W7 S
echo "<strong>Send Items.</strong>
: T; |! t) d- u( F: z<form name='select' method='post'>+ {7 d0 u& J1 h& P
<lable>Character Name</lable><br/>
8 C, s/ D6 \3 w; u1 B& p<input type='text' name='char'/><br/>
8 m$ k1 c  q/ D. f<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
1 \. |7 Q+ K8 h; j2 P<input type='text' name='item_name'/><br/>
4 w& d9 B6 t: {1 {<lable>Item Amount</lable><br/>
3 [1 O6 `- M2 @% u<input type='text' name='item_amount'/><br/>
" Z6 b# u) {( ^; l# E<lable>Item Upgrade Amount</lable><br/>
1 f- A) X# G$ m2 ?" F1 V<input type='text' name='item_upgrade'/><br/>
5 \: B+ C) S+ d+ h' Y<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)4 p& c( I( Y4 v' r

: o& v/ k# B8 i$ i: T  _</lable><br/>, y  `4 ~4 O1 T6 m
<input type='text' name='item_element'/><br/>: R; Z& D5 H  Y6 L  b6 [7 j
<lable>Element Upgrade Amount</lable><br/>: I# s4 b7 o; C' i8 G( P* ^
<input type='text' name='element_upgrade'/><br/>& A% U! B( v3 f8 X6 A. X; @' b( M7 ?8 g
<lable>Pierced Amount</lable><br/>
+ {7 x' v# ]0 M# L6 d4 |<input type='text' name='item_pierce'/><br/>$ C! t$ o8 S' A5 n5 @3 d
<input type='submit'/>, a, [; K2 w  A/ o4 {& w
</form>";
6 w# {3 |! `; T: b$ s4 V. s}! i" K0 s$ p, i& t% `5 s4 w$ E
. b% @- }4 a" h/ u
function PostListener (){: c6 ^% r: a, R( O% Q) @4 v1 j
//Add more post variables if needed and add them to initform() function aswell
4 P% m" t" W$ U* x, s% f. P7 ^" [( }/ d$ J* }: x  J% `2 I1 ?
################################
$ {7 a; W1 d4 w. m##### Connection and Post ######
5 T4 O1 @! U. \: y( H; ]################################& C$ I/ H( m+ s! [, g7 s" r
$name = @$_POST['char'];
; Y/ c7 R1 U" f7 j7 {$ItemName = @$_POST['item_name'];
- O4 u8 }5 e4 e$ItemAmount = @$_POST['item_amount'];
2 @! w) p& R. `+ u# E- B4 h: i! M$ItemId = @$_POST['item_id'];
. |+ Y1 S( Q8 O( [$ItemUpgrade = @$_POST['item_upgrade'];( [( D$ e& g5 C% N5 W
$ItemElement = @$_POST['item_element'];2 q; `  S4 ^' G* V& y
$ElementUpgrade = @$_POST['element_upgrade'];8 N( ^  X8 Y8 r2 o# S+ r" b% y
$ItemPierce = @$_POST['item_pierce'];
' n. V, o. p: d. P2 U+ w################################
: K8 r: d; K: b8 W. Y: e2 ^9 v* e: ]+ S: }$ F
//Check both variables for empty value& r, y# ^" H" @1 @7 d* s/ d% Q. H

$ r. {( p+ H! c" jif (!empty($_POST['char'])){% k; p! f; X# r
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where : Q" N0 P9 F- d: N

( w( r! f4 Y! Z, e$ om_szName = '{$name}'");
# U/ t6 `  q: }1 |( O) ewhile ($row = mssql_fetch_object($find)){! B. T4 [5 ^, r/ U
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
8 u* V; k5 ^/ X  p8 d2 ~6 f3 V$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 3 F) B- a4 W# F2 X
) i8 v4 t/ m% e9 I
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
+ U# K5 _/ Q& K; f! H5 f! B% q$ e0 _* c1 N
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
8 E. {1 x( @) x& a- G. G5 W+ B, G+ `
6 r; J9 g( V0 f: ]% _N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', . W: B* h) ~* p8 R, M* E5 Z* x
7 h1 G* n4 X) Z$ q5 V. m$ s- @
'{$ElementUpgrade}', '{$ItemPierce}');");$ G6 P$ B  t0 S$ ?9 ~% c& |
}# d1 |' ^7 _# B- R4 H

' Z& I* E/ u4 a9 ?9 N}" J+ V# D2 p+ V; ]2 p

7 g1 Z: s! d0 m. a+ b: P; h}% N. i( Q& m6 e; w4 i

( c! k  A+ Y$ ^  d8 V$InitForm = InitForm();. _1 _7 `. _; D' K, m" Z( {: V
$Listener = PostListener();
7 n0 \+ |" q+ P: ]$ Z6 h7 a  M7 ]3 f3 F" i# ^; D% B% w0 k
?>
' n" E; _2 k" @" U+ _  @! t
. z# P. Z& W# r8 {6 w6 V7 d0 X
# B- h" Z' L. @; C: Y! _3 D" f# O% f. @/ r* [

, v# f2 C, T8 f* k
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-8 03:09 , Processed in 0.066408 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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