飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php: [% n5 b: w: B3 b5 ?
function Connect () {
# Z$ G* j9 g5 H2 V7 X7 p/ Xmssql_connect('Server','UserName','Password') or die('Error: Connection to DB
6 @* {1 K, z* N" j( U! v2 k5 U5 S' \3 ?- S( B6 r: V% B" }- ?
Failed.');
7 ]+ L: u+ |% b7 i0 T}4 R& l9 o$ B( ^* v- \3 K
Connect();9 W4 S; K& I7 A5 Z) B/ O
, w/ C3 L; r, @  I
function InitForm(){. D' ^" M( ]( v; F+ ~6 |# L6 t
//layout for the form
5 ?9 X4 r8 Q, F, A. L5 D( [6 G5 Hecho "<strong>Send Items.</strong>+ @' s: ~2 a- a: w
<form name='select' method='post'>/ L3 e9 E! b. j+ ], Q# ?
<lable>Character Name</lable><br/>: I- y" Z; f7 N! `- x& `3 e; |1 u6 M
<input type='text' name='char'/><br/>
! d' \8 y4 Y' P6 e$ X5 ^<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
5 p& t0 e" J/ t<input type='text' name='item_name'/><br/>8 G+ O" b: g; K9 z6 I
<lable>Item Amount</lable><br/>" J3 ]- M8 L5 y3 T9 r
<input type='text' name='item_amount'/><br/>$ ?! Y" A* O1 x/ y( Z! E( o4 z' f: J
<lable>Item Upgrade Amount</lable><br/>) s  {& C+ Q! ?/ B  B8 ^* L" R
<input type='text' name='item_upgrade'/><br/>
; h* `. h: R6 T" g9 i) y7 Q<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.): X; p) j7 K+ o6 T
# h" Z3 W* E. i% Z4 k- p6 T* A" L# R
</lable><br/>5 L+ f' h7 `8 m7 f7 T. K8 M
<input type='text' name='item_element'/><br/>% `- c+ f: M. s0 T- [) n
<lable>Element Upgrade Amount</lable><br/>, `8 N5 `9 |9 ?$ J$ N* M
<input type='text' name='element_upgrade'/><br/>  q9 I7 k" l1 h% ?6 i
<lable>Pierced Amount</lable><br/>
6 v! \# i0 L' {  ~<input type='text' name='item_pierce'/><br/>7 J( G8 {# @, }. P
<input type='submit'/>+ }% ^: u$ L7 d  U
</form>";+ i' v( D7 S. B+ Z6 n- \( u: }
}# N) t  K, @0 h# N# _

+ P) Y9 y1 M$ `# ]5 ]function PostListener (){
' }$ `6 T% S$ q. ?6 t//Add more post variables if needed and add them to initform() function aswell
3 g# Q1 H6 Y. ]  h' O9 A- f; i0 m1 a" A1 r8 `! N
################################
' {( T8 [' i2 m0 K' {/ Y##### Connection and Post ######8 k0 L0 K+ O* y' u
################################
& W- x7 s# g+ S$name = @$_POST['char'];
( V( u3 X) d/ Y$ItemName = @$_POST['item_name'];4 l$ |3 ], Y3 O+ g
$ItemAmount = @$_POST['item_amount'];( |1 m: ~2 \" @* ?: m
$ItemId = @$_POST['item_id'];
6 r5 ?) V5 W9 l+ M' p' ~3 d& U$ItemUpgrade = @$_POST['item_upgrade'];
4 v5 H$ e+ b& U' @" J6 U9 G& c  ^6 e$ItemElement = @$_POST['item_element'];$ d- t7 X1 w2 d
$ElementUpgrade = @$_POST['element_upgrade'];* s4 ?- z0 Z( O% u
$ItemPierce = @$_POST['item_pierce'];1 e- a5 y( C& k0 Y% @3 M; L: d
################################
. I7 A2 w$ g& N: b7 M9 d# m3 @# {! G  G
//Check both variables for empty value
; p* a( n9 m: s! ~/ }3 w& ]
2 k- G, E, l( T: U: C) O. Cif (!empty($_POST['char'])){( f: ?9 W0 t2 _# T5 H- _& K
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
- I, Z9 `- u4 U# x0 e$ L" p
$ K- J' e% H$ V: ^2 Qm_szName = '{$name}'");
0 s9 t+ ]) ^; Y7 D4 O" [while ($row = mssql_fetch_object($find)){4 S4 R; H- p  W: |! K
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";2 K2 n& Q+ M: E5 {4 _
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 1 Y/ t* j+ E# c' W7 b
% @+ f4 C& n$ w. R
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 9 _3 ?9 ^/ x% Y$ f) j; Y! O

9 b+ m2 c6 \- H  |+ ^- B[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
0 X( A9 \- ]6 M) n8 |
9 I" O/ o! U) L: |. D) DN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', 1 q& f2 U$ W' h( E) M
* {6 ~- R$ [$ D: ]
'{$ElementUpgrade}', '{$ItemPierce}');");9 h7 P; j* m) H6 P6 @5 o* u# h5 `
}/ z4 n' g% T% x3 `/ ]* U4 H! l$ g
7 R8 p! X, U  @
}! P1 Y/ [, u1 R* X3 |$ k

4 j/ u& ~  K4 R}
8 n- ]" L3 x, ]) V
$ y% D- H$ [2 I5 Y& ?+ i$InitForm = InitForm();
7 ]: O; f7 E6 y$Listener = PostListener();$ L# o" S1 W) s& i) @  i& N, c8 _
: Y4 |; I8 {3 F! `7 ^
?>/ ^5 _( f# C" ]- v$ y" {
" s1 w$ Q# d! r& x' w

7 t# \3 h4 t; B  u1 k/ v- m- j% n7 D" x# P0 g! Z' B9 }

& N6 }6 q  f8 s4 m' \; M  i
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-11 13:41 , Processed in 0.059109 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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