飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php$ @+ Y9 u, p8 m6 E& F- C  M
function Connect () {
5 I- @. U( w9 c  Jmssql_connect('Server','UserName','Password') or die('Error: Connection to DB , L' b% e( j: K* u$ C3 [- o- A, i

. C! [' ^9 y0 P! E# z! eFailed.');
6 X% E, A' I# ]+ b+ O. F' |}
( f7 s* k- U' h2 d. o% ~Connect();1 k+ I2 y/ h# F

4 n7 g; Z! k/ c+ Mfunction InitForm(){0 N2 r7 W  O1 s9 a6 c
//layout for the form
9 u4 D. M' K# n5 X5 Eecho "<strong>Send Items.</strong>: ?0 }" T2 w* V) {% ^
<form name='select' method='post'>
! B5 {1 O( B/ F7 ^6 A7 F<lable>Character Name</lable><br/>5 h7 Q' r4 P( ^7 c1 V
<input type='text' name='char'/><br/>( U- M( ]4 ^( t# T; v  J0 e
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>; U- N# l9 G* ?4 e' N0 D' s8 K
<input type='text' name='item_name'/><br/>0 Y2 |& Z# J7 [1 H$ f
<lable>Item Amount</lable><br/>0 {2 e4 Q' u, g" s6 _" S
<input type='text' name='item_amount'/><br/>, ~2 r  [! A& ]. [4 D7 R
<lable>Item Upgrade Amount</lable><br/>
. z% o; p' `# O# D, Q0 O<input type='text' name='item_upgrade'/><br/>8 I6 o) z5 P* Q, Y- \; r3 T" G
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
( X- i+ o8 C* h) i: O4 E" F0 C# x" X
- P) Q# H% s5 d1 Z  A6 u4 R# W</lable><br/>+ m! C5 D0 I% V- C2 W' J
<input type='text' name='item_element'/><br/>
3 T& ?7 \& f2 y/ Y$ d3 b8 s  i6 I<lable>Element Upgrade Amount</lable><br/>1 Y! ]+ U3 J2 {
<input type='text' name='element_upgrade'/><br/>( K& Z& ?% ?4 F* e& m6 g7 c
<lable>Pierced Amount</lable><br/>* X0 s0 C$ |3 s1 g8 C2 S3 T
<input type='text' name='item_pierce'/><br/>" o; h* n5 N1 G. f1 b
<input type='submit'/>
/ k# T- t$ x$ E& m- n/ J</form>";
* D9 ?. n% [: d/ B3 @}. g& }9 A3 Q3 D+ R
: Q: e& ^* b# Y0 F5 r8 r, m& z. h
function PostListener (){
9 D) L% T/ y) K# b* l, o: c//Add more post variables if needed and add them to initform() function aswell
  w* F# c1 _' H3 J- M  u
1 A- R' d, \% ?* t3 M4 U$ d4 C4 Y1 k' L################################! a0 Z# U. {3 o6 W
##### Connection and Post ######& m+ q8 p5 ?# k3 y! X
################################
/ x" S& A- R' T6 g+ f$name = @$_POST['char'];  d, C- i+ I3 b, [, r. X% M0 D' |/ x
$ItemName = @$_POST['item_name'];. y6 |: @# {" ~" N. z4 s" A8 I
$ItemAmount = @$_POST['item_amount'];
- }2 N9 A& U" Z9 A$ItemId = @$_POST['item_id'];
4 ?+ L0 ?' R( L; `9 L& @1 p/ C$ItemUpgrade = @$_POST['item_upgrade'];4 x: g$ \. c0 i4 s4 _' N
$ItemElement = @$_POST['item_element'];
! {. u5 R0 J+ n5 {# B$ElementUpgrade = @$_POST['element_upgrade'];' v$ X5 F. ^- m% F# |7 h
$ItemPierce = @$_POST['item_pierce'];
; V9 N; w% g: N1 l, ~$ h; R################################
7 x! I: p- O' p6 a5 b% a+ I# A2 x; A8 d
//Check both variables for empty value
& Y  @' a8 T6 {0 ]) S1 s
4 g' _) {* s2 tif (!empty($_POST['char'])){) }5 \& W3 t8 p/ q8 O
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where ( w& x  A2 J* p, |, r- R
! R& V6 K! W: n
m_szName = '{$name}'");
$ i% Q2 j4 ]1 {# K* v: L- r; O+ }while ($row = mssql_fetch_object($find)){, @  o$ O- z+ o$ Z) Z
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";0 T& w: ^3 u& T! D
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
. o' F9 U* [- ?- k6 _$ n  X- J) Y, J& U- x) l  i
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
# A! E9 |( w* l1 O: \' a3 N; N, ~4 M7 z9 A& ^- E- G% Y" H6 t
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 5 M; X/ H4 b2 \9 t$ v% b

8 g; m) W+ T5 w5 b+ v# W4 s7 b3 h+ KN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
8 d. |' R; M6 M" M  _3 @+ Z
: G, [5 j8 k6 _5 r4 `+ R" P) _'{$ElementUpgrade}', '{$ItemPierce}');");6 K  I* L1 Z% A! Y2 l
}4 u9 k9 O; R! ~" i) t6 k

. [: b( g1 x7 z4 m}
# R* o% p8 l* |- f9 L0 H5 b/ q. ]$ j; w" b- w9 @
}
- v: ^+ @0 E8 {9 q7 M/ O9 c
* e3 G7 U/ R: E3 v- D3 d4 `7 ^$InitForm = InitForm();8 T/ Y+ ^9 q  O& f( p" l0 G
$Listener = PostListener();8 t% ^: h$ {/ G' L/ k/ R+ y5 Q
8 G3 |8 J" d8 w4 @
?>
2 }. @; G5 J9 ^# K1 G) e# E0 S# Z9 I' H% s

' j, i' ?* t. X8 B" o
1 X6 e3 Q! g9 M( T3 ?! r$ N4 }. N7 A9 x1 e: {. v/ b. J! Q6 e
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-1 04:33 , Processed in 0.057527 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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