飞飞世界论坛

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

物品发送脚本

[复制链接]

200

主题

203

帖子

984

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
984
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
<?php( ^; [  [! T0 \. {5 Q
function Connect () {" U0 F6 }1 d: s4 [, {# f( @
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
$ X: ^/ V, G5 V: p9 f9 B$ |$ {7 h( ?, s% ~' R7 j6 Q
Failed.');
2 h: Y  Y* l5 |* @}
4 B/ l" E7 \0 G) i* L2 a6 _Connect();' H- F  ^! K& g9 m: R
+ o$ c  X3 F+ i* ?5 r
function InitForm(){
' L/ z. C0 c& h. Z) ~. N3 E" M5 I! t. g//layout for the form2 p' ?/ d6 k3 {" q+ D7 z6 `4 y
echo "<strong>Send Items.</strong>9 y/ L$ c9 ~* m7 Q& L; E
<form name='select' method='post'>
  a. y# [4 s; L<lable>Character Name</lable><br/># T1 W# w0 }" b6 O
<input type='text' name='char'/><br/>. F7 r6 c0 H# s) i$ o& K) _5 |
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>- V( r3 n/ ^3 L* {/ [+ f0 v
<input type='text' name='item_name'/><br/>, D2 {, B2 [* j1 x
<lable>Item Amount</lable><br/>
8 F6 S. d* y9 O0 j+ ~<input type='text' name='item_amount'/><br/>
# Q, J! ~4 y2 ]<lable>Item Upgrade Amount</lable><br/>( |+ W3 _' o2 N& ?3 g
<input type='text' name='item_upgrade'/><br/>) h; l& H# Z$ g3 c$ y9 L
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.); ~* X5 P% h6 _0 O: g1 \. b) p$ \
# p+ n: T% Z9 u7 C9 G7 L
</lable><br/>
* b; r, L/ ^5 \8 K<input type='text' name='item_element'/><br/>
4 g9 e- g3 P! G, w6 }( L  C<lable>Element Upgrade Amount</lable><br/>
) M/ S, P/ Z1 z* N  K  B  I* ~7 R  x<input type='text' name='element_upgrade'/><br/>
4 [7 x1 H; M4 e( f: j% c<lable>Pierced Amount</lable><br/>& O: k3 }! w9 \) K- l
<input type='text' name='item_pierce'/><br/>
( a( {$ u1 X1 w$ g; ~0 i) A% O<input type='submit'/># M+ C3 P* d! |4 _8 G0 Y
</form>";
- B2 Z+ _1 q& ^}9 s6 O& A/ S1 X- {4 t# A
0 h: V! `+ F% [7 A
function PostListener (){
& s  q# j5 f' L1 J% F5 l8 G4 e//Add more post variables if needed and add them to initform() function aswell/ U5 Q+ k7 J; Z* Q+ R# a9 K$ h' C
, P4 Q# R1 @  ^3 @" i( a! }
################################" o6 d# ]6 h5 V1 N  v5 Q9 v
##### Connection and Post ######
$ V3 {, g1 B9 E1 j################################
) d. D6 Q# R) o) s$name = @$_POST['char'];
2 ]) F$ c& ]5 x$ItemName = @$_POST['item_name'];
+ {' b" p2 G3 E" j  Z/ C$ItemAmount = @$_POST['item_amount'];
& K: K  B1 x( f  S4 e0 j; l% B$ItemId = @$_POST['item_id'];( i4 [# G6 A( r  d5 d
$ItemUpgrade = @$_POST['item_upgrade'];
! p5 K' q# `8 W2 r) F" u% r, G$ItemElement = @$_POST['item_element'];& J7 o3 h1 {. s8 f2 h2 D, k$ c
$ElementUpgrade = @$_POST['element_upgrade'];. Z. h* j# g/ g: t) L& ]7 u
$ItemPierce = @$_POST['item_pierce'];
- P2 |7 h9 U7 H; ?$ m" b################################: D- D; `0 x: U5 r7 c  J1 B

6 U: q* U1 [7 y% P# H  Z, u! k//Check both variables for empty value: x8 ^' K7 c, t  T8 X- c# x  G7 ]
; X0 ^% v; h$ h! J  L
if (!empty($_POST['char'])){% A' j; u5 z6 j7 U/ K, w8 x% }; r
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
* h5 d+ \4 Z6 |' z$ z9 u+ l! s7 F, N1 W. U
m_szName = '{$name}'");9 A; `$ [. [- B
while ($row = mssql_fetch_object($find)){  S# Y/ J/ D* {9 z
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";- Z  M; Y& t1 ~3 O- u6 r$ G! I
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
+ p' ~$ @2 g% s* ~( w) `
( d2 H' x' }8 j7 x, A5 [[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], / h$ A# f" N1 Y4 C8 n! T7 V
" Z- {4 [% a. B  H2 l3 L; z# S
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', ' x7 B4 k: B/ A- R: p' }3 C" E( e

, z- l0 f- ^2 i( pN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', . \$ G) `8 Z" ^& E0 ^, ]
! H+ U5 L/ g& y% G4 g' V( [. J
'{$ElementUpgrade}', '{$ItemPierce}');");
5 R) q7 }$ h3 r- B$ T& }  ^}+ Y% m4 c* ]7 t% L  b

7 Y' |7 O" r0 w9 C  \. n% F$ @}4 Y) k1 G& U7 ]  p# _) [6 Y7 N
$ h5 S% b6 t" r! n5 H7 Q
}
1 t0 d- \2 ^( Z' s9 O" |+ T% ]9 g, s' d
$InitForm = InitForm();
. W. G% \2 O5 v- W0 B, u$Listener = PostListener();# D- w' f% [4 k$ G' s
1 |% o4 g3 g$ f$ e5 C5 a6 w
?>. N! R; u& |# I. |4 ~; M

4 ?4 L2 J7 x, l! u. l+ J+ v+ k+ c/ k) F/ z! n8 A) Z

$ I/ x- [5 {4 Y; x% Z1 w" F" w( _( |& n9 Y9 r
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-19 07:17 , Processed in 0.057395 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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