飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1090

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1090
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php/ d) L  N0 w2 y5 b8 N7 q
function Connect () {
- Q3 s1 r7 W9 Y' Z5 m% R/ ~mssql_connect('Server','UserName','Password') or die('Error: Connection to DB 0 h" u! C1 j, B3 c

/ `% B+ P+ X# w/ G; M* X: rFailed.');
: h* E5 W1 l4 ]$ Q7 o}# b, u( L8 J3 ?+ ]! C) t; G; v
Connect();; g7 C! }! N6 J, I. o% z7 u7 M
% |2 R1 G" d, k& c
function InitForm(){4 h/ D8 c, w. `7 J1 I
//layout for the form
$ U, I) @0 J! k0 T" H  iecho "<strong>Send Items.</strong>3 j) y7 m3 j# z" d: ?
<form name='select' method='post'>8 k6 q, [  Y; R
<lable>Character Name</lable><br/>
7 Z* x7 `5 B3 c( [<input type='text' name='char'/><br/>' P3 U2 W5 W+ Q6 Q- u' y% S6 t
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>8 J, g% U2 v1 e* \3 P
<input type='text' name='item_name'/><br/>
0 j" f* j9 y  Q% V<lable>Item Amount</lable><br/>; z# }. r: E! ?9 Y3 A: q* t7 D
<input type='text' name='item_amount'/><br/>- K. W; B: Z$ G; y3 p
<lable>Item Upgrade Amount</lable><br/>. H0 X- n; `8 A) M
<input type='text' name='item_upgrade'/><br/>
6 F9 {  _$ p, _. S* [  Y1 Y6 Z/ b3 X<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)/ I3 [; U! l0 ~
' c! a  Q! _& r
</lable><br/>9 e. Z5 ^" s* T" b$ Y1 v
<input type='text' name='item_element'/><br/>
; t# Q# I- X" B* ?" s+ i<lable>Element Upgrade Amount</lable><br/>
$ M3 v! \* F6 }<input type='text' name='element_upgrade'/><br/>
- ?8 W) o; Y# \" ]/ o+ y. [3 r<lable>Pierced Amount</lable><br/>
& i6 X- B: c7 G( r5 ]  Y<input type='text' name='item_pierce'/><br/>
+ T$ H# F, q( g$ @4 |6 E<input type='submit'/>, n9 f! V; R$ i) F7 |% B. Z( [
</form>";& e# B4 ~( J* z; K- e. J
}" p" h$ [5 ~. H! }
. V& Q4 D! Y' K
function PostListener (){& U/ o+ [& n9 U# \5 k
//Add more post variables if needed and add them to initform() function aswell6 Z8 Z8 M6 s6 [
/ r/ N+ x+ C8 ]6 N. F) v( {
################################
( F& n3 F; e1 b$ a$ z. P# I/ t##### Connection and Post ######
8 J! i- |7 j# {+ y5 V5 g################################
# N# l$ m( Y8 [) y( H- M1 M# o$name = @$_POST['char'];! u% R4 @  W& p) M& i. G
$ItemName = @$_POST['item_name'];3 M$ C5 t# ]( @/ w
$ItemAmount = @$_POST['item_amount'];
1 W' |9 X9 Z+ a# j: s1 p0 a$ItemId = @$_POST['item_id'];
1 x9 t0 |( O  |% I) \+ N$ItemUpgrade = @$_POST['item_upgrade'];
1 O6 f! z# g0 A' U$ItemElement = @$_POST['item_element'];7 a! m& w" J' y6 ~( @8 |
$ElementUpgrade = @$_POST['element_upgrade'];
$ D8 [3 |( ^! t) k( B' U$ItemPierce = @$_POST['item_pierce'];- ^$ v4 F- o' P* N* a8 M5 r
################################
- P( Y# e! B! [/ H  ^* k
0 h3 B* L$ t  b2 c) e) X( ~' Q//Check both variables for empty value2 }$ b0 l) s% [
# B& A8 W1 o) H3 D  M3 z9 S0 _
if (!empty($_POST['char'])){3 @( o+ O  ]3 `! |3 X2 j- i
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
( g, [9 C4 B" H6 g! ?/ _9 P% P) G. I8 |9 w3 \' L
m_szName = '{$name}'");* ?' D! S7 d7 h* d+ N
while ($row = mssql_fetch_object($find)){
! p- d: C2 v# d8 ~echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
* R9 s  G$ H$ n# S+ ~( ^! e6 |: j$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
) m) w2 r6 P2 s: M) H, k# i& E9 p. l4 e  b9 w; D
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
6 l1 U: ]4 _1 H" S9 G9 |/ s( z6 }  c8 V; G$ s1 z5 h  t7 Z
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 8 {/ ~! i$ F8 l( R/ x& W5 p8 R; b# ?1 M
8 i+ p/ s2 S3 T; r! @; m+ c
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
4 y$ f  ?/ x7 [) U0 r" j; N$ ?: k; l) t& P3 y
'{$ElementUpgrade}', '{$ItemPierce}');");
& \' c' E7 z- G& l}
9 h0 D& E7 E- y/ V/ I" o
" Y' E3 K/ d' x% ?}
1 m7 |# a) V) [0 s3 n* `
6 Y, o2 o7 @8 j0 ^# r' }}7 R2 y7 D4 f5 ^  Y" g
" ]2 {! C' X4 x" A) F& ^- p
$InitForm = InitForm();
! @, \# C2 L- j" G+ X7 s$Listener = PostListener();* C' C" v- E7 _1 }" s( O- K& K; A5 \
" u& Q- r' J9 o  P: q
?>
! v6 j# w8 w" V9 z( Z7 m' m% o! A* F" W7 y5 r) M5 Q
! g0 U4 I% J; |; l7 w

+ R& Q8 r# Y! B& e& O* Q$ j0 _. F' M8 J! L
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-26 06:13 , Processed in 0.060945 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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