飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
' ]7 z4 S! Y1 Jfunction Connect () {
4 ^! Z6 A' ?: _% o$ V' q' K# n/ @mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
. V1 f0 L! E: h1 Y2 `
( G: Z$ q" g0 S! v( ~  A. CFailed.');2 K9 h( n. L8 A6 L4 m
}
9 N$ ^% y+ T$ v" t) P' N* \' zConnect();* k9 e4 d$ F9 J" E4 Z3 t3 b  Y$ t
8 T# J% V' _1 |# F- p- X
function InitForm(){' |/ v6 ]- z7 D
//layout for the form' E! P2 K! \, r* k) ?
echo "<strong>Send Items.</strong>
) s6 {) ]6 X+ L$ v  g9 I' n$ w# J' v<form name='select' method='post'>5 A% k( M. Q2 d% K
<lable>Character Name</lable><br/>5 a1 G$ ^( z( Z( _7 }' T* D9 n% j  [
<input type='text' name='char'/><br/>9 Q; f7 g3 ^2 M  [. I' c; x0 C( m8 Q
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
7 r2 ?9 ~; ^) W<input type='text' name='item_name'/><br/>4 M' q$ i- U% C2 C! ^6 Y
<lable>Item Amount</lable><br/>
$ `- c6 O7 T% K3 @: k<input type='text' name='item_amount'/><br/>
% g* D: U$ C& p7 j" X8 T<lable>Item Upgrade Amount</lable><br/>
' i) i" r0 z. x' m; d<input type='text' name='item_upgrade'/><br/>
: ^) Q/ @! _/ i# e' X5 R7 i8 r2 c<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.): X  p$ u9 f  x2 X0 W

, S0 \! Z. L4 c9 z9 R: O</lable><br/>
0 @1 c# c: q8 r9 k1 F9 \<input type='text' name='item_element'/><br/>; I5 h) n. c3 Q! S( i, X
<lable>Element Upgrade Amount</lable><br/>8 l% P+ y' Z6 h- U
<input type='text' name='element_upgrade'/><br/>
  N% D2 ]5 P' B# N! W<lable>Pierced Amount</lable><br/>
, v9 H( Z( E6 Q+ {5 Y) u9 K, i<input type='text' name='item_pierce'/><br/>, K( ?1 {; f5 W, {
<input type='submit'/>9 X/ G/ E+ B9 W8 U2 L, [
</form>";
+ e" k2 t# C8 t* z}
$ D+ W. s0 ^8 W# y, w# S/ k4 T& ^, S( j8 J9 N8 |/ G
function PostListener (){
  K, g. }/ g: J* h9 l//Add more post variables if needed and add them to initform() function aswell) B: b3 R: s" t
/ z) n0 [+ J8 P- P+ d
################################
6 _+ _; ~6 [; R& A/ O, ?##### Connection and Post ######
/ A5 Y4 S/ [7 y6 _################################0 B' z! d- a; Z* V
$name = @$_POST['char'];
7 \4 I' _" e6 _5 u5 Q) U/ \$ItemName = @$_POST['item_name'];  D! Z6 }/ y- a/ C0 t& z( r
$ItemAmount = @$_POST['item_amount'];: h6 s  {6 w9 f2 Y( {' n, P
$ItemId = @$_POST['item_id'];. _  a; ^0 w% f) N
$ItemUpgrade = @$_POST['item_upgrade'];
& {+ j0 Y/ x( v, Z$ItemElement = @$_POST['item_element'];
) N1 d& a: q3 A$ElementUpgrade = @$_POST['element_upgrade'];8 a/ H" ~( X2 a: L7 a
$ItemPierce = @$_POST['item_pierce'];
" |0 A3 m5 F" u) c) |0 S3 B################################8 _2 `' x5 L4 |0 m$ ~
8 G  J# Z, y" k# m: g; t
//Check both variables for empty value+ r/ x$ \2 u- d9 ^* W* Q8 t
! z$ W7 ~8 }' i. K; {# h
if (!empty($_POST['char'])){( i! t# Q4 o+ y" }4 s  r. k
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where , s# C: n0 u/ J, o# l/ g

- r. m7 o+ Y7 C. C# p7 i* Mm_szName = '{$name}'");. j, X8 Y- J7 ~$ X5 \2 u( ~
while ($row = mssql_fetch_object($find)){/ k1 e; g. e, S2 p  Q
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
* X6 {& ~- n3 v: l9 c$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], / R: W; j) }) v$ I# ^$ ?2 }
) [  G) w. `3 Q0 W9 P
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
6 O- f$ p0 L( m+ [
& o( y% O2 \8 W7 k[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 0 n7 M6 S( B; j8 a9 Y
: Q$ @' \7 s6 W% B( |
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
. U* p) j8 K3 T9 T
5 r1 J- A" I5 B( F2 Z'{$ElementUpgrade}', '{$ItemPierce}');");
: e8 q: w; u4 C$ }! s+ x}4 d& r+ ^7 N' |% X& ~& p

/ \' ^9 ~4 N5 _, T6 k5 |+ F/ U( t1 x}
" H  C" c1 L) U  ~: K( [
4 z- x1 N! [  c6 b" d}1 X& _- j, s7 U: u  x

% d8 m9 b3 e0 G9 G4 F: p$InitForm = InitForm();
9 G% o$ K$ C. S  A$Listener = PostListener();9 U# \) Y8 d( h) T

# @. |& J3 ~. ~; u! ?5 }* {?>
3 \' n' e0 d  _# g. D$ e8 [" p
4 O3 h7 k% ]! f+ m' k* x+ P# o; k* E! ~: I# i
4 X' E/ G8 f' r; K% ?  F& W
/ Y- w0 S- E2 \& W9 {+ B
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-14 05:50 , Processed in 0.060331 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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