飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1064

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1064
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php/ g; Y: M0 U! l6 l0 ?- ^8 Y5 b
function Connect () {( R$ D! M! P5 h1 R+ ]$ ^+ ?' F
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB : g2 G* ^6 E2 [8 `: ]
" H7 T, j* N+ P+ q+ I/ p
Failed.');
+ X- s- o9 w2 J4 h}0 O/ e) \+ k' M& I' L, L3 r, q
Connect();( W$ ?& k9 d" S, i8 ?- O

7 g. N- z3 k* j# Gfunction InitForm(){
+ q! l8 _* x. _//layout for the form3 z3 d: J, y' Z& Y1 |, T
echo "<strong>Send Items.</strong>/ x8 v4 d, b& h- n9 f. }
<form name='select' method='post'>* w( M1 k* R5 Y* Y0 u
<lable>Character Name</lable><br/>
. l. w& ]3 R2 W* [. y* w<input type='text' name='char'/><br/>: L8 F1 l+ Q0 M# X9 `% H8 ^
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
& W# y' S" @0 t7 p0 x<input type='text' name='item_name'/><br/>
- P' s: h  C1 s# M' r<lable>Item Amount</lable><br/># D* X* q7 i6 k$ l
<input type='text' name='item_amount'/><br/>
, o) n* g3 s( o8 J+ b<lable>Item Upgrade Amount</lable><br/>
# a' Y' J, N4 G& w, n" f( Z<input type='text' name='item_upgrade'/><br/>6 d4 B1 }! ]" W) P  I
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
- Z$ C# o, K2 @/ P8 @; s1 d. K% d2 y
</lable><br/>/ T/ t5 Y/ D- d, E
<input type='text' name='item_element'/><br/>
2 `3 Z) }+ }8 g; {' M4 d: t' d<lable>Element Upgrade Amount</lable><br/>, v" v* A5 t  W
<input type='text' name='element_upgrade'/><br/>  t* i! {: ~2 A! E' l- r
<lable>Pierced Amount</lable><br/>" j% L, r3 j3 A: S) l
<input type='text' name='item_pierce'/><br/>
8 C- L8 l5 w0 a% X8 T) i* ^# y<input type='submit'/>2 D+ _5 k- n4 `' r( K
</form>";* o1 M4 H0 U$ \
}1 V3 e9 u  ~9 f* d9 d2 f8 C# R

) O9 q! d6 b" ?8 Yfunction PostListener (){5 m7 H4 `7 m8 g, E4 [3 \+ f& \3 L
//Add more post variables if needed and add them to initform() function aswell2 Z+ R& g% G: B6 f* X* J9 V

: T" d8 \8 i! M) j################################
3 z4 ?# w+ T" @+ V; ?##### Connection and Post ######- t* d7 R+ c" x. ?: u
################################4 U& E9 O8 J7 d; Y
$name = @$_POST['char'];
7 A6 D# l  r4 a. K8 o- [$ItemName = @$_POST['item_name'];' G6 R3 g! \9 p; P: W; B
$ItemAmount = @$_POST['item_amount'];
: g1 C; I/ |+ \$ItemId = @$_POST['item_id'];' {6 I, _1 l* ?
$ItemUpgrade = @$_POST['item_upgrade'];3 `' D* C5 U/ W
$ItemElement = @$_POST['item_element'];
6 x$ \( Z3 n; d+ O$ElementUpgrade = @$_POST['element_upgrade'];0 c; E) w2 }( W% p  ]1 G
$ItemPierce = @$_POST['item_pierce'];
! f3 v+ U5 y; R; ]! L/ l9 W4 u################################! U, p% f" o" E% `, h$ z! ?
! J( d9 J' M  U$ l& ?
//Check both variables for empty value
' C7 J* m: |5 [: }/ G' O) P- I5 n# Q' w) U. `" J
if (!empty($_POST['char'])){
- h) O- x" _/ M6 i  Z; J1 t/ i7 W0 R$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where 1 x+ y6 s4 M) i5 k# g% e0 r
; K' m9 T5 u" j# B* P$ I
m_szName = '{$name}'");  S# w) j+ J. S5 W5 h
while ($row = mssql_fetch_object($find)){! J5 ~& _1 k* p& {
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
8 [: q! z6 p. L, ?5 l4 ^$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], : R( R. \0 v# [) m- S0 J4 G' x/ p

& j/ \7 {# ^( L+ d[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 6 b: f( s' ~6 H) e; d
% D. r/ X5 C) X+ I
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
4 {, z, I9 B9 N4 d: @5 P% ]# _- ?& n, h8 P1 H4 A
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
9 p! X! z# j8 A: v- N
6 g: l- w) V/ _9 w* B! l'{$ElementUpgrade}', '{$ItemPierce}');");8 d5 z. W7 x) f$ C0 X& O' ~
}5 o* t) t4 A- x0 Z

  {' L: W8 |/ w0 {}% x' S9 c0 h+ [, d; R

# L9 Y  Q# y5 |}2 P5 ^# e! C$ C) r" x
- Y, K: C9 G+ \9 p
$InitForm = InitForm();
9 o6 e* P( n& R! |$Listener = PostListener();- W$ a! j" U: W4 b

  s8 T8 P: }7 ^2 T1 x" j' `# X: O& F) I4 Q?>' r, C/ c( n, b  c. d+ T) ^
$ j- ?' ~) u5 m3 R* h
, @& `* `7 P5 V1 r5 A+ u( G
; n; c# w) p" N3 _1 m9 I4 b

5 I* H- A+ C5 P- u
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-6-16 18:59 , Processed in 0.058418 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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