飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php! _/ T/ x) |; D* P0 B
function Connect () {6 N/ v; L# t1 k* m0 c' }
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB . L% f3 S/ d0 N$ Z6 d) I$ h
# A' j5 O; a3 s0 d
Failed.');2 }- C( m, L! b* V8 E* D0 k& e
}
& \0 |- m% X+ j1 A1 G# s9 mConnect();
9 l! X  F+ h9 o  h3 P
7 ?6 I- k0 i' bfunction InitForm(){- A. X. B) \! b. y
//layout for the form
8 z5 l: B7 X9 H6 a. ^4 E6 N  Mecho "<strong>Send Items.</strong>' n. ~3 D# }: q1 z) i) `) ]& p( Q7 J
<form name='select' method='post'>
+ q  e/ _9 O/ ?* R9 D( E" l5 X<lable>Character Name</lable><br/>9 \5 I4 f! `. g( F+ _* y
<input type='text' name='char'/><br/>* \3 b4 u0 z3 Q& i. c! k
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>6 I0 s2 u6 x- |, x% [1 C
<input type='text' name='item_name'/><br/>
1 y# J2 d- l. ]! m<lable>Item Amount</lable><br/>$ t1 d3 [$ A, A. P+ C) K
<input type='text' name='item_amount'/><br/>  N8 c, X6 M2 ?! K& y/ }3 j
<lable>Item Upgrade Amount</lable><br/>
- V( V/ R: \9 E. w<input type='text' name='item_upgrade'/><br/>/ S9 B" V9 O' W" \0 T. I" R
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
& U1 e5 E; r. n3 H; Y' v" ^+ y( i) x5 F7 H0 t
</lable><br/>' s/ D  q( S1 h) J1 c2 t
<input type='text' name='item_element'/><br/>9 [- ~8 B" S& ?8 v1 l
<lable>Element Upgrade Amount</lable><br/>: G( H4 r) S' h, Y
<input type='text' name='element_upgrade'/><br/>! Z: E7 w+ T) N2 E4 H# c1 o( h
<lable>Pierced Amount</lable><br/>* {8 Y* f6 @! |6 p* ^5 p/ ]
<input type='text' name='item_pierce'/><br/>
$ v" u; F- q0 U& h6 y4 X# Z7 `1 C2 s<input type='submit'/>: C8 k# ~& ^) R
</form>";
$ {$ _: @" O% A6 O  M) V}
8 W  I/ F3 f& V. v# {" d. C( n/ Q# y* n: a3 P4 d% m, [
function PostListener (){
$ @4 {/ z4 V7 S: V/ Q4 ^//Add more post variables if needed and add them to initform() function aswell0 N/ ]  t6 r  _+ H0 H
' @7 v$ e! P+ H- o. y0 \
################################" s0 T& C; T5 S% e5 M% w1 D! \
##### Connection and Post ######
0 p! \) m  Z& [2 ]################################
: g. I! C: c6 l! B- i6 h4 n+ ]1 _$name = @$_POST['char'];0 t+ U1 {2 U( H, O
$ItemName = @$_POST['item_name'];
) a, m9 a6 t' {( f! L) h$ItemAmount = @$_POST['item_amount'];- _8 x9 f; n, e' n, b* K5 a
$ItemId = @$_POST['item_id'];% w- u8 B9 \6 e2 D' I: v: }
$ItemUpgrade = @$_POST['item_upgrade'];
4 f1 `; N: I4 G( i$ItemElement = @$_POST['item_element'];
8 b# o# {1 f2 ]# W$ElementUpgrade = @$_POST['element_upgrade'];4 J6 t1 o' J6 C8 f/ m
$ItemPierce = @$_POST['item_pierce'];
3 v# _9 ?" k# ~+ S& f' R################################' `/ J+ Z2 |- V
3 O0 |3 S" C% Y( B6 _. F3 c
//Check both variables for empty value4 W$ B; z8 X. _1 S7 E3 p. |3 `

% m4 u9 j9 w& }' jif (!empty($_POST['char'])){. t# |+ f4 q+ x4 [2 L- z" B1 H$ l
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
0 a, x" i; N! c1 A8 M) _
6 @3 G# t' l8 sm_szName = '{$name}'");
1 `* f8 O# i) y* B' _4 _while ($row = mssql_fetch_object($find)){7 R' y/ X! i9 E. u" r+ _8 X& }
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
$ j1 N' }( w* d( s' s$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 4 S6 B0 d: t: n) c
1 Z' O( r, i) I
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
, E+ j5 x  ^6 j( m2 t0 x7 {7 U  R$ ~" K+ `% w$ D/ ]4 t
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
' i, c' u  }, e9 p; D$ X7 V+ F0 E6 q2 P, Y
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', ; u6 W5 N% s4 A$ V

+ a4 D5 E# w2 F3 f  x'{$ElementUpgrade}', '{$ItemPierce}');");
# L% t- R: O" \; w0 A9 }+ X9 h}( b* X2 A- a, _

* u. n& c7 d! @+ }* m( R- p}+ x, l* G9 g9 M) V! a" p0 k( x1 m
2 t6 j* n# w+ x9 z- l; B, r- J
}
# k- X) V, R$ J& M
6 c7 o9 V) @- t5 |6 L& _. m, l- I$InitForm = InitForm();) j* e" F" J6 J6 u; n* ?
$Listener = PostListener();+ q; m+ c9 I. k  V
9 _1 E4 I7 W# o- p9 P1 N' N( [
?>4 `1 n  A" w5 x% L) G, E
9 R& @( Q0 t1 z* c4 X
) l' r# o) Z# W  l; Q
; a: Q, L" L% }2 s7 g

& \# X. S5 N5 g6 J! [& _* G
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-24 11:18 , Processed in 0.060353 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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