飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php7 [: v6 g" l9 U
function Connect () {# q5 V6 y6 Q. U( v
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB ) G* K+ A, o& Z5 l& |$ T

3 r0 X" w7 S/ @' WFailed.');, }) V# T4 l+ X$ s/ \
}
" Z2 g9 v8 T+ l' G& u8 xConnect();: C) L/ w- Z1 U( r8 A1 @9 a# v

/ j# G! Y5 \# F$ Wfunction InitForm(){
5 t1 C  V; k1 ]0 L2 f1 G//layout for the form8 W& f/ v- J3 Q
echo "<strong>Send Items.</strong>1 T2 `, P3 L' d; g, [6 A
<form name='select' method='post'>
  `- ]0 I: I& v( b( {9 O1 g% t<lable>Character Name</lable><br/>
1 U) U* @- l' T5 A0 J" {, p0 Q<input type='text' name='char'/><br/>
8 e% H5 f- H# T: J" y: _3 P% ~+ \, z<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>* ]; ?% r0 k* U( y# X2 {+ Y
<input type='text' name='item_name'/><br/>
" W# _0 y' s! m* J5 C<lable>Item Amount</lable><br/>
  o: @% Q: o  Q$ z, [% Q$ _4 Q<input type='text' name='item_amount'/><br/>
. L. v) t& s) J$ ]/ J<lable>Item Upgrade Amount</lable><br/>
9 U; ~: `- C. `$ ^5 O<input type='text' name='item_upgrade'/><br/>6 K7 ]4 b8 }- ?; c! ]3 q
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)8 N" A7 v& s! J8 X& |; y4 C
% T6 i) Z  C; {, r5 g2 g
</lable><br/>
: X5 |3 O- P. Z6 E7 |, J$ [5 R- [3 R<input type='text' name='item_element'/><br/>
' N7 f* c6 I* P1 t2 J- w! G' o<lable>Element Upgrade Amount</lable><br/>
  ]4 s' z" j# I% N<input type='text' name='element_upgrade'/><br/># g" S) D  \' j, ~# E4 e. W* `
<lable>Pierced Amount</lable><br/>  h" G, ^3 y  `
<input type='text' name='item_pierce'/><br/>; h: H: S" y) m3 ~- S9 K
<input type='submit'/>& h/ q; X4 D7 ~: l' n
</form>";- N3 }1 m$ V7 r
}0 T$ ?( x3 r1 [) R+ _. v% @- G& h* G
) T& B/ \  f2 N+ J9 v7 \& h
function PostListener (){
' j3 {; _. y2 I3 t  }/ V//Add more post variables if needed and add them to initform() function aswell7 b0 j  v4 q4 X( S5 f8 h% A# k# R
: b: x. w, |4 o$ s, P6 Y
################################3 ?% W8 n+ Q* }' H
##### Connection and Post ######
/ t9 m7 n! \0 g' I3 j: n4 V################################
) W4 ?! s5 H) H4 x$ W5 _$name = @$_POST['char'];
5 P) J, W8 M9 o) F  e$ItemName = @$_POST['item_name'];
5 I& U, [+ k+ k7 Z6 p$ItemAmount = @$_POST['item_amount'];
6 Z4 [  Q# ?7 i0 F1 F$ItemId = @$_POST['item_id'];
3 p) A$ j) E8 I  w0 l7 C$ItemUpgrade = @$_POST['item_upgrade'];9 w4 _( w& |1 P. v, p- }
$ItemElement = @$_POST['item_element'];: `1 ^3 e1 q2 n% G. i
$ElementUpgrade = @$_POST['element_upgrade'];6 h- }7 s, W% g8 x/ Y9 W
$ItemPierce = @$_POST['item_pierce'];
; ]( O3 Z- I$ l8 a################################
0 B. ]0 Z2 m, ^& C9 u. b% r5 }( Q6 r3 t3 I
//Check both variables for empty value
+ [; L) [8 k3 P2 I" q2 {# {3 j! |( V0 P5 u. A1 k) r4 L& R
if (!empty($_POST['char'])){6 y, b; _/ C7 l/ ?
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where 2 v  f% @; P$ }5 G1 A9 u- U

9 [6 l/ M+ _# l, k8 nm_szName = '{$name}'");
+ O; f' z$ ?; z  {* a! M+ W0 f7 ~while ($row = mssql_fetch_object($find)){
1 d- j- O, f4 Yecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
$ I- x, i2 h: l$ X$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
! S  r! |% ?- @$ q
  p3 N, P& a* _$ o5 j# g9 V[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
% F" O7 z% N/ U6 j  E
# E$ w, J+ O! n* v[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
" k, v" s$ @" ]! H) {+ p2 u! C( c) ~1 z! p
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',   {; r7 O+ O/ W# P% o' P8 E

, x4 d: R7 o9 Q, {4 w6 t( N5 G'{$ElementUpgrade}', '{$ItemPierce}');");
2 }3 K& o& [' \, @6 e9 \. Y}, p: v' X0 o6 Y" z1 F

8 ^0 O8 b7 A, b}5 M* ~; }- j8 U+ K# L$ b4 I. y
$ L" F! J+ m5 T! w( U6 T
}! `! X& a  y2 M+ k) \

2 ^1 o& h% r8 S: z$InitForm = InitForm();
8 R5 {0 q( H% Y$Listener = PostListener();! ^: p5 t) U; x/ y. q

+ T4 [: }: L; O  M2 e, b?>
, M/ P! M+ [) Z1 w  G$ t# p& _& R2 M) \
& Y" I) a5 D9 k1 d+ @' G
( P# K$ v9 g9 S9 m( j/ Z2 Z) y

% T# `$ N4 C! M% m& M: D% U+ ?5 e
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-18 21:33 , Processed in 0.058788 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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