飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php6 _9 g2 b$ q7 M- c
function Connect () {
# y7 {% e9 x+ E1 H" vmssql_connect('Server','UserName','Password') or die('Error: Connection to DB ! B. M4 E& X' a' f1 n

" ?2 T! o. F, H6 H& hFailed.');
4 Y/ c" c. S- k; Z( F5 A}, b8 `, F! u7 R7 n# ]# T7 W! O8 U
Connect();# g9 p6 L! L6 v$ J

5 W! }" R- q% M4 l6 Z% X9 @6 X, Mfunction InitForm(){
% y$ U. d1 l, p5 ?9 z. K//layout for the form
/ N' t5 Z. z8 p. \1 Eecho "<strong>Send Items.</strong>
, h+ h& L; h  T# m2 k& P* C9 O<form name='select' method='post'>" y. x, R- _) [8 C; ?
<lable>Character Name</lable><br/>
& \- n# s; g' ]$ b<input type='text' name='char'/><br/>& B- L" E# b# `$ i1 f
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
9 g1 K' K* d2 B7 ~/ j( M<input type='text' name='item_name'/><br/>0 y  @# |: I' F
<lable>Item Amount</lable><br/>
1 R$ I/ m% ~0 j5 I% @6 D& X- D<input type='text' name='item_amount'/><br/>
" `) {4 W  M. ?. H<lable>Item Upgrade Amount</lable><br/>
6 T& \# `5 K- L1 @( I<input type='text' name='item_upgrade'/><br/>
" j9 F; S0 J3 ]% x. }/ G/ F7 r<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
8 H$ K$ q4 b8 w
% G2 G9 G8 }7 O* }6 _4 i! ?8 S</lable><br/>1 @: A8 B0 x' E) r
<input type='text' name='item_element'/><br/>
/ e( F6 \& P: W* K9 R" M0 {<lable>Element Upgrade Amount</lable><br/>4 D, N4 i* s; W7 e( E& M7 Y4 A2 L' i
<input type='text' name='element_upgrade'/><br/>
. O( a- ^& I& N8 |  g/ Z; ?<lable>Pierced Amount</lable><br/>
! x5 L! |6 h& T+ j  ?$ V& x$ K, o<input type='text' name='item_pierce'/><br/>
& u1 Z6 H  z9 t+ o& H! f6 Z6 h<input type='submit'/>
, L" N' P9 o, U</form>";: i0 _( j6 D  C
}( a& I2 l. ]1 r, Q# Y! P/ S

. u- V0 l5 ?% H  d1 |8 rfunction PostListener (){/ z) F4 g, e/ a# b
//Add more post variables if needed and add them to initform() function aswell
# q* g. s/ t8 A& g
& O4 Y7 A! S4 @) \' Q, R9 p################################
  o) G% C8 {. g) R# j: ~##### Connection and Post ######
& I% x6 g8 f+ Y# a) q, k% Z! M6 Q################################. H8 k' n3 v6 o
$name = @$_POST['char'];% d& V% C3 Z$ C1 F
$ItemName = @$_POST['item_name'];: f" t/ P% w+ g/ O" f
$ItemAmount = @$_POST['item_amount'];9 y/ I' K% l' p5 A6 i6 K0 m) C
$ItemId = @$_POST['item_id'];
6 E; `7 B$ e* q! n- W$ItemUpgrade = @$_POST['item_upgrade'];" a# J& y8 b) B/ S
$ItemElement = @$_POST['item_element'];
, z7 G# ?. F" n" \7 o" o& A$ElementUpgrade = @$_POST['element_upgrade'];
1 v1 `9 P1 e7 ~  j3 g8 @$ItemPierce = @$_POST['item_pierce'];
% G7 L2 Q5 y7 E  c& ?$ {' v################################3 e7 y7 J' T- i; ~% w1 A
6 b) n2 D2 N! G4 W1 U/ S+ z
//Check both variables for empty value# j; m4 e  U. K/ f/ y* u6 S+ e
1 [' J9 g0 S! K$ l! C; v( l
if (!empty($_POST['char'])){% p. q! O& Q2 R' x8 Q+ E
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where $ T. m( q3 Y/ m0 ~+ f! X
# K  ~, v" C! Z8 y
m_szName = '{$name}'");
: i2 \: F2 R) Y2 j9 swhile ($row = mssql_fetch_object($find)){: A* Q' w; a0 x6 A6 O
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";. s% k5 @$ s. ]# S4 {, i
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
- p0 N/ F" [0 O' [; `: h: X) }( X( L. F( V9 U9 l( t6 B
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], ( W. y( N1 A2 i+ G

- ?. L3 b' [( p1 g' e. t4 Z! j[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
$ a! p# K7 Y6 p, i
+ G: Q4 V+ t7 h" {& ^N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
# r# D0 |, x: R/ ]7 z* ^; L9 M
& w7 u# C" m( Y: H: ^'{$ElementUpgrade}', '{$ItemPierce}');");' R7 m; X4 z: q" G& a- O
}
7 r; R6 y8 C+ a* ]& O8 q  @5 L
6 ^7 f6 t* T* O7 o* H0 T. N}( x* U5 {1 D, C
9 @+ ^( E4 _/ V7 E( L
}
, ]5 F* q% |# h- j) S" {0 u" H2 z2 l, l4 n6 j9 C
$InitForm = InitForm();
# w- n6 z  ^- X: w$Listener = PostListener();
+ |. J/ j+ A% @' }4 ~% O1 b2 h- X2 h: x, ^/ `3 Y
?>0 v, _: h: `4 V" n" }$ ~

$ D' z, B! n0 i0 L! r0 C+ G& r6 g2 ^/ D/ l$ k

0 U- I/ q6 Z. A, }
) h8 C* z  i) D# U4 ^1 s
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-12 14:17 , Processed in 0.060490 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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