飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php& t7 f" N5 l" |! i2 S9 o6 u) p
function Connect () {) H  Z2 H: H- H: _& _
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
& z$ l5 l% ~' G- T! H3 |' R+ d. ^; \  L- \4 M9 f
Failed.');3 I3 J* l! T# ]$ n
}
1 D9 A* D/ R: L3 Z1 KConnect();8 O5 D. F0 p' q# Z
' t! x. S, p) N7 M2 @! \
function InitForm(){: |! d+ x1 \* |! ]& V# g
//layout for the form
9 S0 J1 g/ l; a# b* P2 qecho "<strong>Send Items.</strong>  E" X4 h  I. ?
<form name='select' method='post'>
, F4 S, d4 y, J; [<lable>Character Name</lable><br/>
! R3 x( M* K, P8 T( u. x$ g6 L: \<input type='text' name='char'/><br/>2 K, r; p; E8 L. e
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
6 e' w; T- H7 O<input type='text' name='item_name'/><br/>: }) }8 U3 Y; `$ Y1 z
<lable>Item Amount</lable><br/>  ~! {- k! T9 [. ^8 Y3 I3 Z, k! b
<input type='text' name='item_amount'/><br/>& p. K) d# Q. C. w+ ]
<lable>Item Upgrade Amount</lable><br/># }3 D" M) g* S: c/ t& }
<input type='text' name='item_upgrade'/><br/>( x( C, \3 H  |. f1 E
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
7 i, H& Q: g% T* [9 k# o2 _( |! I/ t; I& ]$ f) I
</lable><br/>* J, A: t; Y" a" k6 Y/ y1 h
<input type='text' name='item_element'/><br/>
0 ~/ U- W# m/ {<lable>Element Upgrade Amount</lable><br/>
5 b* s/ T2 l: c<input type='text' name='element_upgrade'/><br/>$ W1 Q( C9 ]' l1 \, ?3 {: T
<lable>Pierced Amount</lable><br/>
3 d+ O, T, i9 m6 ]6 X<input type='text' name='item_pierce'/><br/>
$ _1 [) ^6 p1 z, a# N6 A+ o' T<input type='submit'/>
" l/ v7 f3 V0 H2 y% @8 E</form>";9 i; i& I! F+ E
}% x  U, w- D3 z- [  q( u& ^8 M& V2 U& a

! V. n( ^1 ?4 |2 X$ e% Z+ c6 tfunction PostListener (){
/ J: q. B( z, _% T//Add more post variables if needed and add them to initform() function aswell
2 X0 X) t! x0 h3 o6 R. L* A% r7 f2 j9 I9 a+ z- \
################################
! J9 b8 D' U# V# m##### Connection and Post ######- [" U* ?$ S9 Q4 {5 y, c/ L- J
################################
+ ^" C: o% j+ k& `6 p$name = @$_POST['char'];
$ B" b9 [# C# e" ~" }! F9 @' y7 @$ItemName = @$_POST['item_name'];
7 A' c2 k1 i1 W3 }/ [$ItemAmount = @$_POST['item_amount'];
+ @8 z# B) p) D1 F1 V# l$ItemId = @$_POST['item_id'];! k  V# y$ Q7 @+ |% ]
$ItemUpgrade = @$_POST['item_upgrade'];/ y. B1 p) p! O: s  Z2 K
$ItemElement = @$_POST['item_element'];! M2 \7 L) g* b+ o6 l, I: t( f
$ElementUpgrade = @$_POST['element_upgrade'];8 c0 Y5 k' r" `# w  p
$ItemPierce = @$_POST['item_pierce'];) B  v1 |" K; {, t1 N) A
################################2 N& `1 H9 |( P- P
  y6 s! T# B$ ^8 u
//Check both variables for empty value- _3 O! [0 l* d
- U1 X7 u: H' M; q/ m
if (!empty($_POST['char'])){
4 A0 d, x% Z" l7 n# a4 I7 f0 P$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
) u! H; H, q5 D' L
3 C( p& m! F% r, [8 ^. a( pm_szName = '{$name}'");
9 a. [: L. T6 m& t( bwhile ($row = mssql_fetch_object($find)){5 d2 [- |! [; z$ l; v
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
1 m! S6 M1 e! r$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], % A8 U" |& s- |7 W& \  C
/ t: K( x" o2 ?" J, D5 P" K+ _
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 1 x7 D; q. l. x6 m4 a' A. w. e

* d, Q4 R9 N. R" E0 Z[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', ( Y% s/ f1 s' g+ `. d5 L

& [9 E9 @3 f2 J/ z# Z$ g, _' j0 }N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', 0 s: o+ d7 e( f9 g7 z2 e  s3 B5 L: f( ]

( y; f, p4 }! J4 l1 g- j" |'{$ElementUpgrade}', '{$ItemPierce}');");
% J+ P" z# H8 y# L- q! x}4 b2 V' E+ d' q0 e7 |+ y$ P% z# Y( v

# m( O+ c0 q8 e6 ?+ o}
/ ^6 N# @9 b. C' f# F- u7 w8 W- Z! U+ K
}
5 F# R/ w' p4 h, U( m) j& F: R. J( H5 P8 q$ ?( j% n/ V
$InitForm = InitForm();
6 T9 P2 d1 E- _; b$Listener = PostListener();* b( z, z0 l! K8 B4 Z

! |5 d, y# X2 j& o8 e7 ~: Y0 W?>, w$ [+ E  @9 y3 I5 e6 {* T
+ g* r3 Y& T. c& s  _, m( N: ~: v

5 ~1 A, z% s: o% W2 z  G. E
# I+ {7 o8 N5 J, T0 r/ ]# ~, h/ b1 e! @- `" N: u
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-8 16:04 , Processed in 0.061067 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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