飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
. a* F! g& f3 Y' i# Qfunction Connect () {) I- b3 Y" c) \, G( {2 ^6 e
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
/ I1 L+ U5 Q8 o: L! ]# X* I( a+ A( O/ K. j6 @2 j
Failed.');5 b  C$ v* Y+ p# |. F$ N
}
* T6 }+ v1 C1 h9 U$ ~1 LConnect();* O5 o; E. E1 C# {# [# @
$ j! z/ I/ V5 r% {; E
function InitForm(){
& q/ R* C  A6 n* i3 h8 {  F//layout for the form
9 n0 E0 B) l. }& n# Mecho "<strong>Send Items.</strong>: d: h$ a! P- Y7 l) m: d' ]
<form name='select' method='post'>2 G) Q, y5 }) B; _. C  q! ]
<lable>Character Name</lable><br/>
9 P/ z/ s% ?( _9 T. k/ I6 Y3 F1 M<input type='text' name='char'/><br/>
  C' {/ w8 e& I5 o<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
# y1 W' x# h0 E4 W<input type='text' name='item_name'/><br/>% j/ @8 N2 b: J  N
<lable>Item Amount</lable><br/>
) }) v2 I' {" P<input type='text' name='item_amount'/><br/>
/ m4 `3 Q- j* E/ w$ Z! l<lable>Item Upgrade Amount</lable><br/>
) H; D! o7 a7 h0 T& }- G<input type='text' name='item_upgrade'/><br/>0 I. _7 l4 I$ @% }$ `4 ^- q# ~
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
& E& M  X2 d, S& J% U7 ]& b2 a6 F4 ^1 D0 q9 D& s1 J* J( s
</lable><br/>* H6 j: `5 G1 {. h. V4 T
<input type='text' name='item_element'/><br/>0 o" J9 q8 b* D* D
<lable>Element Upgrade Amount</lable><br/>- u' u0 K. F9 ~" [$ W/ z
<input type='text' name='element_upgrade'/><br/>
( g/ C/ w" _$ D' K: r<lable>Pierced Amount</lable><br/>: \2 U) V$ \- g' B2 i1 o7 `' [5 ~. j
<input type='text' name='item_pierce'/><br/>( k1 q* i* C4 j
<input type='submit'/>
7 x+ V+ t* Y6 @. _# ]6 {, S</form>";
+ U0 Y1 n4 B- r0 y; U' I  m}
$ O1 @3 D0 ~; n/ I* Y
6 v/ |* s" d9 P* t8 pfunction PostListener (){
, [! d6 z- o* ^. @//Add more post variables if needed and add them to initform() function aswell1 V. V) t7 A: }- W+ W/ L
: r3 W/ w% M5 U% t
################################
' N. u% U/ w; M7 B2 a4 p##### Connection and Post ######+ ]5 K/ b  U) C5 a! Q9 W! V6 l
################################
, Y) R+ Z) R4 V: E  P! J7 u$name = @$_POST['char'];* u( l  T4 K: j
$ItemName = @$_POST['item_name'];: m2 Y+ M' _. [0 T5 a
$ItemAmount = @$_POST['item_amount'];
' J. |' P/ S! \$ItemId = @$_POST['item_id'];7 [3 f' F3 ~3 x# U
$ItemUpgrade = @$_POST['item_upgrade'];
! r/ o$ z: _7 u$ItemElement = @$_POST['item_element'];
9 {& ^: ?0 v; V; }4 U$ElementUpgrade = @$_POST['element_upgrade'];
) Y  L$ k) f% l9 D$ b7 N$ItemPierce = @$_POST['item_pierce'];
9 N' R9 a) J* f7 ]- c: Z5 x" L% D: G################################: z' m* B- j. `0 A
0 Y- _$ ~6 g, w% i# ^% I  z' @
//Check both variables for empty value
6 e! Q, U6 o* Y) H* _
) j, L( g" x8 P2 }( b3 m- Rif (!empty($_POST['char'])){7 @% v2 j- ]. q5 H( A% M1 D; @
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where * P" ?5 @5 A4 y9 X0 Q# I+ O
5 x4 I6 J8 [8 F& ~! `0 x
m_szName = '{$name}'");1 [$ f0 Y( E4 Y3 @8 i, Z5 Y
while ($row = mssql_fetch_object($find)){# x: j: N# `! k9 F- A( j$ m) C
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
- }. ~. x8 R2 F) ?: a5 i$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
) t8 z+ ^5 Z/ N, u. l' W- z9 \7 k/ C/ ?8 c
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 3 B: f; o3 \7 O

0 P2 ]: k. q! L& X# d8 r( p8 |[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 3 v( _$ G3 W' g

' Y% W5 c* Z  J" x( HN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', 2 U9 b% W3 J% ?& a7 G

, C3 M1 F1 j" V8 Z; r'{$ElementUpgrade}', '{$ItemPierce}');");. i0 O; @# Q0 P( x. H4 X
}
4 l& k% |5 s7 F0 K$ B* l( z3 e1 W7 \7 ]. H4 k, Q: x" x% j( Y
}8 F, H! M" e, D8 o
1 A$ O# o  c3 R0 Y# ^: m% \$ x
}* T) E, I) A* M) m. W

& g5 n3 m3 x8 `1 l1 q$InitForm = InitForm();: D' N2 Z. ^$ F# o5 e- }$ [7 J
$Listener = PostListener();& m% W  d; K: C0 P+ k

. X) }* k0 B  a8 B; v* j8 T?>5 p# L1 B2 m- t" e6 X

  P* P# I: H1 A9 O: n
% n, f% Q: _7 E! Q' Z
4 c9 F3 H- Q: k% y: X  s* d, l6 v2 j& a% }0 k2 p" {& Y) u
回复

使用道具 举报

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

本版积分规则

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

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

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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