飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php3 i& W' |9 `/ `) R1 j; e9 K
function Connect () {4 C3 q0 n9 f0 C
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
' @7 q- ?$ e# n6 R) P
- A7 B# N% J" l  G$ xFailed.');. }& l; r6 w& p) V
}# X' n; `; R; S; a6 @( E
Connect();% l9 Q# `( V4 K
/ w) z3 j0 |4 y& J! R7 |
function InitForm(){% U7 x8 O1 \. Q
//layout for the form" M* F+ L3 c9 s# b% v; _& q0 i1 ?
echo "<strong>Send Items.</strong>
7 N' L2 K8 G5 {% r0 Z<form name='select' method='post'>6 c( I* k0 _* Y1 A" S' V! D$ O
<lable>Character Name</lable><br/>
+ d: D' O' \: c9 ]( i9 ~<input type='text' name='char'/><br/>. I& c$ @$ z$ K
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>2 `# R2 @+ _2 J& n, A
<input type='text' name='item_name'/><br/>
2 V0 f( g$ N1 x  u' N4 G$ B- {<lable>Item Amount</lable><br/>
5 y- v4 X$ H) k- X<input type='text' name='item_amount'/><br/>3 e" |; ?) e# |5 f+ W. `6 F
<lable>Item Upgrade Amount</lable><br/>
& |7 a+ y- t- N5 w<input type='text' name='item_upgrade'/><br/>- D, p" v2 Z% z" g! W: V5 d: M
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)# t! r7 b# |$ F& w
$ X. |0 K9 o0 M, S" y
</lable><br/>
, Y4 C+ E5 W/ D  Y5 a<input type='text' name='item_element'/><br/>
" V/ C8 o* x$ L3 l<lable>Element Upgrade Amount</lable><br/>5 o! c+ ~6 P8 s- y6 K3 T/ [  D
<input type='text' name='element_upgrade'/><br/>) P# N/ @. V' X8 W/ b
<lable>Pierced Amount</lable><br/>
0 ^! f6 u" K: L4 b# X3 J0 g<input type='text' name='item_pierce'/><br/>
* S. U7 X; S  F" v<input type='submit'/># D' X, Q6 \! s; l- }
</form>";
. p" z7 ~& j% q. T% X}9 `  u* N* W2 o$ E+ a$ o
8 d7 W1 H; X! ~
function PostListener (){
- r* N& f2 k  t//Add more post variables if needed and add them to initform() function aswell( f7 h' i9 t, A9 o' e
5 h! W4 P) I% e' y5 p
################################# B  g+ J7 h) T7 w! L/ P
##### Connection and Post ######0 h/ |: R* b9 v: L' G3 Y
################################
% J( U1 y. o5 b: ~9 b+ d- {( M$name = @$_POST['char'];
. {/ Q  M$ r  s$ v+ D0 e0 q$ItemName = @$_POST['item_name'];
( v) r: V# V" {% N9 E0 ~% N& W* \$ItemAmount = @$_POST['item_amount'];( X/ t: a% C0 h& \* L
$ItemId = @$_POST['item_id'];; C" v/ |- S: y1 Y
$ItemUpgrade = @$_POST['item_upgrade'];
" P' H9 e( p; G& e# K9 O; s$ItemElement = @$_POST['item_element'];
9 D1 C. l, r% C+ S$ElementUpgrade = @$_POST['element_upgrade'];
2 G/ {; W# ]& v8 q* [$ F% x$ItemPierce = @$_POST['item_pierce'];
  |" w0 K: L9 k" y  U1 e" p################################
% c+ B) y  w$ W/ \4 j/ v" i/ I  d* p) O" C  N5 l
//Check both variables for empty value: e$ _" l) A5 w2 ]
; u+ J* y- d) Q! f, ?3 q
if (!empty($_POST['char'])){! _/ V: F1 J( f/ |
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
: C" c) b, h( L/ H; r5 m/ J; F' @& U8 f- Z7 z' J# H3 g
m_szName = '{$name}'");3 r4 T- e) [. ~& e. U
while ($row = mssql_fetch_object($find)){
7 ]8 \; F/ P( I5 D4 necho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
! R! w2 O, X- f$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
3 m/ G) z$ @6 z8 g! l0 H. }4 A
+ b; k  `8 W3 e# z4 n# l5 T8 I3 x[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 6 ^+ z1 b( U( ?) X6 m! k6 n
) u9 x5 |! v( X3 l# w) s. y
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
6 o. f6 }' G! T% ~3 o7 l
% e( \( O- l5 a+ m) G* l) K6 Q" cN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', & M" W$ e/ B2 E, i1 b
' Q7 l4 ^" [) A
'{$ElementUpgrade}', '{$ItemPierce}');");+ g) u4 k5 m! s) I0 B/ L
}6 ~3 |3 _. C, e. O

6 M, [6 X3 U# K! }}
. _" j7 u- D( |- i1 j8 O' X  n  v
2 o0 w: ^6 l+ ^( j6 l. \) Y8 x}
$ p. Q' \  k7 |4 P
2 G( A0 t4 [% G4 G+ D+ p0 g6 |$InitForm = InitForm();9 f* V0 w! n. y  P4 q% P) S$ L# d
$Listener = PostListener();
+ U+ A' x' ~  E4 p
: M  }; `" {* k- T# U+ h) F9 J$ _! y?>
- D9 P. F7 u% `" @$ u) w; W- n& X3 s1 I

* R1 z) K, q" \+ \7 n+ c: V8 V6 T
. o1 x& w- m2 E/ s: h3 m: t( f6 U7 C6 j
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-14 08:11 , Processed in 0.062208 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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