飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
<?php: D9 B" D9 C  a- e! a9 W7 g
function Connect () {
! k& Q) Y7 b- T$ w: imssql_connect('Server','UserName','Password') or die('Error: Connection to DB 0 h& `3 s: M" J, R# Y

$ \* e6 C9 w1 d; @' KFailed.');
1 y! j0 b$ K+ a4 f}
9 S% V: G2 ~! p$ J5 k% s% D3 lConnect();
* W9 }; U- l, U4 X
* d  Z: ?$ I3 C3 L* R) [3 P. lfunction InitForm(){
8 q0 B* g8 O, G( N  h4 r//layout for the form* \! W- S4 A  h1 z9 w# b' ^$ \
echo "<strong>Send Items.</strong>
/ l$ ~) x' c$ x! |<form name='select' method='post'>$ n  ^8 q: X0 h3 u) D
<lable>Character Name</lable><br/>2 T- Y4 z9 r/ @+ G! }! ?
<input type='text' name='char'/><br/>8 Z1 ~! G' d* _
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>3 Z+ t4 I9 x" |* d
<input type='text' name='item_name'/><br/>$ ]0 }- e  Z. Q: A; l, d
<lable>Item Amount</lable><br/>! ]7 ~$ ^4 Z# ^) Z5 h% u. p
<input type='text' name='item_amount'/><br/>3 j7 n: t' B+ a5 o: m& Q! z
<lable>Item Upgrade Amount</lable><br/>
& ~0 N% ~$ w9 S; T& t: k<input type='text' name='item_upgrade'/><br/>
9 f2 `7 K0 Y$ Y' K! c8 b0 \<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)# D1 S: H0 k# ?: D* u4 p
6 u6 c" D6 H0 H& a+ ]2 f
</lable><br/>
" o1 k5 H4 F- [/ `2 ?( o" Y% g& j9 T<input type='text' name='item_element'/><br/>% t3 `. i7 m+ X- J% s1 X, |8 ~. i
<lable>Element Upgrade Amount</lable><br/>% A1 L9 s9 K8 J& ]5 L3 o  ?6 _2 r
<input type='text' name='element_upgrade'/><br/>
7 t* M8 Q- K- K  e3 ^* z<lable>Pierced Amount</lable><br/>  e/ e. o% L4 H; U7 L1 m/ V7 t  V
<input type='text' name='item_pierce'/><br/>
3 b+ {4 K) d& X# A8 p# j  k<input type='submit'/>
, t6 R0 T" y, r/ Y, X8 w</form>";
3 W# q+ I  H! h- B$ ~1 w) F}8 I3 m* k0 _9 l6 v) g4 g
7 q  _  z; M. |; A& _5 i6 r
function PostListener (){4 D* C' V2 g! i* R- t
//Add more post variables if needed and add them to initform() function aswell
7 a. Q* M0 H( D+ h. \  s8 [) k+ B! N/ M
################################
& ?& Y6 U: ?* G* n$ S* ?9 M5 e##### Connection and Post ######3 n" f! U; v( t) ^3 n% }
################################
9 [6 y8 G9 M; B% Y. |9 |& D$name = @$_POST['char'];
0 h# b- \, t, @5 @$ItemName = @$_POST['item_name'];
1 J  z$ r- W0 H; Y$ItemAmount = @$_POST['item_amount'];/ @/ U3 J' h; o$ y* g
$ItemId = @$_POST['item_id'];  Q8 l5 G4 I6 Q. {
$ItemUpgrade = @$_POST['item_upgrade'];
5 p$ V' ^+ Q, X& C# T% o/ ]$ItemElement = @$_POST['item_element'];1 b& P3 p8 o' w6 W8 Z% W
$ElementUpgrade = @$_POST['element_upgrade'];
/ n9 P  ?# {8 a* g4 Y! B  L: b$ItemPierce = @$_POST['item_pierce'];
* p! j5 a5 f2 _" A* K################################8 _3 }% U" m; Q) r  s
& }2 k3 a. [. W3 _) O, x
//Check both variables for empty value
# _+ ]% K+ i& ?4 w0 y, b* l) \9 p/ w  g, T& m
if (!empty($_POST['char'])){. l0 ]' |1 k: ]
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
# |% J5 J: T0 T) P$ f, B: M
/ c- r+ j- E( {% em_szName = '{$name}'");
1 f, ?) M& C9 f+ Twhile ($row = mssql_fetch_object($find)){$ h9 o$ c6 h. h2 R
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
4 P3 G, a. B4 [! s5 F$ H3 [$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
6 q1 e* W; b3 \! w, {8 s- \1 S* h) R+ d( P0 Q
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
3 `9 V& }7 y' D$ @. W# ^3 [$ L  v: }8 n$ V: k# b4 Y% J
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
1 c7 h" C, h1 L
: t. k3 }4 _- s- ~$ b* H, g' m: W* \N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
3 w5 x, B8 J$ Q2 \6 e( ?% |7 Z6 x5 b' T
'{$ElementUpgrade}', '{$ItemPierce}');");
1 x- R/ f- s4 J& w) |& m/ V, i}
. F3 v# `& A' `$ b: x9 {+ Z5 J1 |% l5 h
}
# V; u! Y! k2 X4 k" F
! ~& k6 |4 x) s}) k* f- R' ^7 e9 Q, U" b0 @

! |1 {' g) T/ b/ O2 H) R; |$InitForm = InitForm();: ?: v/ R$ [  q2 E4 C
$Listener = PostListener();3 L2 f0 a) J6 O$ h
6 Y+ z2 y9 H2 C! l: W; T
?>
, {- t- Z9 q* ^. n7 L7 D% [/ Q& @( i7 k5 ^9 e  ?

& C) J/ U, a8 X! W, ?$ Y8 r
' z0 U$ }& w" L0 ^$ D/ Q; h
  Z* P" B1 J) `0 N6 \8 a
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-28 22:12 , Processed in 0.059274 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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