飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
<?php
" H! H: u; J" S4 X( {, i' gfunction Connect () {0 x3 z7 S% n( l4 H
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
2 O8 V2 J* ^$ g* i) K0 o( W# `
) T6 `0 {) L2 r6 ^5 aFailed.');
$ O: P2 h& m0 O: l+ }}) H+ O+ s$ d  I" h) @9 e3 ]
Connect();/ j& h: i1 h% |4 v! W

! `) t& B& L  Efunction InitForm(){# _$ l6 [. m! m4 A8 R1 ?
//layout for the form
  E) _5 A3 b2 y* Qecho "<strong>Send Items.</strong>! O- k1 S7 U" t( v
<form name='select' method='post'>4 H1 m: P; W6 g% \
<lable>Character Name</lable><br/>
4 t8 S8 j7 A7 N6 ]4 k7 X( @2 H<input type='text' name='char'/><br/>
1 c1 p3 G3 B- e2 E<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
. x' S- ^- X' \6 e6 U<input type='text' name='item_name'/><br/>- ~1 }, x7 s0 }- M% E4 |
<lable>Item Amount</lable><br/>
3 A, p4 l/ r! ?$ j$ @. B; Z0 c<input type='text' name='item_amount'/><br/>
* m! Z* D' c4 e2 z% C" K2 S<lable>Item Upgrade Amount</lable><br/>
' b" X$ }% r: I9 M% t# Q- c6 W6 i<input type='text' name='item_upgrade'/><br/>
* |5 C2 Q$ P& J<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)2 F: r, X/ `: |. L" }! @

0 C# G, R, l6 Z" Y5 F</lable><br/>/ h1 L+ }8 N) s( K/ P: v% ^
<input type='text' name='item_element'/><br/>1 X, R' z' m3 n- T( A! B
<lable>Element Upgrade Amount</lable><br/>
. {; y" l# |& H% C* i# y<input type='text' name='element_upgrade'/><br/>2 z' s- R6 v6 i! L. H, n! S
<lable>Pierced Amount</lable><br/>
& \2 p; H) T' ?<input type='text' name='item_pierce'/><br/>
3 k& I( g& a" Z& W. @" f<input type='submit'/>) S" X% i8 _+ A+ g$ o7 a% j* ~
</form>";
" H1 E4 k6 g% H9 F+ p}/ Y* C* g0 z, R

+ `2 Y* B/ @8 C) Yfunction PostListener (){6 S# r# k/ d/ ?7 b# J$ r
//Add more post variables if needed and add them to initform() function aswell% O5 s( w+ a7 x9 a4 ~9 ^, q  m

! D) w' W" r0 u7 _+ k; U################################
4 F% l3 F% R" e" c5 l5 V$ l##### Connection and Post ######
, C3 V8 q! Z) `# J. I) E################################
3 _" b$ G% y* ^2 \- `5 Y- y$name = @$_POST['char'];1 j3 c; [( ~. ~/ N! K
$ItemName = @$_POST['item_name'];4 t7 a5 J4 M: E" t7 j& T
$ItemAmount = @$_POST['item_amount'];2 Z3 ~+ J# d% N7 j5 o+ Z
$ItemId = @$_POST['item_id'];
* d& {8 Y# o5 P2 y7 l$ItemUpgrade = @$_POST['item_upgrade'];
7 \& X' }+ X) u6 ^. w$ItemElement = @$_POST['item_element'];& f, X2 p0 ], o: b1 W
$ElementUpgrade = @$_POST['element_upgrade'];
* ~, t7 W/ j4 E7 ]! G$ p7 \$ItemPierce = @$_POST['item_pierce'];( n  j2 n8 d; \; A
################################
# ^( e3 H! w1 z$ j) [* E
+ ?7 ^, d* X" H# R! u* T7 E5 J+ l//Check both variables for empty value1 }8 k- [. H+ O8 w4 Z5 g8 H
+ k! x& Z9 B) G' T
if (!empty($_POST['char'])){( A: }3 o! a: L+ F: x' `. P" W
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where 1 C+ R+ O7 b3 B& [; l

  f; z5 }+ p+ w' R! Mm_szName = '{$name}'");
) N/ S7 _. F/ o4 X4 hwhile ($row = mssql_fetch_object($find)){! O) y  W) {  L6 ?$ {& n
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";& D# w8 |2 j# h
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
& [2 {; q3 Z, }/ j1 {% Q$ s; F3 Y, s  O- }+ D0 j
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], : s& K: L' ?  q$ x

+ A! d& C( y9 }3 H4 u[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
: ^! u. Q+ x# I6 t# _& y) ^; E$ ~: D8 v. m
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', / i9 S2 `- l( w# M  v+ b/ \
/ b) q; z0 q( ~, N0 W5 N) r
'{$ElementUpgrade}', '{$ItemPierce}');");: d& m* e/ G" z
}3 J( V) j# n- P( z2 x
9 K& F( J; K! ~6 a7 j
}9 T2 U) d, {; o5 g( h% P0 ~

) P1 e1 b9 n$ p- i) W) v}
: N  E0 j# n$ w$ X, l$ ^' D: y6 r4 g* V  h% T$ P5 _
$InitForm = InitForm();
1 r8 z  K! K# @! d$Listener = PostListener();* y, O3 X* w3 W* Q0 u' n& l; N

6 U. f" I' b# }1 w0 }?>
% G  A% O; u# ?( @1 z' S# T8 m* ~2 r0 Z0 n' J8 Y# ^
5 e3 X7 b1 R. e# C, ?
2 H9 U- L) n! n8 X9 ?- b) g+ k
0 d; y, J1 y; k( i" [( |; ?# F. a
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-12 14:42 , Processed in 0.063067 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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