飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1068

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1068
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
6 J1 D, `8 J& L' `function Connect () {2 C  h. ^" S9 Y' c
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
1 i# `+ I; v9 E" A% f1 Q* P* P8 N4 n/ L
Failed.');) }: h6 V+ |/ W- [/ X2 D
}
- s* a5 R* u0 Q1 ]' CConnect();% a# ^0 s1 a7 |8 [) u$ Q

7 V% ~9 W: S; I+ Ffunction InitForm(){" w* y6 u0 C$ G0 _$ \1 y* o
//layout for the form
0 Z6 D$ G% ?3 }/ {" Y% [  Fecho "<strong>Send Items.</strong>* R6 `' k: D+ k  _/ J6 V" R
<form name='select' method='post'>
% Z% }: T) a- j& _<lable>Character Name</lable><br/>. K2 v; L$ o: U( J/ Z4 f- h1 j
<input type='text' name='char'/><br/>
' P9 a& A. ^) D- X<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>& J2 w9 r6 h3 x4 y% ?) S
<input type='text' name='item_name'/><br/>
$ }! g9 o/ ?9 g: l+ m3 I2 t$ o<lable>Item Amount</lable><br/>; @  d/ a$ V, y1 i
<input type='text' name='item_amount'/><br/>
: e% l, E1 I% t6 F<lable>Item Upgrade Amount</lable><br/># q) Z0 }  G2 A$ Y$ @# W
<input type='text' name='item_upgrade'/><br/>
$ ?8 H7 i% w' C2 v8 P( v<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.). h  N0 L+ ]: s4 P$ J. O' [
! z# T' v& V$ ?' W& x4 u
</lable><br/>
7 A7 V2 Z( ~5 j) X+ k<input type='text' name='item_element'/><br/>
0 I/ w& r+ r' S5 f0 Q; W<lable>Element Upgrade Amount</lable><br/>8 r  @. M% q/ k) L( S( D" x
<input type='text' name='element_upgrade'/><br/>, b' m" n2 l8 L% V! p
<lable>Pierced Amount</lable><br/>
' R# y* c0 h. a& |" T4 `2 q<input type='text' name='item_pierce'/><br/>
9 w3 V, C+ h& a' y6 S<input type='submit'/>
& |6 l2 R% G5 ~  Y/ o</form>";
3 S1 y4 H# N1 B1 M}
. Z7 N4 t& L9 E! c! @' l  B, I  [, G+ H) i) e( A$ P) E6 G) q) y
function PostListener (){& `9 t- X7 G: i2 F; U  N: j  q
//Add more post variables if needed and add them to initform() function aswell
' T; c+ C, n6 N& t; j7 w% c* J
0 |5 `8 C- ]4 |, k9 I+ m  X################################
# G8 [: X) g  ?##### Connection and Post ######
: Z3 s7 k# Y' n5 @################################
/ b5 M" @1 N- {" h; M$name = @$_POST['char'];# ?6 _9 F) R9 V" c
$ItemName = @$_POST['item_name'];( Z$ Z- J# K% m( ^( k
$ItemAmount = @$_POST['item_amount'];) Z+ H" s) y/ b. ^
$ItemId = @$_POST['item_id'];  ~' Y1 \# R, R' x
$ItemUpgrade = @$_POST['item_upgrade'];
& I: I' H1 i! `5 V) F$ItemElement = @$_POST['item_element'];" P, g$ p- P/ {& y! K/ A
$ElementUpgrade = @$_POST['element_upgrade'];: s' r  p' a1 N. j' H- H# u
$ItemPierce = @$_POST['item_pierce'];* H$ Q* W& K, U, b
################################
, s/ R+ Y4 G* k: s  B$ i+ @5 V! h' b* G" y. v) ^
//Check both variables for empty value
* E! }" G- R- ~# a/ b1 L' f% Y( h3 z  U7 ?, i) ]4 z
if (!empty($_POST['char'])){% k% X* x  C# j, E$ D7 h
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where " k3 D/ H" z0 }0 _9 m, f
$ l) D2 W. V( _9 H3 h, p
m_szName = '{$name}'");
6 ~+ v8 m5 l" Uwhile ($row = mssql_fetch_object($find)){8 W$ C2 O! |' D5 B# S  o+ D
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";; F; ~) N. K( D& ~3 u# c6 |
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
9 T% S( o4 G" ?9 Y5 E
6 |! |6 J: i, S- H! G, F) z[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
8 Z3 D3 `; q. x; d+ Q4 t8 I3 Q% z( P" Q/ c6 M8 u; M; c
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
4 _8 D+ H% t% `; ~5 N" L! q
3 a4 I2 G2 M, CN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', ( s9 H5 P9 m, |! ]

+ a3 u( L, E, C$ s'{$ElementUpgrade}', '{$ItemPierce}');");4 ~, f4 ~0 r# q: l
}
9 H' @& t$ ]* H8 L* [* G7 E1 G% \! c- l' P6 T4 d2 @
}" F. D. ^; i1 Z- B% r1 [
8 Z$ ~" ]& l- B  f6 q' M( X
}
8 P  S' y* ?4 }6 _, p# P9 o+ ~5 i0 W1 }3 a
$InitForm = InitForm();
1 e% ]" L  _8 D$ J; {9 h4 p0 w$Listener = PostListener();
5 e* f  @9 a! ?! E5 P6 @- i5 M9 F# K
?>
% Y& u- v' v* N5 c) G9 \% x3 K9 j1 g8 D9 M; x
; G" n) }$ U: z1 q0 b

2 u( u( z! ^0 Q7 z; y# o, J4 W# |
: V/ p: c6 e& ~" Q: B* z% C! V
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-8-28 09:20 , Processed in 0.063494 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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