飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php8 q5 \# x" Z0 \& g1 t
function Connect () {% r$ S* u0 j3 Z6 j4 b4 W# }3 y
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB ; x, L5 ^" R& d& G7 T! F6 L
8 M/ W; S# {- x' J+ k
Failed.');
! x* f/ W, d3 O! G}
% z2 ]5 J/ s3 a; q, }Connect();4 w# [  E1 u! N* y+ `- P2 w- x9 M

# r* j7 {& o6 \0 b2 \- a4 [function InitForm(){
' }5 F7 L+ X+ n//layout for the form
4 i" s7 L! P# `8 \, E2 I$ V  _$ p' Hecho "<strong>Send Items.</strong>0 H5 P8 U! B% w) `/ l
<form name='select' method='post'>7 |! s! ~# ]6 R1 U
<lable>Character Name</lable><br/>
7 S- h8 i* U+ y- b1 c<input type='text' name='char'/><br/>0 j% y& ]# \3 u% S( A8 ~! {
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
5 K7 |6 B' f- L7 C- _2 x- [% ?! `<input type='text' name='item_name'/><br/>( ]% i, e3 q' O2 |
<lable>Item Amount</lable><br/>& O( s; T; e: X4 \. L2 _
<input type='text' name='item_amount'/><br/>
0 t. J. _8 T1 y6 a, R<lable>Item Upgrade Amount</lable><br/>& Y# ?' F% K4 G& H; `, m) v
<input type='text' name='item_upgrade'/><br/>
/ ~7 A/ A% d3 I0 ^; c<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)) k' e7 R- M4 d# F5 I7 k

+ @0 }% ]; b0 v</lable><br/>
: _8 g! n& ], i  `8 c* ?<input type='text' name='item_element'/><br/>; a/ M6 N' T, N+ \% `+ i
<lable>Element Upgrade Amount</lable><br/>" C! S. U0 `' D( K
<input type='text' name='element_upgrade'/><br/>
* ^8 J) x' Y+ E8 Y9 f& O5 q<lable>Pierced Amount</lable><br/>
! e. b- ^3 k; i& F<input type='text' name='item_pierce'/><br/>
# w8 j( I% t* @; i% L0 I5 s<input type='submit'/>: m' S& d% }. ^% z
</form>";) w8 r; W0 u7 c: Y/ _8 U
}/ O( G$ x1 b# h' [9 Y. f" D, z: [
( Q$ h8 Y* z4 U# M! z2 o
function PostListener (){
8 L0 G6 C7 w4 C3 V+ @//Add more post variables if needed and add them to initform() function aswell: H: L( p! S6 Y3 e7 q
5 X$ {( H6 s; q6 q. w8 H: q
################################
2 ^0 ?# ?8 E0 k7 R9 Q##### Connection and Post ######
0 Q# M" Z0 i+ h/ A################################
# @1 R! t- ~/ d5 t1 I$name = @$_POST['char'];" X) s" |) s/ }: `1 \3 s
$ItemName = @$_POST['item_name'];: V( L7 `4 A% V
$ItemAmount = @$_POST['item_amount'];$ D, K  f4 k% T5 {$ v
$ItemId = @$_POST['item_id'];4 w6 y1 I2 }! ?( a& T
$ItemUpgrade = @$_POST['item_upgrade'];: y" t9 P/ E1 X+ k
$ItemElement = @$_POST['item_element'];$ y! \& M) g; S& X# [8 o4 e
$ElementUpgrade = @$_POST['element_upgrade'];
4 B$ k  b1 I/ B) q9 M( F$ItemPierce = @$_POST['item_pierce'];
. v2 y: Q- o  E8 p( Y5 x. ^################################
: h& G7 [$ J' n- M: R7 J$ n6 D8 y; ?3 [$ z+ B
//Check both variables for empty value3 ^9 F! |" H) t6 S' `# O

! l' K, g( J3 g: S6 B' B: d. G/ t* uif (!empty($_POST['char'])){
. h5 q+ p. b+ Q! e$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
/ [0 n: Z4 @+ H& Q$ i7 ^* ~/ ^3 i* U+ F% h% ^
m_szName = '{$name}'");
! Y$ z7 |9 Q2 L' @) swhile ($row = mssql_fetch_object($find)){
, `  ^) X% |: V- Gecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
+ [* Q; O7 o8 ?% F0 S$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
+ r/ e6 M! d( ?" w5 ^
! P0 B; D" u1 S# W& G( d/ H[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], / s+ S6 }' o) C; G* L3 w  `! ?

' @. h: |1 I! [+ n- r[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
# k+ v! J( w7 X  k3 W9 B! s9 }8 x3 ~: N0 p) M- k8 X/ ~
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', - R  K! b* F* [+ F6 o  ?% X

* G/ k0 {! G; ?'{$ElementUpgrade}', '{$ItemPierce}');");9 _: Q& w* N1 ~" f( Q. l, L5 Z7 Y1 f
}
) M9 A8 Z: N' M9 p& ^# K7 n. \
/ r) \) O+ u7 i/ W" I}
; U1 `, `5 N/ ?% ?0 `3 L0 P1 v# ?! c$ X. G" P& F  d& Z! z
}% |5 H- ]$ v, l! |! F; v
$ H6 M0 V' Z/ h) c5 m4 q
$InitForm = InitForm();" r* |3 t8 U4 w
$Listener = PostListener();
" U9 f5 y: J/ e0 E7 J* u* C* Z  j& o+ `! j0 m
?>
1 t( ?" `7 E! J8 k- V" a6 l- `7 o: N# V& `  A, }( e
3 E! _* @) D1 H4 H- S
( d: u6 N: p* N1 s8 P" s

- C) p* V& `9 M
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-29 08:12 , Processed in 0.066322 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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