飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
<?php9 D4 ~# b- r& ~2 E( c/ r
function Connect () {4 P/ d: l. Z- \" m3 |$ H
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
: Y1 K) K5 i6 a. q# A0 |9 r4 b
6 V7 @$ n4 k4 s. q& E- l/ E7 V; vFailed.');' y5 `& q7 x# t! b* F3 k
}& f6 P* u& X, ?; y0 S
Connect();
" E, @! M) h( D7 h6 K" ?* }$ m5 K" g2 e2 K1 j+ c& }" n
function InitForm(){
5 K% V# e3 u, s; R" f* E) o//layout for the form
: `7 m& e! d7 E4 T: J" Q; m  |echo "<strong>Send Items.</strong>  e) w! }+ c: y6 n
<form name='select' method='post'>
" K- {% g% O' E1 s6 b  U8 u, k3 u<lable>Character Name</lable><br/># x& M6 A; Y3 k+ Q6 [: r; h
<input type='text' name='char'/><br/>" a" V( s& A3 o& T+ F4 S# i( O
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>7 _6 A9 @  e( v- g
<input type='text' name='item_name'/><br/>) ~- _2 B- ?5 X
<lable>Item Amount</lable><br/>& L$ k& m. _( ?% i- ]
<input type='text' name='item_amount'/><br/>
+ T/ W6 q) k' L" }" }<lable>Item Upgrade Amount</lable><br/>
5 `* J$ s' u( o. ?* d0 L<input type='text' name='item_upgrade'/><br/>
% W3 G% v* P) E( }5 O8 b8 v2 N<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
* {- O$ p& T3 j8 k; i' _* o0 H
- r- f, e5 U$ t* J- f</lable><br/>& E4 Q1 m1 V; |1 @
<input type='text' name='item_element'/><br/>) v: p' f4 }5 N9 t
<lable>Element Upgrade Amount</lable><br/>
- E1 J$ B; [) ~6 t/ I<input type='text' name='element_upgrade'/><br/>
8 b& z7 |$ U* `: z<lable>Pierced Amount</lable><br/>) }. G. x6 q$ V3 O' w9 w" \
<input type='text' name='item_pierce'/><br/>
, z' y2 D6 w7 u2 j, o<input type='submit'/>
  H8 ~' w9 }3 l</form>";
# Y  a" W. d! U  `/ U}4 J* y4 n! w* ^4 ^- ~& D/ ?
4 F' d+ P2 Q* P0 l% |) `0 R: G- x! ?& {6 s
function PostListener (){
, Q7 ^, `2 P: c, ]% s//Add more post variables if needed and add them to initform() function aswell
: ~5 Z5 U! _7 q  E
5 `4 u4 ?9 P, [& ?) l' C################################; B- Z8 O' V6 `. S6 u! Z
##### Connection and Post ######
9 [5 s- F3 S$ u$ M* Y( t6 J0 G################################
: u6 t! q/ C5 Y) ~$name = @$_POST['char'];1 B8 Y+ G9 u, Z! R
$ItemName = @$_POST['item_name'];
0 d5 T1 w) H# p9 {( {. E$ItemAmount = @$_POST['item_amount'];3 X2 e% y9 X  `# n6 R: j; U
$ItemId = @$_POST['item_id'];# p$ V$ c) z* F2 F9 Q4 m
$ItemUpgrade = @$_POST['item_upgrade'];
8 Y' G, L5 ]" _& J4 U$ItemElement = @$_POST['item_element'];* E! K( o( M6 {) J* _
$ElementUpgrade = @$_POST['element_upgrade'];# y: W$ W) M% C; x. F
$ItemPierce = @$_POST['item_pierce'];: Y: o, M2 F' W% f5 ]9 J4 C* b
################################3 C: M' T& d9 w$ [4 ~5 p, w- L8 x

+ u9 G* y' @. w+ T9 m3 _//Check both variables for empty value  l. O) a. |. `5 V3 Y0 X% o: x

' m% C/ y# H/ X- Y: H5 L. bif (!empty($_POST['char'])){
, o2 d  a) `- S& F$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where . ^. B& K+ ^9 p( J9 @

$ A, k+ K+ i' i# w2 N! em_szName = '{$name}'");
, C; k% C% L( o1 Iwhile ($row = mssql_fetch_object($find)){
' r1 X; z, ~" i3 q9 g, l! @, eecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
( v6 F3 Y( A; b3 }" L$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
6 ^" S* X9 A; Z+ F0 K. ]' [: I* U& g
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
' y4 U: o: O( \1 D* F* c1 |* F+ z6 U& m2 p, v( w+ G# d+ S
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
$ X6 U/ R! o" g+ }8 z% X8 _% M7 T9 Q0 c5 l9 p6 X
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',   u  D+ \+ a- o+ k# `1 o' t' {4 ~* e

2 v6 H/ l( N* U'{$ElementUpgrade}', '{$ItemPierce}');");9 D# X. N2 o  A! T9 @
}: j7 z1 J6 _1 A2 I, h
; M* b' r% ], A  L6 t8 b
}
) P; }, B( U8 T( s) P9 d8 m; \, m5 h# p# y  _. [2 W9 K
}/ y3 v8 C# T( u, p6 D: G9 E

5 X5 e% S- S3 c$InitForm = InitForm();
9 x' t3 W- I5 h  {- q7 P$Listener = PostListener();* l6 J; k3 Z& g; J# ~

8 M& h' M. n6 ?0 h' B?>. d  O; q: U( O
2 Q' ^. t: A7 z6 r- ~
1 o+ _0 b  ?" k  H# W# [( v
' V& f& m; l* R# w3 w; F  E+ F1 v
* K4 y3 D- t( t# Q" D, l
回复

使用道具 举报

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

本版积分规则

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

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

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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