飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
$ g: Y) f' ~- W6 O3 n9 Lfunction Connect () {
0 Z6 c1 y! m) Z, [  smssql_connect('Server','UserName','Password') or die('Error: Connection to DB 5 n& v4 J4 x; w& l1 P3 g

$ @( a# V8 x% {7 \, j" wFailed.');: d: Q5 t8 e6 }) p
}
, p' n2 ~& T: |2 O+ \0 ^4 T4 b, W+ oConnect();' ?7 u2 q; h1 ]0 P' N
3 h1 I, \% _% G# F
function InitForm(){
! d) p$ ^$ ^& X7 h) ~8 T  U* \# X- Y//layout for the form
/ e4 J5 V7 z- L( a1 T. Y: y, oecho "<strong>Send Items.</strong>1 X$ L# n. h5 g' V/ |! k
<form name='select' method='post'>
9 U1 S3 j6 x7 _0 S' S<lable>Character Name</lable><br/>% G. F+ W, X/ w8 \# g2 H
<input type='text' name='char'/><br/>
8 o' C1 D. y# O1 y: b<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
! s* C# i8 o7 ?/ b( X7 A% w<input type='text' name='item_name'/><br/>( E8 L. A: ^& a
<lable>Item Amount</lable><br/>
' t# J8 L7 U$ Q" Q<input type='text' name='item_amount'/><br/>
" f4 s$ b% j# V) D<lable>Item Upgrade Amount</lable><br/>& f- I6 K5 E! `# ]  c, Y5 j( c
<input type='text' name='item_upgrade'/><br/>: `3 O8 e1 p/ G7 {% l
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
4 x& u1 r: j# }4 X7 s. V. r" c# |; O& F5 ~0 ]$ a# s3 ^
</lable><br/>; C( G" N' S+ n8 W; q3 {0 `6 l4 v, m+ N
<input type='text' name='item_element'/><br/>, f/ V- Y% A; B8 `0 Y% p, V) `8 @6 }
<lable>Element Upgrade Amount</lable><br/>6 o( e( o8 z" n# P6 n3 T; T8 X* ^
<input type='text' name='element_upgrade'/><br/>
( @) v! \0 T9 P- b: T5 H<lable>Pierced Amount</lable><br/>* \3 l5 W/ ?* L( |# g
<input type='text' name='item_pierce'/><br/>
7 X) w% d# H2 P6 _# l' o* Z) i3 Z; }<input type='submit'/>
) J" W7 P& R: [% k, F* U! k</form>";
/ k3 g; Q  q$ h* O9 ]}6 T9 v: s) B3 W2 T' _

; h: o  g  E9 m  Bfunction PostListener (){; i8 o: a6 g# w- C& q) O
//Add more post variables if needed and add them to initform() function aswell
& {6 `* v0 Q. @6 H2 C- ?  B
& y5 n  E: N+ Z9 O$ P3 u6 d2 @################################
* z2 o, P& `# a: I: |: V( q, h##### Connection and Post ######8 V4 p" ^! Y# d) l" Q
################################
) b4 I4 g/ [2 M$ H7 p7 j$name = @$_POST['char'];: |' J6 s, F6 U1 F7 S4 ~
$ItemName = @$_POST['item_name'];
2 o1 }, L; d8 f. }9 ?$ItemAmount = @$_POST['item_amount'];
. V: w* u- R4 |* a2 u0 f$ItemId = @$_POST['item_id'];: |+ E) c1 \' ~" k0 V
$ItemUpgrade = @$_POST['item_upgrade'];
1 K  L' \) [3 j- i. Y9 O+ J$ g: K0 C$ItemElement = @$_POST['item_element'];
: Y- X# l% @( f$ElementUpgrade = @$_POST['element_upgrade'];
; m9 O! H8 l0 J& G$ItemPierce = @$_POST['item_pierce'];6 z: O( ~# o# ]1 K7 K0 {8 F& ]
################################9 ~2 e0 C0 X! s; S+ D
2 N3 {. y+ |8 k0 W' p1 ]* E
//Check both variables for empty value4 K9 m, R- }0 D8 e4 F* o3 U/ t

6 O7 F( u! t8 T% Pif (!empty($_POST['char'])){
8 ~2 ~0 |6 e: A+ M# t* n1 V$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
5 O5 h9 ^; B& Q4 r% g' v7 P0 h& Q9 K
m_szName = '{$name}'");/ V2 |/ R+ o$ B$ t
while ($row = mssql_fetch_object($find)){, r& J: U8 e5 T. i# w" [4 d
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";+ N6 h8 ], d+ p4 n+ T
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 1 M+ G5 F) K8 N4 l* p
! i' U0 u' d' g
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], ! T5 [! }9 M% K  U" d3 @7 d6 G
) A8 n$ U: y  n* E" n% E0 v
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
1 I7 E' C  H& A9 _, r; s2 ?2 j( ?# o: R9 X! h( p
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
# i( ]( ^% O0 r7 h4 ^
, x8 }7 [8 j# S6 b'{$ElementUpgrade}', '{$ItemPierce}');");. B/ R, Q# l0 q' T& J
}
- {3 t5 ?# a2 f7 U
$ H: E$ V$ V3 d# p! d- n}
2 |4 [- l/ }" N7 m8 A4 `8 i3 s& K
}
% K) r4 g  k' u8 X
2 i# Y2 F. {7 r3 r& e" I$InitForm = InitForm();  N/ c1 c- P) L% M7 E
$Listener = PostListener();
$ N7 [! l# H& Z" z
0 F; B% C+ \8 W! e/ `& p?>
; \3 w# B% @$ W7 s2 @# {" q+ k( R' N" P1 M# g. B9 w7 J

+ }& V% M) Y& V5 C
, q- X6 A. s8 }- i* R, s8 C; q# ^4 I
+ \( b. \7 u4 \% u* d* d/ R4 I
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-22 02:51 , Processed in 0.059739 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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