飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php" i: J# c% O+ r: C0 _
function Connect () {2 b' B$ l. [7 s- V; w; ]
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
4 s; F. Y# }# r: c+ F$ Z
4 V' f8 {$ k8 l4 b8 x* o" MFailed.');
; o" d# [+ D( D, E: h}
; e' j8 g& ]6 K0 @+ U. h! A4 x0 yConnect();
  O0 S+ t6 a" A9 E8 D& ]  a
; ]. o, ], j5 Y( `function InitForm(){4 [# l2 l# d2 l, ~9 S2 N
//layout for the form
: w( d2 y- D* j4 @) |. Wecho "<strong>Send Items.</strong>3 s4 A& B$ _+ l/ Q
<form name='select' method='post'>
4 F, O( N6 x4 j7 V5 `# U9 Y<lable>Character Name</lable><br/>" a$ |; X2 d4 D* {4 k
<input type='text' name='char'/><br/>
  X8 P' |: D, h; S& W# V5 c<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
; \, w9 S9 ]9 d<input type='text' name='item_name'/><br/>
( r5 f8 A, |3 X<lable>Item Amount</lable><br/>0 c! ^6 N/ a/ D6 S& `
<input type='text' name='item_amount'/><br/>
! U# b4 O; N4 P! ^/ X& z* D2 v<lable>Item Upgrade Amount</lable><br/>
7 y8 N1 \+ s- q. M) }% y0 d<input type='text' name='item_upgrade'/><br/>1 A5 S2 g2 ~8 z2 V3 D  p
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)( B9 }: y; C. b, l5 s* ?- q

+ y4 j/ T# G1 U8 L6 j</lable><br/>
" }: ~: K& u- r2 d3 K  c<input type='text' name='item_element'/><br/>
1 e! P  f9 e/ ^2 f5 O- b<lable>Element Upgrade Amount</lable><br/>* X, d/ K; C) {, ]
<input type='text' name='element_upgrade'/><br/># c; J0 {* {$ L/ O
<lable>Pierced Amount</lable><br/>; v0 A, z1 d* v& {
<input type='text' name='item_pierce'/><br/>
4 ?/ m0 x/ `" j8 O0 R# ~# x* y<input type='submit'/>; K7 ~, l1 t0 T' A
</form>";' N% x& p7 D+ n! C$ E: H" E0 u- s' h- w
}9 {0 M. C' ]( ^- b* }0 n6 U

1 E! F# k6 `( t. S" N. _1 Y2 Efunction PostListener (){' ], _; n. z0 L# ^4 P
//Add more post variables if needed and add them to initform() function aswell
' ^$ ^. O/ Z4 R( e
7 n/ a" D, ?) S2 ~################################! w7 F- m- D6 |! [& i3 J  g
##### Connection and Post ######
0 P7 o# y! s, o* ]# s+ N################################
7 P& M5 g$ o: u6 X% Q$name = @$_POST['char'];$ s7 G6 V; z) U, D* r
$ItemName = @$_POST['item_name'];
: k" {* O2 @8 t, H8 G- l4 x$ItemAmount = @$_POST['item_amount'];( y0 l3 i6 d" N' o
$ItemId = @$_POST['item_id'];
2 @8 d0 U5 p, O6 X: U9 d* @& C$ItemUpgrade = @$_POST['item_upgrade'];
) I* b, m  T6 ^. E& O" [6 L! o$ItemElement = @$_POST['item_element'];
! K. h# ~! s+ a+ A& p0 x7 \  j$ElementUpgrade = @$_POST['element_upgrade'];% Z( S% x+ Z# w- g  T  q9 L* h
$ItemPierce = @$_POST['item_pierce'];
2 `* z! E  }2 ]* W; T################################. C8 W" }8 |7 @  }8 W6 ?, U; g0 }
3 M9 O  S  t  S8 I6 b: J2 X
//Check both variables for empty value
3 D$ y5 r# `; N. c! c# M( @! A" O( q0 {3 g* G! y
if (!empty($_POST['char'])){
1 f7 i3 a0 b- S0 R$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where   B& W! j% ^4 x7 d$ E' h5 p0 G
; r) H+ s3 I) G0 |. p. g3 s
m_szName = '{$name}'");" O5 ^/ @* Y/ m2 i& H5 t
while ($row = mssql_fetch_object($find)){
" y( l+ l$ F# ^  uecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
, }3 D) K$ O- R1 V$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
; e) Y4 j+ |1 k3 p2 e
7 d  @& y0 ^# U7 p, |8 n( i) d[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], . y( _+ H9 V) h

6 m* a! C" a& p[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
& [( h$ r9 C7 s- p
9 l# t7 }! c. R  LN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
2 ^& N( p' E' _3 e7 h* b1 G2 I* n' q, F5 E! _# F
'{$ElementUpgrade}', '{$ItemPierce}');");( g9 H9 d1 V6 s; N0 \
}
4 B. ^( n. z% c) D& e
% N+ U+ W) V, F2 h9 Q2 X( ?! f) T! ?$ R}
% Q7 y( }9 R3 o+ W9 T9 \* R, o1 T
! o0 D" I. _. u1 I) f2 s% E}
' S" H" k2 t& [% ^! C( J
) X" p8 O  ?" ^" Q, ~4 w* Q$InitForm = InitForm();# A- J1 e" {* I/ E$ z5 i
$Listener = PostListener();1 J2 F9 [( f1 H

, `7 d3 H* s9 _: I9 f+ Q9 [?>
& _+ R1 J! h* m. @8 L. m" k
( z  m. a# e8 D+ C# f0 s; a2 m
" c5 v  N3 u$ u/ ]' j0 i( p; ~; a6 k/ h- U: ?# N

! d/ Z, l0 V  r. B; R# T2 p
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-13 08:13 , Processed in 0.059672 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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