飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1064

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1064
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php  {8 j9 C$ m8 L! @. `+ h# ]
function Connect () {
/ p& ^4 c  i( B. ]+ omssql_connect('Server','UserName','Password') or die('Error: Connection to DB
- ]( f# s7 K' a6 G$ {' V- c8 Q
4 ^& r4 e' ]) c3 W0 fFailed.');9 W5 z0 U! V  k
}
- o: Q3 \: q) E* v) T7 f1 d; qConnect();
0 h: _: ?0 a; }# e, [: x4 Z7 w$ S6 j
function InitForm(){
% n9 q0 @3 S" W8 d# s//layout for the form
  f! X9 n# J7 N: G  e+ k: Qecho "<strong>Send Items.</strong>
) F1 C9 W6 Q! d) {<form name='select' method='post'>% L8 E/ ?  e; H0 I+ }2 R
<lable>Character Name</lable><br/>7 Q6 [8 ^6 _- v8 n
<input type='text' name='char'/><br/>* W6 `' u5 l3 e  ^
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>3 c* ]" s  I" H, M
<input type='text' name='item_name'/><br/>
" _  b5 ~3 V7 s. ]9 i/ ~1 M" q! b7 S<lable>Item Amount</lable><br/>4 }5 X+ e9 n& ?9 m  W0 T. @
<input type='text' name='item_amount'/><br/>
) A% i$ ?9 x( G- f1 P  Q<lable>Item Upgrade Amount</lable><br/>  h5 ^% G! }# ?$ }8 r# C3 j
<input type='text' name='item_upgrade'/><br/>! }) E% m" U  o5 @! a4 e
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)! L/ ]& b9 V: t/ I3 [

6 _) P9 F5 K. J  g4 T</lable><br/>. V+ i& _! h( y8 d% l
<input type='text' name='item_element'/><br/>* _* C7 ]9 t, U7 w1 O0 }+ d( a; q# p
<lable>Element Upgrade Amount</lable><br/>
0 @4 @+ s, [2 Y* E<input type='text' name='element_upgrade'/><br/>8 _( q" g; f! S; v/ @% Z
<lable>Pierced Amount</lable><br/>
' O" _  S- A4 O* O9 @<input type='text' name='item_pierce'/><br/>7 q) S7 B+ m9 f* _, V
<input type='submit'/>4 `6 E4 D  U1 H% X
</form>";
2 Y* |/ Q9 L( z6 B* U}3 y1 a  c4 V7 Y$ w/ H5 P

3 \4 [( E! d  gfunction PostListener (){
) O* k1 f* p& F6 r5 ?5 l: p  d1 O//Add more post variables if needed and add them to initform() function aswell8 B3 p6 O6 J& F" x( K) j6 o

6 u1 u0 }8 Q5 f2 e2 g################################, h7 O4 v2 x0 z) ?
##### Connection and Post ######( `( n/ c: V* _8 Q( ~5 x9 R& l6 m
################################4 A5 X# k( N. ?2 U) y
$name = @$_POST['char'];
, N% E. m6 z1 I; G4 I' s& ]$ItemName = @$_POST['item_name'];4 f" y! W1 ?8 p9 j0 O
$ItemAmount = @$_POST['item_amount'];
" p, P7 D4 n- Y4 m( k# B1 B) d$ItemId = @$_POST['item_id'];
2 w4 ^* `! r8 N$ItemUpgrade = @$_POST['item_upgrade'];. c( K, C' @$ r7 w) d% w5 }( c8 c+ a8 z. p
$ItemElement = @$_POST['item_element'];7 S" t+ Q9 v1 x* }0 _
$ElementUpgrade = @$_POST['element_upgrade'];
6 d; q) B4 C" ?$ ~$ItemPierce = @$_POST['item_pierce'];
( z/ n0 q6 j9 J1 R4 A( M################################
! H2 ]3 }# B0 O
7 Q$ }0 w! O/ @  @- b4 f2 r//Check both variables for empty value  e8 u" T" e+ A, w& N5 Z
( A) h, q+ \+ C: G) j6 _
if (!empty($_POST['char'])){4 M  s. B) a$ h& E* p. W2 K* E
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
3 {  S9 \4 w1 D2 c" |% ]$ m: F% y" X6 U
m_szName = '{$name}'");0 ~7 T$ d- O, s1 e( a
while ($row = mssql_fetch_object($find)){
$ G/ z2 }3 L3 M% kecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
% D: O5 {* N/ [/ w) T$ e$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
3 M6 ]5 Q6 }: M* b0 A7 e# Q: a8 e; K  m: P
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],   N. N! Y% d3 y! v! `/ @  O7 R' `, M& V

+ U; P# K9 F9 E3 H[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', ' _" S' U: p9 R0 H9 b% o

! `% B# _) C" p, k# `* S/ C; [N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
- w' @1 U9 p! z8 ?  j
+ s, D" x7 j7 U4 F'{$ElementUpgrade}', '{$ItemPierce}');");" n, C. ]+ E3 E  \$ W5 y3 ]' B" f
}5 G; z. N1 R" m. U

* A) ^3 H: l" n7 i) j; F}
4 a, K; \, a( i/ @( r/ U2 S, Q! }7 w6 c' V1 S7 U: s2 Y
}( A. M1 s6 P+ z0 b% d+ t, l. b

8 M, i7 t$ S- @. U$InitForm = InitForm();6 I. e' k4 U! B" V7 W! s/ y* H5 C0 J
$Listener = PostListener();4 D# Y/ Q! }/ O+ X; r) |

* G7 R* g. \8 Z' q2 z( Z$ f5 t?>
) z  @0 s9 Y6 ]1 d3 n0 P0 X: l9 v* v9 S( v

4 o1 ^2 l- z2 H5 }& h# C
' w+ e/ J) ?1 @3 U/ D0 o3 }0 m3 ^7 `" W# ]0 Z) ?) B( x, [
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-7-3 16:30 , Processed in 0.066055 second(s), 30 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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