飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
<?php
+ U" J, ]* r' k5 @- o, }function Connect () {! y- b9 h8 E. I8 B5 X! f2 _+ Y8 S2 G: j
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
/ t0 I0 Z4 Y6 P; |
6 E6 ~( n& v& _Failed.');
1 _+ u) w. V7 ?+ x! t8 {% {5 ~8 B}
& Z, E1 D5 L  D* B- C  P2 fConnect();3 h* v2 r- b" Y- U+ Y

3 \/ L6 }1 K6 z9 t, R/ Ufunction InitForm(){
; [3 K- K% {  k2 L! |//layout for the form/ |7 |( B4 r& d% Z* j# e& m- q; E
echo "<strong>Send Items.</strong>4 N! x! g% p( q. d
<form name='select' method='post'>
8 W' l* Q% B: ]1 M  [<lable>Character Name</lable><br/>
9 D% }2 t) j8 W6 J9 @5 _<input type='text' name='char'/><br/>
+ y9 H; M3 P. o/ G5 u<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
( Y% o. Y) @) ]3 N* {' T* l$ ?+ M) }<input type='text' name='item_name'/><br/>
8 v# g$ a- {- c<lable>Item Amount</lable><br/>" s9 c; p. Q, ~* v
<input type='text' name='item_amount'/><br/>
( \5 Q9 a/ @( E, j& e<lable>Item Upgrade Amount</lable><br/>
3 i0 c! P& d4 H, R$ O<input type='text' name='item_upgrade'/><br/>3 K* J! U/ s9 G& p8 S
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
! ^) D7 z7 [  F. X- l3 [  z) t5 p) i# |. p8 S/ B9 i+ s8 i9 B% O
</lable><br/>4 Y4 Z' Y8 z4 O) X/ Y
<input type='text' name='item_element'/><br/>
7 s! ^4 V# E4 B( F# R6 s8 f% W3 e# j% {<lable>Element Upgrade Amount</lable><br/>
; f9 P2 ^" o% b" i/ y  Z! B2 U4 |<input type='text' name='element_upgrade'/><br/>, X9 U5 C' R. l' R, c
<lable>Pierced Amount</lable><br/>, t$ R/ I% Y4 ^+ M8 M
<input type='text' name='item_pierce'/><br/>: B9 ^# Z/ Y0 m2 ~$ q; F5 y& C1 Z
<input type='submit'/>
6 D# R2 S3 J& O! S6 [: v</form>";/ ^2 d4 t2 x! N; `4 R0 P2 x
}5 B. K% m2 m0 x% O0 G
$ {' ?6 \0 V# E. X7 f
function PostListener (){5 p, k) H, {  m+ e
//Add more post variables if needed and add them to initform() function aswell
9 P$ O9 b7 a' V; ]- a# \
* [- p8 F3 g& O################################
3 ^. i( D5 ^& {8 L% O1 O2 C##### Connection and Post ######
7 Q5 p$ g7 i- V################################3 `& e3 W* b- O7 W8 B& x
$name = @$_POST['char'];
' Z8 g( g* |5 _: R6 Y$ItemName = @$_POST['item_name'];6 x3 }) M' N$ R9 Q/ n5 ?3 o
$ItemAmount = @$_POST['item_amount'];; d, |" @8 e- ?) \2 P! _7 F
$ItemId = @$_POST['item_id'];
$ z" O8 N# r) u. ]' M# u$ ]' y+ p$ItemUpgrade = @$_POST['item_upgrade'];
7 N* p( t: ?/ U/ B; x+ x; b) a. j- Z2 w$ItemElement = @$_POST['item_element'];$ u* \! a, [6 V+ D% h" E
$ElementUpgrade = @$_POST['element_upgrade'];
; f6 D' C4 y7 I* n* W) n+ ~$ItemPierce = @$_POST['item_pierce'];$ F( L+ m: U( ]! f; j0 M
################################
3 i- J% O5 b3 t0 ?$ w1 W+ _# Z/ d
//Check both variables for empty value1 l& F& L3 _. S, m

/ x4 g; Q7 {" x$ ]8 Aif (!empty($_POST['char'])){( \9 i9 ?& z& l. ~  a- \
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
0 _) s' P9 @7 N' u
$ D/ ~9 F& V8 n' s' _( B2 Nm_szName = '{$name}'");% G! ~7 [* t! j0 X7 y% ?
while ($row = mssql_fetch_object($find)){7 d( n$ {) J4 k" q
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
* f8 Y- v# I4 l4 K4 u$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], # b4 \) h4 k+ {% j- w8 t3 l
/ q) j. i6 x7 O' h4 @
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], ; j) G  r4 `+ M! f2 }* p$ G
3 B* B' j, E8 q4 Z( k
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
# c- k+ x" V+ R1 p" b/ v9 K; z1 @# u
0 O# f  G9 a5 }2 ^& X. CN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
% A% B! g5 G6 }7 ~. v2 B
! l3 x1 m. N& i- o! T'{$ElementUpgrade}', '{$ItemPierce}');");9 Y- A$ A# p3 z7 m8 q) t
}% n# ?* y" N+ h  h- V
+ t! _3 M  F. h! ?( b0 E/ G1 f/ f1 ^
}
- ~* t/ u' d6 a/ D; P- V7 g, v" `' ^3 g6 p4 a2 S7 ~5 L7 G
}9 i7 p/ Z; o2 \  R
3 l+ d! m, J- K3 G" y! Z  ~: A
$InitForm = InitForm();
  F) i1 u7 c' E. h$Listener = PostListener();5 d% n# |6 `4 |$ P. {$ A; Y
! ^) Z5 y; _* t* p& W7 a' r4 a0 s  Y
?>. @4 N) A; P7 _% u5 V: S

1 M) _; p- r2 ]2 i
0 Q. i. n: `$ K2 S7 Z$ D( ^4 p' ?& B# Q7 R( {" e* F; ]' d3 [7 F7 k

4 b9 ~, K( ]$ L% @
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-18 15:39 , Processed in 0.062377 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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