飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1078

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1078
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php" k" e* x" Z2 e/ f
function Connect () {8 `( i3 F' b: k3 }
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB ; N/ {! P) \' R! s* }+ X! U
6 b2 W6 @, W$ }6 ]# l2 a, S
Failed.');" u5 Z7 s8 {, \, z7 l, t
}- ?0 ]7 W' t7 C( L0 g' C; e+ e
Connect();: l8 U3 t! G: Y5 z7 F

+ G0 v$ }: v; S! n2 R1 Z' Kfunction InitForm(){8 ?& P2 e, D% h# y$ i
//layout for the form5 P" t) D5 a4 r
echo "<strong>Send Items.</strong>$ K/ H- X( v  W$ F9 k
<form name='select' method='post'>- a& i) q8 F7 c7 @
<lable>Character Name</lable><br/>& I& T3 L- o$ S% k" h2 m
<input type='text' name='char'/><br/>
' ?$ C4 e& O3 v- ?<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
; a  `- _# j) d& z# g<input type='text' name='item_name'/><br/>, S& u* @8 B+ i5 ^
<lable>Item Amount</lable><br/>, \3 E3 e0 K3 d6 I) f% j
<input type='text' name='item_amount'/><br/>
) h' x% ^7 I4 {. ]% ~<lable>Item Upgrade Amount</lable><br/>
( R  Q6 L+ M. n  A2 ]5 n<input type='text' name='item_upgrade'/><br/>
0 V" `8 X4 F- b9 t$ n<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
2 ?8 d5 ?) I3 Q, \+ F( u! s! }9 X. z* p! I( F' {0 U
</lable><br/>2 I1 h' w6 P  ~2 ]
<input type='text' name='item_element'/><br/>
& b( h: d5 F/ t8 e+ ~7 T<lable>Element Upgrade Amount</lable><br/>. F6 a, n8 c2 t5 H2 c4 f
<input type='text' name='element_upgrade'/><br/>! L+ n( ^" }! F$ f5 p4 Y1 q
<lable>Pierced Amount</lable><br/>
- t9 a. ]/ w1 a- Q( n- j<input type='text' name='item_pierce'/><br/>
/ ~4 M0 o* e6 R6 F<input type='submit'/>
8 }- j4 @) O7 a- d2 f* R</form>";
+ ]! \+ s, F9 h9 }0 @3 c}
4 p3 N7 o- K  T( g% n
6 E2 ^! ?9 y" t( R& q# E7 x) Dfunction PostListener (){" Q1 x" t6 b2 l! l. q. A0 O6 d+ e3 F
//Add more post variables if needed and add them to initform() function aswell
7 Y. `  B! ~: w+ ?7 w
2 D5 Y3 X8 `" o, M################################
5 f- N; u. X; z" \2 s+ U##### Connection and Post ######' f5 B: p9 A4 x; k- t0 q  _
################################
, {# ?' C9 E( b' A* z8 g7 L$name = @$_POST['char'];) u9 _9 B" Y( D8 c: i. \, Q
$ItemName = @$_POST['item_name'];; N1 J, C6 ~; V8 U3 K$ g$ ?
$ItemAmount = @$_POST['item_amount'];1 ]3 A1 Z" t$ w6 p3 u, ]1 ]! b& \
$ItemId = @$_POST['item_id'];- P3 d! R6 E& b9 U
$ItemUpgrade = @$_POST['item_upgrade'];6 ]& Z! p  I4 l# Z! m) v* N
$ItemElement = @$_POST['item_element'];
* P, ]/ G' n$ d: J+ w$ElementUpgrade = @$_POST['element_upgrade'];
( a$ e# ]( _! E$ s; Z$ItemPierce = @$_POST['item_pierce'];
: ], L3 R) E; }% i; h################################
, x/ ]$ F' ]% J- `' G" N% h
" @6 ]. L! i& o7 o. \& b//Check both variables for empty value: s& u" Q- T+ y% ^$ X
0 d6 S( h% t& }6 o) ^0 _0 h) f
if (!empty($_POST['char'])){
& j% p* ^5 O3 t; w) _7 v- s6 @+ D$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
# k! t5 H7 `1 Z2 B. u7 b" ~, x- s9 W+ A, C# l! ~& d
m_szName = '{$name}'");3 G1 o( w6 K! P1 _( M$ b
while ($row = mssql_fetch_object($find)){
4 K8 M* M1 w  F1 A6 \' x8 g. {, L) u1 O1 ^) _echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
8 G; V) \( w" R. f0 e) F. O$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
2 \  u  V9 x1 q( e1 s0 H" z
+ T/ O. `& \, {* Z. O$ a[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
/ f. [, O: r8 w( G6 C; o2 D/ P. Y/ ^& ^
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
0 N% h1 r  `6 u2 s9 r3 n$ A# b8 O  u8 @" |) u9 G
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
" m7 s1 f. u( z$ i
! {& ^2 Z+ J% Z# p7 f'{$ElementUpgrade}', '{$ItemPierce}');");' N1 W$ c1 i# r+ C% l3 o
}
* U1 u# t7 W% P
. L  s/ P1 V& y" L9 e) u2 H# z}
4 W, V1 o7 t4 Y2 Y) K& y; T6 s# d! X9 n  R5 K! s3 V
}5 l! l2 s7 e+ y4 f

* e+ F. W- r! E: U$InitForm = InitForm();0 Q% V: p( Y+ o+ I: X3 b( T
$Listener = PostListener();
' C  J) u+ f1 u0 n- J3 T+ Y" R- T
; C) ~0 C- c# w) P- I/ i?>
$ ]1 u0 \$ T* J: I# T( w
( I% ^: O/ _9 N9 d0 R% n1 o- V7 k/ a- @4 P$ p1 O2 d, v& f
/ e$ |' |2 W8 f0 Y0 s. V0 Z
% B2 K6 J: k' ?1 j# @9 S
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-10-22 20:00 , Processed in 0.066221 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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