飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
<?php3 o3 J5 \  K+ K: z
function Connect () {
) |+ G( _( }8 Q1 M% W( F$ V" `4 Lmssql_connect('Server','UserName','Password') or die('Error: Connection to DB ; e' [/ d, W1 x) l2 P5 g8 @

- m( H" T8 j* {Failed.');, w, ]/ q" Q, u# _! Q
}
+ m8 d" O) \& P) qConnect();
& r- D1 E! M6 D! t: ?
# f( P, j; k1 G; g3 S! V" \5 b$ vfunction InitForm(){
3 h: q# k( G% @  C) j//layout for the form
' @& ]8 d+ D, W1 H% \/ Mecho "<strong>Send Items.</strong>
  J" T) S4 I! Z% D! Y6 L<form name='select' method='post'>  i. E8 u. S4 g( i3 _8 A" ^
<lable>Character Name</lable><br/>
5 s7 W( |/ q( q. f/ f6 U: m4 s" [<input type='text' name='char'/><br/>
' H# W' W$ a& N9 X: L# b<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>3 I4 O' `& Y8 `' r
<input type='text' name='item_name'/><br/>7 t3 \; H0 r/ |. m
<lable>Item Amount</lable><br/>
+ @7 G3 T$ K8 J" a<input type='text' name='item_amount'/><br/>
' H$ z2 G0 K# v<lable>Item Upgrade Amount</lable><br/>
; f+ f4 q, W4 [. p<input type='text' name='item_upgrade'/><br/>
9 c) h+ s: f7 J+ b4 s& E: K! T" N( B, I<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
; g8 q: v6 z. r9 }8 v7 C0 M9 W0 A- \6 \7 U9 s
</lable><br/>
- |* e0 w# s5 g: R  O<input type='text' name='item_element'/><br/>5 f$ M  F# Q& C+ J! |! ^. n0 Z
<lable>Element Upgrade Amount</lable><br/>
  d8 `& e9 ^! U) c! t% G: |2 g8 Z<input type='text' name='element_upgrade'/><br/>
8 z" k+ V5 F+ i+ e, o) J<lable>Pierced Amount</lable><br/>/ M7 G! t( R* u. b% n
<input type='text' name='item_pierce'/><br/>/ n* D+ p5 W0 t% S: Z
<input type='submit'/>  q0 Z! ]) D6 b$ n$ _
</form>";6 b3 p" N0 u5 p: z2 E* ^
}! d8 g7 J7 H6 y, Z* F+ J. d

5 B, s8 c8 |; }function PostListener (){6 Z5 w1 N2 N+ d8 M& ]: O
//Add more post variables if needed and add them to initform() function aswell! k. d3 ~. `' ?6 T3 E# o5 g

4 j) R7 {& U; T################################
9 `' w7 F$ }( A$ P& Z' {" T##### Connection and Post ######, N  {7 @: t& u& }- t6 o7 j, J
################################: z5 f. A% W  z+ A
$name = @$_POST['char'];
0 q/ p  Z) g' Y* |! t$ItemName = @$_POST['item_name'];5 I. M2 S" B3 U
$ItemAmount = @$_POST['item_amount'];3 D6 E/ J+ I# Y9 P% K+ P5 J( W1 T
$ItemId = @$_POST['item_id'];9 i: t' A* J& _  T8 ^% v  Q1 ]+ J
$ItemUpgrade = @$_POST['item_upgrade'];
5 T4 C( x+ o& x4 S$ItemElement = @$_POST['item_element'];
$ Z9 F& e0 [7 ]' R; Q$ElementUpgrade = @$_POST['element_upgrade'];( s5 k) A8 p+ T, i
$ItemPierce = @$_POST['item_pierce'];; d+ J! k" W& }
################################
7 [* x% D4 }0 X
4 J" o/ T) p) U4 f//Check both variables for empty value
- f* `3 g& D4 M8 N- E& z7 V: {8 r) ]
if (!empty($_POST['char'])){1 V+ }8 D; d  }" o. g: @
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where " E7 i6 l) N) ]' s+ @

9 Y* S! b( d# k; zm_szName = '{$name}'");' r9 N, a0 q+ j  A( j
while ($row = mssql_fetch_object($find)){, K/ J8 P# P& t) X( B. {6 R4 r
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";9 Y4 Q! Z) m3 W( |  S: j3 R- A
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], ) f$ z! C4 ~" o4 x8 ]/ r0 ?
5 k/ H3 {( B4 u+ a! `: p- z5 u2 e
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], * \% A1 G& q; C/ T1 V( ]+ A
/ b  U+ Q4 |. b3 S* w" h) F
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
9 T) Z3 c6 X3 ]. `9 X6 f" f. f$ @: {' c& j
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', 7 b& j  _$ R$ k2 |! ?

! V3 h1 M9 V4 ~- |+ d6 g'{$ElementUpgrade}', '{$ItemPierce}');");
, e* D! w) @/ q! P. O( S3 O. U9 E! Z}1 ^: a8 I. k' e( v1 X3 o+ M

5 G- r& w& [4 m, w}9 z- x6 x9 I) v4 n4 @- J' i4 y" O
, X! F2 @" i- {: U
}: w2 Z7 y0 m* L8 N2 f
7 ^! r. X) l  d4 ~9 `* M% y0 W
$InitForm = InitForm();* j/ [! B1 V2 F) i4 S6 l
$Listener = PostListener();# v! p+ w  l* g, ~  [
  z, ]: J: x+ E+ d8 x# }/ @+ U
?>) b  I  ^% U: [
; b1 |" ^5 H% d2 y1 C3 w

, X) N* o! p* J# E2 [
6 N8 F. y+ x" N
# _/ F' i+ Q" p0 q& h8 h
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-17 07:57 , Processed in 0.067130 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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