飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php6 [4 V8 T: Z. e1 e/ O; `0 p
function Connect () {! t0 N( U/ I. J5 [3 E8 {4 K4 \
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB 3 M0 D" x  m; v0 K

$ I* R( i# o5 [$ K& J) X# w0 D+ S; PFailed.');; l. \) Q3 k0 ?, W: ^' b
}
) O! w! Y6 @+ E3 w' _4 CConnect();6 V5 f) N" i* L1 C; a, X
3 k! R7 k( j/ J3 O+ H
function InitForm(){( C# z/ [; C7 N2 W5 q4 z$ [
//layout for the form8 r- ^4 h# f  i( C3 x
echo "<strong>Send Items.</strong>
# O5 n4 D; {8 B1 x0 S<form name='select' method='post'>
9 y% K. V- }6 t; A4 n<lable>Character Name</lable><br/>
3 n6 Y8 b. }" Y- |2 {% W/ @* {<input type='text' name='char'/><br/>% y$ s" \. U! N
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
) [& S3 H) r! j& |, b6 Y2 w; n<input type='text' name='item_name'/><br/>
: C- e+ ]$ t! c. N5 ?<lable>Item Amount</lable><br/>
/ H0 h7 ?  |7 ?& I9 Y<input type='text' name='item_amount'/><br/>
$ a) ?$ ?% t& W<lable>Item Upgrade Amount</lable><br/>' ^/ j& G- N$ `  [& A
<input type='text' name='item_upgrade'/><br/>1 }# \* f$ z3 U* }
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
2 t& }9 Z; z" d1 Q' B5 i8 O5 L# d* l# q3 m! g7 L
</lable><br/>" a# _+ U9 S- e4 |' j. Z0 T$ z  Y
<input type='text' name='item_element'/><br/>
4 Q7 t: }( v8 }# B6 _) j8 ?8 f<lable>Element Upgrade Amount</lable><br/>4 T0 e- V4 z- q2 W3 {2 A' A! B# J8 p# O
<input type='text' name='element_upgrade'/><br/>
2 j$ C) |# j5 N7 q- H3 P<lable>Pierced Amount</lable><br/>) @$ d3 h: {# y) ?' X
<input type='text' name='item_pierce'/><br/>  m2 }2 b$ D" l+ U; t; P) I
<input type='submit'/>
+ {3 P+ }! K3 B</form>";
. X' T2 o/ H9 i6 U# [% M% j# ]6 X}
+ a' v' A" t! P/ e
) {- S6 E4 }  J' P6 J& Y! vfunction PostListener (){) r. ~) Y5 `6 l' r4 [# W' B' y9 q
//Add more post variables if needed and add them to initform() function aswell/ h" w( ]+ M9 a  g; U) F( d

4 V/ f& q  _$ u6 i+ e0 y################################
0 f! H% `! F) h/ I0 x##### Connection and Post ######
7 z1 t( X0 {! R& s+ {( [################################
" f6 }7 I, o6 [7 \$name = @$_POST['char'];
7 \9 [4 \% M$ v$ItemName = @$_POST['item_name'];
$ H: e1 q+ g6 D! `. T; h$ItemAmount = @$_POST['item_amount'];
: N0 J! E3 _# z6 |: h$ItemId = @$_POST['item_id'];7 \/ |4 w; ^8 }7 Y( [/ G* z
$ItemUpgrade = @$_POST['item_upgrade'];
/ \) y( S+ h$ C9 b! O$ItemElement = @$_POST['item_element'];
8 J. n4 f9 l& p7 I; h* P7 p$ElementUpgrade = @$_POST['element_upgrade'];8 |) h# i! G" |- Z2 S
$ItemPierce = @$_POST['item_pierce'];1 z. h6 K7 r9 u4 y
################################
7 D# h- Q  V7 \( `! @2 S! d- z8 T( b* ^6 {* K; }; p
//Check both variables for empty value, g4 l5 L; p% U+ M( s2 U0 E" l

$ t8 L0 A2 P# s4 {4 Dif (!empty($_POST['char'])){
) ]- m9 k) _- Q# d: p# V$ q6 n) q$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where 6 j" o/ K  Z! f' Y

+ p- S& u6 F4 I; i: j% Um_szName = '{$name}'");
9 n$ O' s1 x0 [/ W2 Swhile ($row = mssql_fetch_object($find)){
9 X5 k4 p6 N! r8 hecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";: O1 s6 ^) k6 Y, e; d& c
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
6 T) _% p# c4 O  h/ ^& o
( X% T6 W, j) }4 [- k[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
, n) m/ ^/ s7 S. b4 s3 k) |
4 A+ I9 M& Y6 F5 Q9 D/ s" c2 v[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 7 w; ?4 Z/ k) P- J" N1 O

+ p( J: R, x0 e) \N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
# x7 z$ P& `" Y( M. B7 H$ h; D5 i4 n  |( b
'{$ElementUpgrade}', '{$ItemPierce}');");
4 i2 i; k, ?' b& h}0 R5 W1 v+ G5 s* {6 D
5 ~% p; D; R( P$ b: f$ n
}/ k* f/ _3 T, B: w

5 X7 q  H3 G, X! R9 k}
! x$ c" [* Q4 n
( s: A) @/ `2 Q+ S5 k7 r. P$InitForm = InitForm();
$ e7 D5 T$ X+ O3 F3 u$Listener = PostListener();" f0 T+ J7 r3 n
) I* [# F, d; q) u' V4 Y  y
?>/ q2 j" h" a' }9 W1 Q: G0 t* C2 T% e
9 C, s' H) ^5 A' m, W

+ C/ ?1 Y' B' b4 ]( O* y3 e2 D1 D* w+ `- l; w8 W

4 z% D; B4 s/ K# v7 m0 }
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-22 09:09 , Processed in 0.069336 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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