飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php7 C1 C; Y$ m$ c4 x5 Q& X8 q% F: h
function Connect () {$ H% x& _( w8 ~' I4 K
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
) _# u$ c0 }* q) m3 y
; F! `, S  n, F8 \6 w) O& s) zFailed.');/ [' d' _0 n/ m% P$ m
}. f# R, i0 E4 x5 {8 _
Connect();, V2 a1 D% d' O2 J# Z

2 i4 F9 P  O$ P) V8 v! bfunction InitForm(){) m6 R6 n) G7 C9 A7 o5 }
//layout for the form: j5 h0 p# R/ V5 g" \
echo "<strong>Send Items.</strong>, x; l/ e! d* ~
<form name='select' method='post'>& d8 R8 G( p2 \+ h
<lable>Character Name</lable><br/>
2 _0 `5 F$ c* A' {9 U<input type='text' name='char'/><br/>
5 Q! e: V/ G2 ]. @. a0 N<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>* l; W: }/ K0 i
<input type='text' name='item_name'/><br/>! j; @, g+ o! l5 V. B# A) {0 Q
<lable>Item Amount</lable><br/>' Z: u8 `, E. [4 S
<input type='text' name='item_amount'/><br/>. G% k) t' q8 J  [& |+ W  K6 j+ k
<lable>Item Upgrade Amount</lable><br/>
' W2 |8 k" O2 O8 L4 j9 B4 Z4 d<input type='text' name='item_upgrade'/><br/>
$ g% j6 |' ?1 B* S) b; g. r<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.), i3 m1 r! T, w3 c; M. z9 l
# C) d" @9 \' w4 ^% E
</lable><br/>
9 w) s( y1 H% j5 \, {$ q3 ^! i' Y<input type='text' name='item_element'/><br/>! V% q/ B  t* N
<lable>Element Upgrade Amount</lable><br/>/ C2 a9 ]0 |% q3 M
<input type='text' name='element_upgrade'/><br/>  g# O2 |5 Y" y! s' t
<lable>Pierced Amount</lable><br/>
0 Z3 |* j5 O/ D" j0 b4 |8 W<input type='text' name='item_pierce'/><br/>
5 v0 p  t: I0 {- }: `, d9 h<input type='submit'/>5 w. C0 \) o) d5 M
</form>";. I! R% K3 N( C" v
}
+ F( d* M% P- p# ?4 L5 P0 u; q
$ y5 [9 }; o: b5 ], kfunction PostListener (){
) O  |+ U( h. T6 Z) W4 d# @//Add more post variables if needed and add them to initform() function aswell
. W; A5 E( C4 ^) S" N- J  t* N1 Q$ W0 m9 [* F. L
################################
* V( m( j% W7 J5 Z  v4 g4 D##### Connection and Post ######
/ Y8 j8 r: [' ~################################9 i" ~& n% K3 U; o
$name = @$_POST['char'];
7 J' l4 J4 H# c9 \7 o6 f/ F$ItemName = @$_POST['item_name'];1 b* E- r! a  ~+ q$ \9 N+ }
$ItemAmount = @$_POST['item_amount'];
" s. E9 P; L, u5 N$ItemId = @$_POST['item_id'];! W) e. Q3 [& p' A' R; o: [
$ItemUpgrade = @$_POST['item_upgrade'];
# Y1 t. i) A, t  E2 {  t$ItemElement = @$_POST['item_element'];! M* K- c  j. g; e
$ElementUpgrade = @$_POST['element_upgrade'];
5 V% P! a/ o3 a; X0 [3 o5 y% \$ItemPierce = @$_POST['item_pierce'];! s3 C. p& ^4 P, \
################################
9 p" g3 V* M4 R  `% x% B
3 |# x' t2 r: B//Check both variables for empty value
% x! `  _" C: `; G& `- _" g9 M- u& Z' p6 |
if (!empty($_POST['char'])){3 u8 R: g) R; h2 _! [
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
1 G  _) _7 z/ ?" i+ |0 |+ F
' x5 o* P1 X* [2 A  Zm_szName = '{$name}'");" Q# a; l5 T% ?1 X: E7 O; G' G
while ($row = mssql_fetch_object($find)){5 V, d$ K8 w. i, h
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";6 G2 }: P; N6 G  ^& ?5 b
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], " E3 v8 y" a* J/ T

+ B4 E( _+ y7 s. S9 H* P0 ^[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
, S3 H$ e; T5 T
) p" R! s6 V: M! l6 [1 ^+ y  ^[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', ' t, S3 z+ S7 o/ c/ i5 b; @

% M  z: q8 K, a) a6 W' d: pN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', " S# p0 Q+ ^4 n0 k1 P9 `
; H0 ]% ~- E$ N9 n( \( u- ^
'{$ElementUpgrade}', '{$ItemPierce}');");6 k' e9 O% X; i
}
' N+ c% B. ~' E! \
; ^# i, m9 d9 O8 b1 |}
' i( |6 x1 `" t9 l6 \$ M3 Y; b0 Q- Y1 |+ v- m7 f
}
( u7 r% z% h: \  ^* s/ r+ z" I$ U, B/ O$ W/ Y
$InitForm = InitForm();
9 x6 V) P2 t+ O, @" B$ P3 [2 D$Listener = PostListener();3 }  ^. B5 M* D# A6 j4 T
3 n  v) H7 A8 v# J: }) _
?>
! {$ S# W- ~; H6 k0 Q
- j5 x; d2 W! E$ |  R
; I: |. D/ u# j7 I5 d# T2 b9 z! A5 ]' Y( {% }" `
& R" c* H5 N: r4 k4 U& V" U
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-30 16:22 , Processed in 0.069288 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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