飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php9 }; ~+ D2 [$ d5 }& u8 N! K
function Connect () {
/ X6 l# h. m% v( b, Umssql_connect('Server','UserName','Password') or die('Error: Connection to DB $ n7 `8 r( Z, g8 Q. P

' Y, |1 _5 k, P. m$ J0 R; hFailed.');
7 q3 g: r$ S$ R! }1 s2 H6 j, U! l/ T}& a, k/ x3 \1 s8 f) o4 E( Q) v
Connect();" y  P9 T6 E0 L4 k; L* I& b
, @! H& S: u' i8 @. z( Q
function InitForm(){
: J& k5 h$ U. K  x' j, [) X" @9 D1 _4 |//layout for the form  P& a! r# `) u! \# S
echo "<strong>Send Items.</strong>
! Z) t+ D8 f' u7 Q" T6 i( }) z' z2 F<form name='select' method='post'>7 C" h* K% P% }7 L
<lable>Character Name</lable><br/>8 d& l2 h' L# Q5 ^9 n
<input type='text' name='char'/><br/>; m6 |  J. e* {4 t8 z! f8 L
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
5 t- E3 v9 y$ Y1 m<input type='text' name='item_name'/><br/>5 h* g) }+ }8 ?; k' A
<lable>Item Amount</lable><br/>
8 W5 k$ o) F4 w+ X<input type='text' name='item_amount'/><br/>/ ]% C$ q8 u/ [" C: }  r
<lable>Item Upgrade Amount</lable><br/>
0 D' R6 g# h- m# f( T<input type='text' name='item_upgrade'/><br/>
" j1 X8 v/ K9 f  }+ U( w; K<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
2 g$ U8 ?$ @( b* {* F6 i# `4 e( z  p/ W4 C# Q
</lable><br/>! x5 b) A3 i8 b( z
<input type='text' name='item_element'/><br/>
7 M/ @' E' q) W<lable>Element Upgrade Amount</lable><br/>- F. t8 X4 p  _) i" l
<input type='text' name='element_upgrade'/><br/>, E8 c) o$ _+ l& y% c& h; @
<lable>Pierced Amount</lable><br/>
( y7 f7 j6 r' P<input type='text' name='item_pierce'/><br/>
7 n3 Z, C3 s* I/ }0 T' J<input type='submit'/>
: V8 X! s! C5 J</form>";
9 b1 {4 O) X* I& x}
* I/ M) ]# D0 a% ~0 k% s! A- W
1 Q3 ?$ g; r, O- w0 {" D/ m; }# Yfunction PostListener (){9 `4 q9 B- l8 p4 i% t
//Add more post variables if needed and add them to initform() function aswell/ F' g4 P6 T! Y+ L+ _# x

. J6 s9 F  G! J$ Y2 t, }" M' \################################0 t! D1 _) r3 j0 E
##### Connection and Post ######* V) ^2 C8 ?# c; k7 L* X
################################; n+ t, b  d5 L) P+ D1 p# w5 K
$name = @$_POST['char'];) s1 `9 {( t& J9 W( l; S$ c3 ]8 I
$ItemName = @$_POST['item_name'];* q* j: f: N5 r# W! n
$ItemAmount = @$_POST['item_amount'];% J  \4 \7 t; y( I3 f* J
$ItemId = @$_POST['item_id'];. @% l5 q. M* b; R, W- i4 Z
$ItemUpgrade = @$_POST['item_upgrade'];
7 N# C  ~" p6 Q$ItemElement = @$_POST['item_element'];  Y& f+ ]  C- \: \% y0 I
$ElementUpgrade = @$_POST['element_upgrade'];8 |0 J' }6 {: O! X: S1 N
$ItemPierce = @$_POST['item_pierce'];
8 r; L6 e& ?, E; o* f2 k################################' @' c. F0 Y/ w; N  j

7 g) v( O3 a5 b- D0 h" G1 n+ T5 D//Check both variables for empty value. L* M; Q) e+ E
5 r) i) u# U; X0 }0 b
if (!empty($_POST['char'])){, @! Q1 m6 x6 Q% G3 z/ A
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
; m. o# u' d# M2 a4 ^  H3 A- N
3 \) A$ p6 B8 k* _5 x* c3 gm_szName = '{$name}'");
' W* _/ h/ {) g( iwhile ($row = mssql_fetch_object($find)){6 V/ p1 y* \" u, Y
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";$ X9 y% J( ~& `' Q
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
# A8 n& {5 L" K$ f+ v% ^" _
; y4 `$ A  M0 s3 z[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
* J3 `( s* r  T% t
+ L' W- l1 f5 I. K) b# E[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', ) j/ w  `$ ~3 I" h/ {( {1 F

# T2 Z; W2 K& L, m7 rN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', 2 z+ [2 ?1 L  Z; V) @

9 R+ A( a$ X& F5 d. e$ r2 a'{$ElementUpgrade}', '{$ItemPierce}');");+ N7 o9 m7 \2 I) Z- D( n) F
}
3 O* z) u3 _! j  i: S
0 H% _, a; P" `. H7 v- ?}
6 K( d# n" Z! |, y, F  f" x8 y: E/ X2 M& C/ i
}: X% A  J: ]/ y7 r8 I
! Q  D: x- \" N! g8 Q& M8 D4 t
$InitForm = InitForm();' u* M  z+ u- K3 N. R3 g
$Listener = PostListener();1 F9 u6 h( V9 G8 w8 [+ W4 q" z
# ^% v; [* U3 Y, r
?>
( y6 t) F4 k: L' ?
7 x+ v2 s- F# N0 u6 r
. w8 I3 ?4 [5 d
4 O: p! K7 u8 L' A. P7 Z% Y* `4 ^& u- g6 @2 @6 u1 A
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-7 14:41 , Processed in 0.095125 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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