飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
4 G% ^* o* T8 u" ^+ B3 sfunction Connect () {) j# z9 ~" v; D- Z
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
8 Y3 |9 c& ?) \! v& D0 i  y
7 d5 r$ x" |! _4 N0 w. w/ [( QFailed.');2 q7 P8 w! V2 @' x
}! P0 }4 `1 q8 u
Connect();
1 x/ |( ^4 @# n2 j
" i. s. Z& l& O* b2 a. `  w; L9 Sfunction InitForm(){+ M3 J5 M# N5 {+ |1 S
//layout for the form
! S/ X1 U8 c) u7 F; G1 Hecho "<strong>Send Items.</strong>% e0 y1 ^, x/ T
<form name='select' method='post'>" N1 H; x  I# f; s. t3 g9 v
<lable>Character Name</lable><br/>- {: C) V: g9 U, q% F  f$ U
<input type='text' name='char'/><br/>. t8 U. \! D9 Y2 |3 M& W
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>6 F' s# L9 d' f& s% I: r& z
<input type='text' name='item_name'/><br/>! d! V' n, W+ ]7 ?
<lable>Item Amount</lable><br/>5 f% o0 E0 Q' u/ ]+ \. n
<input type='text' name='item_amount'/><br/>- W- K+ _) @6 o6 q
<lable>Item Upgrade Amount</lable><br/>
) L: o; H4 D* u$ m- Y1 O<input type='text' name='item_upgrade'/><br/>
/ Y: X; z( g8 U<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
+ r4 Y) Z' ]# g' @5 m! _* o6 h5 {& `5 O  H3 H0 O' S
</lable><br/>8 m) i! S; v9 P  C+ R$ z! g' G& H
<input type='text' name='item_element'/><br/>
+ f0 d1 v0 A4 S3 v' H+ g+ j2 |: G  F<lable>Element Upgrade Amount</lable><br/>" ]& M0 n& k3 e$ o' P: {" x
<input type='text' name='element_upgrade'/><br/>: I" g2 H* r4 r- p5 E7 A5 e2 @8 q
<lable>Pierced Amount</lable><br/>) R% X: J+ r1 ]0 D# b" r, S
<input type='text' name='item_pierce'/><br/>$ f3 }- _0 @) ^: X- ^8 f' G
<input type='submit'/>% C( f; x3 T1 e2 Z6 `. C
</form>";
4 ^5 B  p4 B0 {0 C9 [" C+ u8 k}
# c- J5 c. s; T% ^1 C9 {( V8 O% f. g# P4 I! r0 l) }  Y8 C0 h
function PostListener (){
5 X( [2 ?5 F, h8 z9 C( J//Add more post variables if needed and add them to initform() function aswell
6 o7 Z9 d$ f% w: F2 S8 ?- S# A7 Y
* X: N/ S" {* O$ G( S################################3 ~: X' l; _/ z% d
##### Connection and Post ######7 I7 F4 }8 U; h3 b' v: z! l
################################
' F. w) H  J9 T; K8 {$name = @$_POST['char'];- W+ Y, T9 U8 u8 t$ F  I' C! i8 W
$ItemName = @$_POST['item_name'];4 O1 r8 O6 @* q9 s; z# U
$ItemAmount = @$_POST['item_amount'];1 ^4 a' a/ n2 V5 [
$ItemId = @$_POST['item_id'];' g( N0 Z; R- L- I
$ItemUpgrade = @$_POST['item_upgrade'];
, B4 }9 B7 _3 L8 x$ItemElement = @$_POST['item_element'];
! A, j, ~! Y0 T3 Y$ElementUpgrade = @$_POST['element_upgrade'];/ `( y0 F# l& t& Z
$ItemPierce = @$_POST['item_pierce'];
* j' V5 X. `0 `% M$ S################################7 p# C# G( s7 T. G/ c: L5 x# X1 p
1 N; x! J1 {! v& b7 U1 N
//Check both variables for empty value: B3 J! t+ F$ C4 [, q  _5 Q8 M
) ]& u8 y4 p5 K3 ]
if (!empty($_POST['char'])){; X/ x; ^: s6 g9 s' X2 B. X  \
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where 7 e3 L' E  k7 ~9 l
, \  d" }# C" y
m_szName = '{$name}'");
2 v$ S4 Z: ]7 i6 B- q! @; B/ Rwhile ($row = mssql_fetch_object($find)){) `* [9 u  n% C+ B/ [7 [
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";% y( U1 D  q( Q* Q. M) I0 G  o
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 5 P' z: q; p; @1 s
$ }& L7 @+ e4 {1 s# Z0 r# W( b
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
$ L3 h+ `* K9 ^( ?9 ~7 W. N8 j
7 Q& p) q, p4 a. L[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
" w2 y: T" S2 c3 h4 L# Z0 F! n6 V7 L; n! w( E+ l
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
+ ^, p' x: h  C, Y, G* g5 @7 D
. v: Y4 a, I& J# {'{$ElementUpgrade}', '{$ItemPierce}');");1 m7 c1 l' B3 k! F1 g
}* s9 e5 G5 ]( s5 \/ n+ l' q
' m. q4 W0 b8 ]* H* Q: [& {: G' k
}
3 m; l: H/ l3 H, ?5 ~9 {* v5 r8 t
}
4 j( P, z6 x7 q" ]* m, j- `, v2 a4 T( {
$InitForm = InitForm();
! L8 N$ h0 x% |) e5 `( c& G$Listener = PostListener();7 R2 w! }' q8 o

7 \( q' s5 j7 ]- B, s  Z) P7 h?>0 U: \! }2 e2 s/ V% D- D

' _5 a; ]7 ], J% q$ L: M7 p, m* @  j( M% g

! ^) ~, ^! p+ G7 k1 n) ]4 q1 L! i( k9 j
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-15 08:35 , Processed in 0.070158 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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