飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php0 x' H3 I1 M6 X# \' K% S8 ]0 W
function Connect () {2 [- l7 T6 E0 X# j6 l
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB % b! E$ X: w/ ]* Y% g

( b. n8 F1 w1 O1 ?- h" y- D+ dFailed.');" t! O/ ?7 s4 F9 p* G; ]
}
5 @) T" B- g4 ~" V$ qConnect();. c. {2 X0 C2 P4 H' d# ]! ]4 q

7 p! K0 k4 y  w+ Pfunction InitForm(){
6 J8 h4 ~% U' c5 J% U) V& \//layout for the form
* g& @5 @, `5 necho "<strong>Send Items.</strong>) S1 @2 c4 A( F% v2 _
<form name='select' method='post'>
$ E5 Z6 a, V; Q# H6 ~' @<lable>Character Name</lable><br/>2 Z* x9 a& Z! [2 M. Y/ Y
<input type='text' name='char'/><br/>
4 M3 r& j0 ]. l<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/># V8 J( s( C$ `8 V  o5 ?9 c& y6 q- p
<input type='text' name='item_name'/><br/>! @- r- S% e, G) |1 y0 w
<lable>Item Amount</lable><br/>
0 M) _# J. r# ~1 `8 W7 n. R<input type='text' name='item_amount'/><br/>
/ M/ J+ k+ G2 R3 O9 \<lable>Item Upgrade Amount</lable><br/>( R4 ^* s- n* h* X
<input type='text' name='item_upgrade'/><br/>
& j8 f+ g* r0 E7 L- @) R0 I" k+ H# G<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
. Q) ^' W1 D% I! y; q4 t0 i2 K5 H+ \% c# e6 s; a
</lable><br/>
2 Z) T8 k8 R" ~4 i. E9 j<input type='text' name='item_element'/><br/>
  S8 d' F- u% y; ~+ h. N<lable>Element Upgrade Amount</lable><br/>/ k+ C" `, G. ]( W- D) \
<input type='text' name='element_upgrade'/><br/>! W  m3 f7 {. h0 E
<lable>Pierced Amount</lable><br/>
3 A0 w4 F) X8 j* y, O<input type='text' name='item_pierce'/><br/>& _  L8 [6 L4 C: _1 l$ j
<input type='submit'/>. I" F4 C4 d) L& o0 J$ o8 i
</form>";
3 B! p5 ]! y8 X+ f* j}
% C; b  `9 M2 K4 u0 {& D5 h
% z* z3 B7 D  d6 gfunction PostListener (){
/ W" ~: G# I! y% k//Add more post variables if needed and add them to initform() function aswell
8 `; @; ?2 F7 ?! z8 s' ~+ K3 D8 K+ @2 ~1 c; s. \9 ?
################################! q4 x1 n  N7 D: Y+ p+ B
##### Connection and Post ######' k$ G/ y: ^! B2 Z
################################5 X# F7 V$ O  d! ]8 U1 P
$name = @$_POST['char'];
% P7 c/ Q' [# Z, w8 ~$ItemName = @$_POST['item_name'];3 {  z! n- A) D
$ItemAmount = @$_POST['item_amount'];
6 t8 O; ~! }" `8 m" y; {$ItemId = @$_POST['item_id'];
7 q% l4 A5 E7 X0 ?  _$ItemUpgrade = @$_POST['item_upgrade'];
5 [$ |: X% v! @$ItemElement = @$_POST['item_element'];& x! w- g0 s6 C: U9 ~7 n
$ElementUpgrade = @$_POST['element_upgrade'];
# b# D3 q7 y6 t6 G$ItemPierce = @$_POST['item_pierce'];8 q$ q6 h6 a9 I+ _
################################
1 V" L8 Z) h, f5 H- c) G* m" c8 L6 s
//Check both variables for empty value# F5 q5 i: T" L( f6 Z8 i

& r' y% i8 Z- f3 v9 {if (!empty($_POST['char'])){
' l7 m# V) ~8 H$ y5 x1 [$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
- y0 G: j+ t8 z( m( A: ^$ k( b1 a& V$ s
m_szName = '{$name}'");
0 J* L: k. M) O6 W& }8 d" r7 rwhile ($row = mssql_fetch_object($find)){' `7 O, [/ z& L: Q/ k
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";. l2 x$ `, W- G% h9 T
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], ( {* ~/ ]7 y% p# w' O9 o1 C

' H6 q  p( H9 u9 ~  ^' R[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], ( P. b& w' j5 Y) o$ ^1 w7 F

. z/ U0 w" b7 y+ Z( p[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 5 i) `4 W$ B, k! |$ T9 _
* L" ?6 ~9 ^* F( @. T; w  `4 S4 S
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
5 W( P  W  W  ]2 k; Q0 \
6 t% X( j/ P) M; B% i! V; |4 Q'{$ElementUpgrade}', '{$ItemPierce}');");7 F: V, C9 x' k& c9 w8 \0 [& L
}$ Z5 M; I& B; C" c4 Q# a
# V' @/ k2 q( }; ~
}; J$ ~8 ^! F  O4 t, |  ?

8 F* h0 A1 V+ [4 I( `2 o9 J}
0 ^: x# @* O' P: E' ]" |7 X8 }$ c: ]! @, x* i( v5 r
$InitForm = InitForm();' n' k' M4 g) D' e, H6 ]: s
$Listener = PostListener();8 ^+ Z8 H6 R! z) ~" C) [: b
+ K* o8 T4 l: V. O9 h* }. w. ]
?>+ B6 K* @) i/ S9 s, q7 m0 X
: V$ B1 V& y+ N* ]% U- v+ k4 v0 X

3 N7 n2 v' M& t8 J$ t# ~5 o: U7 g; g
$ E* j+ W* \) u4 g2 t
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-23 13:03 , Processed in 0.065772 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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