飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
" e8 h# E: l1 Jfunction Connect () {3 F) R! O4 T' b5 t- A" o
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
* H  `& p, n4 `" ~6 S* b) f9 J6 K( U. u8 ]
Failed.');) k/ o& T! s1 u* ~3 [2 V1 X
}
% i+ `/ o: c/ `& n) Q1 bConnect();
8 `1 a. m, }5 e; t6 b
2 ]- x2 S  Y/ X& F2 ?4 Hfunction InitForm(){, {* ^5 f5 q  H- K7 E
//layout for the form2 Q1 s7 T3 |6 r* e1 i7 b& @; Q" a
echo "<strong>Send Items.</strong>: e  A- }( W3 S" T
<form name='select' method='post'>: \7 f9 U" u7 d- o9 J$ f5 z$ I: k
<lable>Character Name</lable><br/>
7 V& n" ]. |# u" z<input type='text' name='char'/><br/>' `/ m9 O, L+ F3 x* m% I5 W6 P- G
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>: ?/ d5 K2 s, R+ \4 c7 [9 q
<input type='text' name='item_name'/><br/>2 b% ]$ l- z, X5 J% {6 {
<lable>Item Amount</lable><br/>
1 q2 B6 u" _& T! I* k) q9 Z# D<input type='text' name='item_amount'/><br/>
* V/ i) r, L' r7 B$ y<lable>Item Upgrade Amount</lable><br/>' p) T+ \$ x( z) U
<input type='text' name='item_upgrade'/><br/>6 K5 ?4 U' D( \) C# `& K  M
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
( c, O% F0 {% j0 C. j% S
  w: f( L1 y$ l. J7 `- F</lable><br/>% X/ T: R( N  x; f1 c& X3 ^3 ]
<input type='text' name='item_element'/><br/>1 M: ~+ `" B  o& F2 b3 c
<lable>Element Upgrade Amount</lable><br/>
+ o6 y  G/ p9 m) i0 q: E) q4 W7 l" I<input type='text' name='element_upgrade'/><br/>! w, E, V: M) I( {  r9 d& `  \
<lable>Pierced Amount</lable><br/>5 L; V: ?+ j% J3 ~
<input type='text' name='item_pierce'/><br/>5 E" ?" [5 a/ f" s/ j; ]1 X
<input type='submit'/>* X, O  n7 Z4 X* e& ~4 q
</form>";* w2 Y5 }7 u7 B8 H1 P4 C
}. [# V: q0 S2 M( J" F
2 F: }& c! h6 D2 `0 u$ q
function PostListener (){8 N: v6 V- h: b( g: u& o, S) c! C
//Add more post variables if needed and add them to initform() function aswell
" }) a3 p- u3 Q) N7 Q  C, C- l
, s" X( s" y0 l  l################################/ z3 T' z) P, t) K1 U- b- [" A
##### Connection and Post ######
& k8 t0 a9 ?1 ]. Q################################
7 N/ h7 [. w' F) f" I  J$name = @$_POST['char'];
* U! \* |& `- u) s9 f4 i% l/ a$ItemName = @$_POST['item_name'];* z8 S6 w$ w# c, h2 t( ?$ v
$ItemAmount = @$_POST['item_amount'];9 Z! `# f% B3 c  |5 n7 d: c
$ItemId = @$_POST['item_id'];
, O/ h! {& ^& X( a. f* `$ItemUpgrade = @$_POST['item_upgrade'];
  J- u- _6 t+ K2 _2 x2 w6 J$ItemElement = @$_POST['item_element'];# @" c0 H. I8 R# ~% A* \! a
$ElementUpgrade = @$_POST['element_upgrade'];8 d5 m. J$ F* e
$ItemPierce = @$_POST['item_pierce'];) U7 h6 d4 z, l6 ^# G5 q
################################
2 h  ]6 n5 `) _# z) ]6 w
+ E8 e' K# C4 ?6 j  V  v//Check both variables for empty value
9 o, o" C+ y( V! ]
+ a9 f2 L% F  x( O! p% `" q. B% Aif (!empty($_POST['char'])){+ _7 d; T9 B) b0 W! F# q8 ]
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where $ o4 `! S0 ~5 |! g0 ^
) S, n) l* L9 J
m_szName = '{$name}'");7 y2 b3 l) z3 l- R
while ($row = mssql_fetch_object($find)){
3 z7 Z: h0 {: ^echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
* X2 T3 g3 G( K$ A' P2 t$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], - W( k! x4 `% a2 Z% U# J% Z6 l2 q

$ q2 s  |. I9 o+ ~, d, `* P[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], ! ?0 _% p6 P4 u: W5 s3 u( p& H; l
  ~3 p5 t# d2 V6 m* L
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
8 M( }8 j9 l. i& E; s8 a  q
7 ~' R$ n- O9 Y- z# mN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
4 ^, V( @- s* p' O. M1 H
* R4 N  s4 S$ L, B1 L; @0 g'{$ElementUpgrade}', '{$ItemPierce}');");
3 H- K) P1 b3 M}
! S& L# H- ^% b4 V) k! `/ w' r! J+ v3 t9 ~0 `( m
}' R& t( [8 B" ~3 Q5 @
" N6 o! ]* B. y# ]% @* A
}2 w) Q2 Z7 ]7 Z2 i* J
+ @+ F( [6 d% p2 J7 `
$InitForm = InitForm();
/ X6 s, S& m* i5 a. q% B$Listener = PostListener();  S% X- M/ h" N
1 }' i) [. h1 G5 z0 |1 a& H; R' M
?>
, S4 x  u5 _# e9 h, l5 W8 J* J! U% ?. C( Y

+ J+ S- t7 j3 r/ H4 _' R! M4 K( K" E& D, f* a
' O+ W* |2 X' L2 Y1 w+ Y
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-15 04:00 , Processed in 0.108541 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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