飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php3 a% `) p2 Y  e6 F
function Connect () {
) W+ z9 w6 [$ R4 {9 tmssql_connect('Server','UserName','Password') or die('Error: Connection to DB
; E9 m0 z; K9 `6 ?( e# o
! A! ?1 m" q0 W; LFailed.');- _5 t/ X4 V5 L+ t( B) @
}
# |7 T( Q; H. J' @Connect();
& K# `( e8 |& k, }+ [
# ?) G/ [$ I" Cfunction InitForm(){! g9 ]) g& l  a% @1 Q
//layout for the form. T: s  k. Y# J" v( @  S
echo "<strong>Send Items.</strong>. f/ ^+ E) j! G3 |' S
<form name='select' method='post'># ], C5 `5 K7 j) O9 S& I" g/ u
<lable>Character Name</lable><br/>
' q+ [+ }" w0 d3 I* ?<input type='text' name='char'/><br/>
  @% d; `/ f% q6 f<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>! k3 P: @# u$ _# H- A
<input type='text' name='item_name'/><br/>5 A' B& P2 k, L) C
<lable>Item Amount</lable><br/>
& x( n4 _1 z8 s+ o: Z7 P% A<input type='text' name='item_amount'/><br/>0 R+ ^' R5 e+ Q; `! T3 [, t  s
<lable>Item Upgrade Amount</lable><br/>9 L  |% Z' s( j# m) M: o7 h
<input type='text' name='item_upgrade'/><br/>5 t1 Q5 B9 R- w! r/ x; ?3 b( \
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
0 d9 j: |  O" H1 ~, J
, |- f8 y5 |: z</lable><br/>
1 z( R* |8 e9 j1 j% }3 R<input type='text' name='item_element'/><br/>" }! Q, x( M" N7 H
<lable>Element Upgrade Amount</lable><br/>
' K; ?8 ?3 A# `5 p" G<input type='text' name='element_upgrade'/><br/>4 R8 e- Q+ h: M& c4 e# b  f8 f
<lable>Pierced Amount</lable><br/>/ l8 z: |4 B+ Z# [% \
<input type='text' name='item_pierce'/><br/>" I" m% I# Q+ V7 w6 [( j
<input type='submit'/>3 J. O: m  D8 z( `4 X
</form>";
2 I0 B4 ]8 \. E: w6 G) r! X6 W& H}
! _) S+ S6 U2 W9 G, x3 L
* g& f. z1 l& v3 U5 dfunction PostListener (){8 X) J6 j4 W5 [: q4 n
//Add more post variables if needed and add them to initform() function aswell/ s) m1 ~& r! j" ^% T' i" M. T
( O! j, b% I1 X  q. L3 f
################################$ `& J, A8 K8 U' f  [
##### Connection and Post ######
0 ~& c+ [0 C4 |2 |% @. `################################
7 F3 G: w# T, X: Y  J4 J* P$name = @$_POST['char'];& f( e3 B6 f; T- B2 a. D, R/ }
$ItemName = @$_POST['item_name'];
1 R5 r- _7 Y" n* ?5 a4 \" _5 a2 r$ItemAmount = @$_POST['item_amount'];
) ?7 g0 B* z+ i' F2 y% q* J$ItemId = @$_POST['item_id'];
' W- \1 I1 `' e% ?$ g$ItemUpgrade = @$_POST['item_upgrade'];9 t* v; A& x  Z% k
$ItemElement = @$_POST['item_element'];7 E3 _# ?/ [6 i  @
$ElementUpgrade = @$_POST['element_upgrade'];
7 q- W: A) C/ ]/ Q& @. y; Q$ItemPierce = @$_POST['item_pierce'];
$ t  F0 N: [* e! }: H% V" e################################& t/ K0 j7 `1 {# h
- P% B+ Q! U1 Y( W
//Check both variables for empty value
. W' N& O7 ~1 E8 z/ b" m8 T9 `
/ N' U4 @- J5 T2 |9 r1 L9 Vif (!empty($_POST['char'])){% b4 @/ [6 r6 Z6 b& t# Y
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where + b- J# I: x: r/ C
6 e" m' e2 N8 @4 W. l. ?  \& I
m_szName = '{$name}'");
2 n& ?, d& e/ |2 g" w% gwhile ($row = mssql_fetch_object($find)){
7 T! s7 W) ?0 b4 ?0 vecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";8 J' [% f2 K; I0 g7 D$ e  F
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], - P7 J$ t! u: M
. H8 ^/ |) V8 ?$ E9 ]  n% U
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 7 ]  n/ j1 c; L
8 @& Q* ^7 m; m) o# n' Y7 M# m
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 4 `% h  [+ ^* e( x' _& l. ]

$ d& |# u/ d; g1 XN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', # u. e; T* }  k, F3 x
4 r; {! |" z* J  P# Q9 ^: f
'{$ElementUpgrade}', '{$ItemPierce}');");  u$ S6 e9 y1 h- }* B
}
3 e1 g, u! F3 b$ E  b" }& B- |+ s% I, Q( T- t' d' F" _
}
5 |) R- [* X$ S$ E. U$ S4 D9 h7 [, \5 T; c% t
}! Z( h5 n! f, r5 b  A2 Z0 @
) _, I" v( h4 u2 K
$InitForm = InitForm();9 ]4 \" x* s/ |! ?
$Listener = PostListener();% A3 |5 S; l' x  V

1 z/ d& k" V- C5 ]  q+ O?>, X1 p' M6 |" S# B& o- B4 A, H3 i
8 b6 t9 Z8 M6 d( C/ a
" f: {0 t, |; A- x/ o9 H
5 d5 l7 c. |1 ^

( O$ j2 _& x8 Z9 Q# h0 H. q+ _
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-21 16:56 , Processed in 0.064297 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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