飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php8 d% ~& J5 ?7 [* C
function Connect () {" m, c5 Z: \7 V7 {
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
1 J& I; x; M- y' i* D1 z" j4 W) D. Q8 R" o" o) z: C
Failed.');4 Y; y- ]! p' @5 D9 [# _. ]* }
}
; c" ^- N$ N6 ]* t, WConnect();2 X! Q, y, h5 a5 g+ P

9 t3 |6 }( x. t! Cfunction InitForm(){
0 I$ r2 b' E% s) Z" x! M  Q3 P//layout for the form; i, n* F! J% v6 Y! O, r
echo "<strong>Send Items.</strong>
* _% f2 d/ {6 @! Y' F9 M. l<form name='select' method='post'>
& C8 U5 A5 H( }/ M! }, Q  T<lable>Character Name</lable><br/>* Z& O. F( H1 ]/ K
<input type='text' name='char'/><br/>
& z4 t8 \" B' d0 q) z8 D3 a6 B<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
+ ]. m7 x9 I- F/ ~% G& z# q<input type='text' name='item_name'/><br/>) }6 S  m6 P& G7 x
<lable>Item Amount</lable><br/>
6 H1 {: ~: R! `" L) ]9 t; m<input type='text' name='item_amount'/><br/>
4 B  d0 w/ I  v9 q<lable>Item Upgrade Amount</lable><br/>5 j& m% \5 s. M
<input type='text' name='item_upgrade'/><br/>
0 O/ X: E  b" u<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)* Y. M' x% H3 ?
' G# {8 S) _8 z+ |. v
</lable><br/>0 ?/ K+ q: \0 H& v9 D! G
<input type='text' name='item_element'/><br/>
" F! y0 q" B$ u2 c: K, K7 \<lable>Element Upgrade Amount</lable><br/># Y! O: k. c. Z9 P+ j" P8 ]  X
<input type='text' name='element_upgrade'/><br/>- \, B- S; S/ l3 P$ R% d* ~
<lable>Pierced Amount</lable><br/>2 x1 Z! I8 ]  Z/ f( H+ S
<input type='text' name='item_pierce'/><br/>  W0 c8 O: \1 l; e; Y! ?- Q
<input type='submit'/>" }1 C3 K  ~" E- ?2 H3 U
</form>";* W, u" {% l) J+ I: W
}
! z4 J0 e6 T% j. S
' ^! D5 u- S+ x) M; J4 mfunction PostListener (){
) m" s, d* C' v/ s/ r0 _) v) K7 V//Add more post variables if needed and add them to initform() function aswell+ C  l2 C7 N2 _4 W4 Q7 e0 O
& o# G+ I7 W. C6 ?  N
################################+ }" \3 u* }; [: [
##### Connection and Post ######& J1 W2 u+ i) G1 U  }- U% v
################################1 ^$ `* i: v  w# N7 W8 @* [
$name = @$_POST['char'];
! S7 u) g1 C7 X4 Y) `% J$ItemName = @$_POST['item_name'];
7 J. x! ^7 N1 T3 O$ItemAmount = @$_POST['item_amount'];. R4 h+ ]8 ]& i- _; v/ A2 W- T7 a
$ItemId = @$_POST['item_id'];% X: C0 N* _! r2 ^% W; ~
$ItemUpgrade = @$_POST['item_upgrade'];
" D* {/ }6 n$ B, o$ }) B; |2 O$ItemElement = @$_POST['item_element'];4 F! p; O4 }. |7 P3 F
$ElementUpgrade = @$_POST['element_upgrade'];
' F$ |. a4 a  r# T$ItemPierce = @$_POST['item_pierce'];
' L6 x& M( y- e################################3 e# X& ^/ B: q. d3 c- K( q1 Z; E

. q3 b* z" J4 r$ p/ M  O//Check both variables for empty value
8 p$ |+ x4 y4 B& q$ X: j1 F6 P! P/ u/ ?& s- n1 M# X8 r
if (!empty($_POST['char'])){
/ H/ \, d% D2 B+ H/ j7 Y9 l$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where ' s! S& A# G% O8 {
( R( {5 o/ j( ^: S% \
m_szName = '{$name}'");' y: k/ X" W+ P3 @
while ($row = mssql_fetch_object($find)){
0 P3 Z' q6 _* _, secho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
2 _! z. D+ Q6 s. @& v; i, a$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
& J7 [3 w( @7 C5 Y* ]; ^) f
1 u2 X7 R# q+ k[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], ; n- ^5 u1 C5 [0 d; M1 z* U, S

& _' V6 N# l! t9 ~[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
! O3 y4 D( s( z) z2 ^$ I6 d6 B  z; {' l; J
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
6 m" H% i* R' y* ^$ a
' S' Q- Q, a1 S9 b8 S0 }* j# h4 A'{$ElementUpgrade}', '{$ItemPierce}');");1 s# l9 O& I  ^7 \/ R/ d/ [
}0 m& M0 b; `$ b3 O1 p. ^3 U6 \0 K

( M3 T( ]9 o. i" Y, e}/ G, ?+ I, Q2 e- @
3 Z$ I' O+ K1 f2 Z( k: z" W8 L/ ?7 `$ U
}
  K# w- ?5 m$ J
$ j1 T/ h4 O  S* F$InitForm = InitForm();" Y) \) q# l7 ^! D8 K
$Listener = PostListener();
' H% U$ B' n7 T' ]+ `$ m0 I" E& Y# O) ^  o
?>
. t7 E# E2 }  j. p
* Z6 Q# {2 u- E* r0 F: c! L1 C& P; c* a( j

- S7 C( ]& \3 r9 i# ?5 w, Q; k) d# l# X
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-18 18:29 , Processed in 0.068581 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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