飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php( M, M+ @2 s7 K* C
function Connect () {
& b, W5 i+ u7 A4 [' u1 {* Imssql_connect('Server','UserName','Password') or die('Error: Connection to DB
: N. a2 y$ J% p2 [6 }3 i0 f1 _
& x8 F: P& A; D+ V) k0 P' IFailed.');0 R3 O& D8 _( j/ Q
}
0 I5 I: T+ k1 Z- M3 i# ?: k8 }. }/ m* VConnect();% o6 F  L  K$ O( I7 c: B/ l  K0 Q+ C

1 c( V7 u) a2 g* G7 T* Xfunction InitForm(){% X' L4 s( b$ k
//layout for the form
8 Z: S# }( l& f1 a, m0 wecho "<strong>Send Items.</strong>
& w, R1 ]8 {: u7 X: N" P2 D& T+ t<form name='select' method='post'>$ V0 W9 n2 d, \
<lable>Character Name</lable><br/>$ a7 Q1 [& e( l4 m% V9 C
<input type='text' name='char'/><br/>9 s7 h6 r; c$ z. P5 E: @0 Q% V
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
5 J+ C5 M" i+ k7 N<input type='text' name='item_name'/><br/>* r7 ]% ^- j( f$ o
<lable>Item Amount</lable><br/>
1 ^, X0 R+ [) l<input type='text' name='item_amount'/><br/>8 \/ e1 Q' g# Z2 ]8 d
<lable>Item Upgrade Amount</lable><br/>
4 \" D# D( ~# W5 g/ U0 B+ m<input type='text' name='item_upgrade'/><br/>7 ?  g$ @" T& p: y
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)6 f; w3 \' F' P, y
4 o. H7 J& |5 V  A
</lable><br/>3 O; S5 n0 {' s$ S" @
<input type='text' name='item_element'/><br/>
  L9 e9 b8 m/ ^' G+ x: u<lable>Element Upgrade Amount</lable><br/>
3 y) j( ~, q$ E. i<input type='text' name='element_upgrade'/><br/>6 W3 N, z# n# W$ A
<lable>Pierced Amount</lable><br/>- a3 k- p$ e( o+ ]: O/ E& L* Y
<input type='text' name='item_pierce'/><br/>4 j$ h! s* e4 b0 n  Q$ k; U+ m
<input type='submit'/># ?" B: C1 Y0 W( L2 u8 x
</form>";7 e1 E6 y2 w8 S2 v' W8 l
}
% ]) ~) q! x: B, m0 O) c( `2 L( V# O: i, K, j2 t
function PostListener (){
/ ~  n9 Q" Y+ x5 L) }6 s9 T//Add more post variables if needed and add them to initform() function aswell
; z8 a* a2 V) _3 W- ]0 N0 [; ^0 \0 I& ?9 @( U0 |4 A; H% f
################################' _: G: u' E, Q3 v; v
##### Connection and Post ######
% @' O) Z! I7 i. V" ~/ u# g################################
3 n6 _: B0 f" C$ ^! d% S$name = @$_POST['char'];6 c' R( c* l" J0 P7 S: ^3 Z. {
$ItemName = @$_POST['item_name'];
2 x# ~7 U7 Z2 f8 g) C$ItemAmount = @$_POST['item_amount'];1 ^4 m7 ^: ]7 F$ M
$ItemId = @$_POST['item_id'];  x1 ^$ `0 I6 J. r8 q! Y& z
$ItemUpgrade = @$_POST['item_upgrade'];% \2 j4 l: P0 Q( L2 I3 Y9 u1 w
$ItemElement = @$_POST['item_element'];
" j! w: p6 \& U2 [$ElementUpgrade = @$_POST['element_upgrade'];, H7 T4 ~5 R8 y( Y" [% D' z
$ItemPierce = @$_POST['item_pierce'];
" e' A( K! u3 J; o# p################################1 r/ ?+ z! r7 g6 i' s, S3 u# G

" q2 |7 Q+ G* X9 b//Check both variables for empty value
+ C6 F0 d8 G: _
$ G, i1 X; T' B; v& l8 v+ s8 Jif (!empty($_POST['char'])){- Z9 \% a9 M8 I# X
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
! v) K* m1 Y9 X7 F6 j6 c& p  [% L" j+ H! V; E9 w
m_szName = '{$name}'");! r% l- X% o4 V2 K: d8 q; G: U
while ($row = mssql_fetch_object($find)){
& Q4 v8 A6 `: X; |$ }% x4 Hecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
( }3 k( u( o- S( `6 Z$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
) o2 w7 S- J3 j8 ^) t6 C0 g- W, ~" E, \7 T. |+ l
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], / c' M, F. ?4 m% R* N; p5 Z! Y

  Q6 a: W* l( |- Q[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 5 O8 \$ T- d3 _$ q

6 B9 H. H/ i; Q7 T9 \1 T0 C8 s' o8 BN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
5 ~2 q. t7 f$ S7 V  J) O( s. t' k$ Q6 N3 t
'{$ElementUpgrade}', '{$ItemPierce}');");
0 P7 R& T+ e6 ]( E3 e}- g9 ?6 b3 ?$ |
* W% w; }7 J4 o) N% t! n
}9 i! a. e) z0 z* G

. R+ q% r2 Q7 j( @, k}# l6 ^. O! ~8 `% G' _
( q+ V& X/ ~" C. v/ D* w( k: Z; e
$InitForm = InitForm();
. ?% M( C# g" @8 e9 ?) _$Listener = PostListener();' {5 K* F1 n0 W2 t1 S* Y

1 k  v, _% {: c0 Q% k?>
5 m1 n3 N: H# F6 |1 K7 K9 d$ E7 }3 i: j5 Y( E. D  m1 ^

/ a6 ]- K& K5 U# p) G" ?* _6 ~5 Q" [; v

8 S# U8 _( b# \# x2 z/ X
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-12 04:51 , Processed in 0.070209 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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