飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
) b/ ], B; A" {2 C$ }  ofunction Connect () {+ d0 M3 Q! O+ Q4 \. B
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB 8 |2 U( J2 w# f  o# F3 E
4 r. O+ ~! p3 k/ c4 M& x1 V
Failed.');3 x' p% \8 F4 O
}
2 \, l3 y' }4 f) D6 }Connect();
0 u' V5 s7 L. c3 f7 D8 r( B! c2 G; Q
4 J* `# @, f. B4 Yfunction InitForm(){6 o4 _; W* f. t
//layout for the form
" Z3 ?, {+ u" D$ e( c1 O6 _. O- ]* Hecho "<strong>Send Items.</strong>
+ l$ A+ k- }) y: H! X/ o4 t<form name='select' method='post'>
1 Q+ f# T& |6 J- R' n" R; s4 g& }( |4 F0 S<lable>Character Name</lable><br/>
7 H) P1 j  f- g. u0 c% N+ ]1 Z<input type='text' name='char'/><br/>
6 @+ c9 B& O7 r0 L* C<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
$ Z3 L  M& c0 B( N3 |: H/ {" R! t<input type='text' name='item_name'/><br/>
" S, V. B) b' J" x# U& ]- N<lable>Item Amount</lable><br/>
* a# Q$ W# f/ h' e* {. f<input type='text' name='item_amount'/><br/>% o; t6 ~4 v( L" l2 ~; j; l) _
<lable>Item Upgrade Amount</lable><br/>* ^4 m. N( L, {- b
<input type='text' name='item_upgrade'/><br/>/ ?, L: F1 c' h  z, z! k+ t) |
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)3 a3 Q9 ^9 a0 K6 Y
% q$ A+ Z% ?- L8 c+ Q  d
</lable><br/>
/ Q& F; J9 |) l: ]8 S<input type='text' name='item_element'/><br/>7 a) J7 E- I2 v! \, @( a
<lable>Element Upgrade Amount</lable><br/>! ^! f, `! \. ]  @  ?
<input type='text' name='element_upgrade'/><br/>4 q1 N* u' W% i
<lable>Pierced Amount</lable><br/>
5 l( a& S3 Y) F! a1 }( v% \<input type='text' name='item_pierce'/><br/>$ S( u' Z. F, W9 p
<input type='submit'/>
4 f& R+ S% x" y0 ?' s8 v4 K</form>";
- \8 d% T! }" U. b8 \}) F% J' n) p* w+ e3 d- Y- _, w
, O- b0 y2 @1 a2 ^
function PostListener (){
$ y: }( ~. H; R6 o$ i//Add more post variables if needed and add them to initform() function aswell+ ^2 W5 A% b' |4 B; q

* D) s& x  i7 \( p# p################################
* m2 L8 k/ y5 q3 t7 ^##### Connection and Post ######% v" N! N( X4 A- O: M+ d
################################
$ T  ]7 Z% B: S1 U$name = @$_POST['char'];
1 F1 c7 _2 Z0 K8 S$ItemName = @$_POST['item_name'];; w& ~6 b2 p( h* T
$ItemAmount = @$_POST['item_amount'];; k! W* ^0 P+ v( P" {; a) \: j
$ItemId = @$_POST['item_id'];
+ }/ V8 W, }- W: \- n% o$ItemUpgrade = @$_POST['item_upgrade'];' W0 q# S" D6 P* R" e, I0 ^
$ItemElement = @$_POST['item_element'];
; O( F7 x* f3 @9 C  ~$ElementUpgrade = @$_POST['element_upgrade'];" N7 Q0 S7 j( d1 q! I; `
$ItemPierce = @$_POST['item_pierce'];2 t) X& Y& R  j# J
################################
% x$ d  s7 J, p4 ~7 \2 y( L- P; f' V
# w. S" C0 D% I2 J6 b//Check both variables for empty value
/ R& l8 E' e. |3 o
/ [( G5 a3 T5 L1 n- w4 a; W  a7 sif (!empty($_POST['char'])){
5 h0 r' ?3 b2 j+ J* R$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where * R6 g8 N. @7 Z* _. h5 [: [" e
5 `; g' c; s8 \. P+ X, F: m% l' `
m_szName = '{$name}'");
$ N5 k8 ?3 [7 Cwhile ($row = mssql_fetch_object($find)){' ]7 X) D8 L) E4 E" e7 p  z
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";0 H- ^" t; Q" d% C% j) B
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], : h- U* N) i& c
% r4 H* M1 \9 M: f# a  C! |
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
# I5 `+ M! C5 ~) s& ~; w9 ^+ {
7 L8 j3 M/ ^# E  m7 C[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
$ E2 |2 ~/ V" b$ i! z! Y- s6 L* G8 d1 q- T& M& A
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
1 E0 R9 l" I' u+ j( f& A3 }$ Z6 h  j" y( M% i0 G" i
'{$ElementUpgrade}', '{$ItemPierce}');");8 X2 M* Z  L9 Y/ h
}0 O  a& w5 B" k( V
+ j" C. S2 M3 I! y
}8 a/ I' O% Q4 X, _5 p% I5 f. Z

5 W. `0 Y- z! b! Q6 U}% `" p' a0 ?1 Y* h# a& m* y: V, @

8 }) x7 e' V: [, H4 D$InitForm = InitForm();: |% b0 S& v: J
$Listener = PostListener();
1 r) C5 {# `3 [# K/ v7 t! A3 U/ m# u4 O( g0 n- }9 r
?>. r0 y3 n6 b5 W$ [! y# [' Z

$ b: w8 m# b. w0 p0 ^' u
6 `& i2 K+ F  L# T5 Q
, j, x! O0 v' e, o' {0 a- p% S4 }
( U+ a1 c. S+ U3 M3 y! ~
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-14 17:44 , Processed in 0.061131 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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