飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
- b" d; a! S/ K6 |function Connect () {3 N8 x  d; J7 z2 F' \1 v
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB & W! }0 D/ F9 \2 r; M9 B; ?+ J, w

" i. U( z+ B8 b- s- w0 }5 [Failed.');
: l- i7 N2 z! ?' N8 {}1 h3 D3 I. [* Y
Connect();5 H: B* p9 n! ]8 P: g

3 i) w. v) P& q( Ofunction InitForm(){$ U1 @' h$ L8 o# }" c5 `
//layout for the form
- }" i- B1 s! k5 Secho "<strong>Send Items.</strong>  @/ d, |  R) w% @
<form name='select' method='post'>
/ @0 \% F0 ~' h. u3 E8 g0 o<lable>Character Name</lable><br/>1 O! [  m: o2 `
<input type='text' name='char'/><br/>& @( A& U0 ]  Z- x% X$ F4 n( F
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
9 o0 O# t. {3 A" m<input type='text' name='item_name'/><br/>
9 Z, W; K0 }+ A, i- x) t<lable>Item Amount</lable><br/>
* C  w. `% ~! N4 l+ }<input type='text' name='item_amount'/><br/>" T( A6 A1 M4 Q" ~
<lable>Item Upgrade Amount</lable><br/>
3 E3 v) x8 _, b$ ?<input type='text' name='item_upgrade'/><br/># L5 \6 u: w- a3 u3 y4 B( v- h, }
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)& C. E/ _; x9 |3 l! q/ H" Y
8 L$ K( I2 ?* ~/ z, s8 _
</lable><br/>( M; w4 z4 g+ M2 p7 b4 T
<input type='text' name='item_element'/><br/>: c: j2 M) t, s7 [( O
<lable>Element Upgrade Amount</lable><br/>+ T: B5 _9 F. T9 c8 A
<input type='text' name='element_upgrade'/><br/>  G2 z/ {3 e2 N% _2 V
<lable>Pierced Amount</lable><br/>4 T9 H, k4 u, B, |5 p" ]7 V+ J
<input type='text' name='item_pierce'/><br/>/ N+ `* i' \. y0 b! u* ]
<input type='submit'/>
0 g: m2 X, N3 y) c* W# F" N</form>";( ^6 j! U% B3 F% `- ~
}
9 A' I/ ~4 k* Q' J( I; X( w; _, G- H
function PostListener (){4 S+ ^2 i0 j5 `: I
//Add more post variables if needed and add them to initform() function aswell
' C) t7 c/ l& y% I% @" X! ~6 E' }; S; {$ ~- w; K' _* t/ k
################################9 W! w# N+ D! s; H! A3 R) ~1 w4 Y
##### Connection and Post ######
; G8 e3 e/ U5 W' N1 `+ Q1 @################################# @: D) Y4 p# _( H3 _
$name = @$_POST['char'];: O/ e& [4 D+ _; |
$ItemName = @$_POST['item_name'];
5 \- c0 A, F" M2 W7 F+ r3 n$ItemAmount = @$_POST['item_amount'];8 A0 {1 A: |1 e" Y- t0 z- w( ~0 E
$ItemId = @$_POST['item_id'];
) X0 A/ P: n0 D4 b4 [" k6 ?$ItemUpgrade = @$_POST['item_upgrade'];
, H/ L6 D2 B; u$ItemElement = @$_POST['item_element'];! F- O% p0 f) ~1 @4 W
$ElementUpgrade = @$_POST['element_upgrade'];% c' D2 `0 A: g# K8 k1 O6 Y
$ItemPierce = @$_POST['item_pierce'];: C) q% K7 |/ [7 c- z7 [& C2 a  w1 x
################################
+ w! d+ @! G; S! j- L& S
3 D) _- m3 _& K6 W$ Z2 w, p//Check both variables for empty value+ ~6 A- O' f" L& D3 D# _  A
5 J  f# H- L$ n& [6 h% B- r. |
if (!empty($_POST['char'])){
6 z  F6 Q% E8 L$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where . e" w4 C. j  [+ P

7 l6 i" @5 p* V8 Km_szName = '{$name}'");. f/ E: h9 U4 q2 o2 G$ H' b
while ($row = mssql_fetch_object($find)){
1 E/ Q( e5 g( v5 ^( x  }echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";( z( f0 }( c, v) T# n4 B
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], : ^0 N1 v6 z) D  N/ W1 F" Y
& C& d/ p& }/ I. ?% _: b6 [9 [8 U
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], $ x3 Y1 a' d2 U/ F, D

8 }( J& V5 Q9 ?/ Q( O# u) s  V[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
3 l# ^, F5 ^% `6 _/ z# ]; ^! D. ?3 C* N. ?! f. P
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', ; P0 ]' \6 W7 {: r9 v; Y2 J" q

9 x0 R, K  Q$ c" q6 C: U5 d'{$ElementUpgrade}', '{$ItemPierce}');");
8 `: K5 p% ^* l+ I  C8 Y8 g7 g}
6 U9 d( l4 d8 b% P5 @
5 S) R( R$ T8 o8 I  a5 P' ?}
3 k! X7 x, a3 |7 e. e+ b" x: F- ?& k' M0 b4 `# Z: _
}; q9 Y8 Y& ~0 M' y1 T- \

, ]7 j  _) a" {0 S$InitForm = InitForm();8 x! Y8 s, K7 U# t1 r
$Listener = PostListener();8 F* s0 e6 l( A; e

& j- ]$ I9 W3 y' n; t?>% o& Z' F2 x7 |) z: x6 y9 a
/ g- T' G) K  i* ^& s% }
/ M3 ?) [4 A& T9 I" y, W4 E; K

' z  n4 p! `3 g
/ ^. |5 C5 @8 M4 m8 ]
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-18 19:45 , Processed in 0.067538 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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