飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php( Z1 E( S0 |# N) m$ V
function Connect () {+ P" r: P; e3 x9 @* c3 a9 X: j
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
7 Q2 j# \. k" _' G4 u
- w3 W! z* L( k1 q# i) G  TFailed.');* B3 K4 }' V; r( m3 ~- b* f
}) |8 D, w+ R; r, r1 [/ N, Q: A+ f
Connect();, n0 U- Y- b9 e9 l. D6 p

0 H3 k5 J' S& B; }* q2 g" xfunction InitForm(){
) R8 o, |4 ?7 J2 p//layout for the form
$ G" J) _1 V8 oecho "<strong>Send Items.</strong>
. R& w6 G& Z* j: N4 c! X<form name='select' method='post'>% J* p  A5 p1 [( a5 t
<lable>Character Name</lable><br/>
! ^+ y4 S5 P  ^<input type='text' name='char'/><br/>
+ P1 I8 @) w2 z<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
6 [4 \3 R6 Y8 ?) I  I; _<input type='text' name='item_name'/><br/>7 p& w! V8 ^2 f+ \9 v) K
<lable>Item Amount</lable><br/>
: t  t3 m" }3 s6 B<input type='text' name='item_amount'/><br/>
: U+ t) q, W, Y<lable>Item Upgrade Amount</lable><br/>
6 U  ]- Q& J  J$ o; D<input type='text' name='item_upgrade'/><br/>
* K, @/ c" W- L- P<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
: i& A- T* r% W. R( i
& t/ [8 U$ J' O& M3 b</lable><br/>
$ x- y; h0 f; s+ k4 a/ d0 m& z<input type='text' name='item_element'/><br/>- Q/ j% }( r, N. d: w
<lable>Element Upgrade Amount</lable><br/>1 p' j$ y7 H' x+ W+ C1 H- i- P. H
<input type='text' name='element_upgrade'/><br/>
0 w( A0 E& M! G0 z# D( }! Q<lable>Pierced Amount</lable><br/>
: U* X- [# b( Y9 J1 C* t; t<input type='text' name='item_pierce'/><br/>
9 B5 X- w: r! o2 r8 ]0 W# {$ y<input type='submit'/>
- V" c# {% L9 p3 a: `</form>";$ ?; v4 a! V$ `: _. N4 U3 Y, M2 R4 N
}. _; a! ?8 L5 `! p
5 ~" }4 {! b: |
function PostListener (){" V+ z  ]- ~  P
//Add more post variables if needed and add them to initform() function aswell
9 z9 \5 v! n' U( d2 \/ b  A6 X9 J4 D  s
################################
3 N' @4 T) d  P0 P##### Connection and Post ######
( l8 ?/ f% {8 [9 {0 f################################
& t; f8 ^1 Y, y. D! j  p$name = @$_POST['char'];! Q, K  L! m" f6 T* y) ^
$ItemName = @$_POST['item_name'];
+ C6 M2 B) x) F8 L1 P" b: q$ItemAmount = @$_POST['item_amount'];
) t7 o7 Z: ~' J$ItemId = @$_POST['item_id'];
7 \+ l- j) J& K$ItemUpgrade = @$_POST['item_upgrade'];
# l! y9 B- g# @$ItemElement = @$_POST['item_element'];
& J! H& a! O0 x1 u  z6 a$ElementUpgrade = @$_POST['element_upgrade'];
0 k* @( k# W. |3 z+ @$ S2 T- k* K$ItemPierce = @$_POST['item_pierce'];
" n& O" Q+ Y* W- x5 {################################% {/ k, Y7 [! u
1 l! ?! Q- v1 {* U6 f6 `
//Check both variables for empty value
4 H+ j$ }( W  M4 ?( m+ y
- x' K, c  D1 w1 p- B2 s5 R( Yif (!empty($_POST['char'])){
5 R6 I( b, j7 ~; W$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
' O2 k- k3 x6 D& V* _6 R7 r; v1 y: ~' g
m_szName = '{$name}'");, I: T8 v) b9 E) n& w- ?# _
while ($row = mssql_fetch_object($find)){6 D2 |6 l5 b8 Z# z: O
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";3 i% U" b" |; h* V3 q  g
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 7 T/ G( p$ X3 \; M- Z& w2 ~7 S. O
0 R" l$ l2 t1 u
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], * n  ~& K/ }  E. @% }: t, T5 Z0 g; K/ O

' A9 D% }$ |, u) C, [$ P* @: J$ Q! [[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
' _% [  E- i# `/ G$ M5 \
! u2 A& B& @7 y0 O9 k' bN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', . a9 |7 y8 s" g8 x( @2 |

7 e3 N6 ]4 @# f; u+ |' T, G'{$ElementUpgrade}', '{$ItemPierce}');");! O" J  p  z  q. v5 K. H+ [6 Q
}
9 Z! ]3 J& V$ R- Y5 k+ l: m
7 j- X- ~: B2 S2 D}
  H) v; o6 F! K/ ?  g
% X( i; c+ a) b; a}- E6 L$ n+ Z: F0 J4 B& j4 ?
; `/ r  ~2 ]& C1 c# h1 G
$InitForm = InitForm();1 r4 a$ y: T$ j. p
$Listener = PostListener();% T* O! s& ?5 g6 e8 l
! a9 f6 Y0 J( a, E
?>
: w7 {9 M- P" b! a4 E9 s. D1 f0 `6 x' m- U- r

9 a2 x3 _) A5 i( K
  v1 z; ]1 l% B- y, e9 D0 B
. v$ [* ]; i' a6 {1 h; D
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-16 23:38 , Processed in 0.059478 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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