飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php0 d' G% h/ W9 o  _/ r. P
function Connect () {
1 ^) y- b3 I  }* `: G, J! E+ }% tmssql_connect('Server','UserName','Password') or die('Error: Connection to DB
4 G: ^/ b& \2 I7 R- _; {4 s8 {- c
/ @8 X: P( c! H1 HFailed.');* D* j* \2 e; Y7 \. Z
}* a# z: b5 |) N9 w+ C, q. X0 r+ O
Connect();
6 m) Y) f# f9 H/ X% a' O6 @$ x3 B
- e% Y* h- c' A2 B- x, rfunction InitForm(){
6 \3 z% {( _6 ^) z! q0 |//layout for the form
4 b8 j/ J3 n" }' secho "<strong>Send Items.</strong>
1 u% r3 T" a) X- ^# t2 I<form name='select' method='post'>$ O- y$ Z9 f" ?! P6 E" N0 {
<lable>Character Name</lable><br/>
+ n2 ~/ T3 _1 W- |2 P& V<input type='text' name='char'/><br/>
: [9 d6 f" R: g9 [  o$ Y! g<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>% a, o  G7 M% f# U& }% p" G( X$ Q/ ?0 T
<input type='text' name='item_name'/><br/>  Z* ^( M7 |6 Q
<lable>Item Amount</lable><br/>( T* M3 z; L* \+ q( ^, x& q% g
<input type='text' name='item_amount'/><br/>3 C- u1 j; `2 B3 W9 L/ m
<lable>Item Upgrade Amount</lable><br/>" _! s* u& d; a: \; f
<input type='text' name='item_upgrade'/><br/>' ?" F- @- y1 y
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
8 |8 ~6 P: T! ~  A2 m* {' u/ _1 o/ O
</lable><br/>: J, `* d- r7 S8 z3 h
<input type='text' name='item_element'/><br/>
" {* ~6 m/ O' s( Z( d4 b<lable>Element Upgrade Amount</lable><br/>* a! k# e% H" J* d
<input type='text' name='element_upgrade'/><br/>
' w0 }. R2 y* f9 z4 U6 ]" r6 {<lable>Pierced Amount</lable><br/>
4 W) A- x3 }) f1 ^4 H% R+ v1 [  @" H<input type='text' name='item_pierce'/><br/>
4 q' |" E/ g7 K' z' F# I" G<input type='submit'/>. s- |4 {# W! A; T8 W
</form>";
4 p! A; ]8 F9 T3 [* m# O% }! P3 l; f}
/ ^" [4 N$ o7 `' L& B- {* e9 C+ ]6 w- {; C1 a9 N+ Z. s
function PostListener (){7 m- l# U/ c4 h
//Add more post variables if needed and add them to initform() function aswell
' x3 O! d+ {, ?" I: i  V. ?% L: L/ {( k
################################: {; ~9 Q, r9 t. O+ z
##### Connection and Post ######
7 q6 T8 O. ~1 H7 @9 [################################/ n# g" {' T) ~6 c4 }# g' ^2 X* i# m
$name = @$_POST['char'];
- s7 `0 c: u1 g1 r6 I& [2 `$ItemName = @$_POST['item_name'];3 y7 {6 L7 D) C
$ItemAmount = @$_POST['item_amount'];8 o1 y7 l' t, ~( I4 g. x' E
$ItemId = @$_POST['item_id'];$ d' }3 a1 H" N4 \; j
$ItemUpgrade = @$_POST['item_upgrade'];
* v6 A0 t) p6 Q$ItemElement = @$_POST['item_element'];* |8 U4 m& F$ C  Y* f1 G
$ElementUpgrade = @$_POST['element_upgrade'];  Q! T0 A: L9 d1 j' a7 [3 ]
$ItemPierce = @$_POST['item_pierce'];0 Y4 i; j( l3 O- a4 B
################################# m" Z0 S6 d$ t2 }
$ H& U9 k0 }* C' @% q6 g3 G" l; E% W6 U9 D
//Check both variables for empty value
3 R* \8 f9 [" N0 H& R0 O3 g+ D. m7 G& e  c
if (!empty($_POST['char'])){
% C6 P0 U8 v" Y4 e+ V$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
5 O; g* u7 z+ U" N7 e0 ], h
% t: l3 Q6 u. k# ?m_szName = '{$name}'");
! n& x) A% Q& e. O6 j5 |while ($row = mssql_fetch_object($find)){2 O3 N. L2 P3 j( O, u1 t
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";  _( }% F# d4 C) B
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], ; s" h1 T% t3 C6 a- \, q

* P$ k  ]5 ?4 v$ ^$ J[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
8 m% D' }5 z0 a- b- d. O( i% m, r+ i- K( E5 g
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 6 x, L' @2 j5 u, ]- [. a0 f  m) X% X: o5 ?
9 g' ~5 i9 l$ r# S. u) ^, J
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
6 b& D7 n0 J3 P$ l) c7 v$ E% p  X) m3 g1 }3 G& r1 }9 B+ e
'{$ElementUpgrade}', '{$ItemPierce}');");
! C' E8 t$ ]( \0 G6 H}- v3 M0 B, Y/ a' g1 U8 G1 W. }) t& M' `7 u

( U" V/ V( `+ W" `& P}
5 `1 G) ^, Q% c! D% G; e+ w! w3 h9 S# y( t& k
}3 x2 m  m7 j  q3 m

7 b5 @& X' x  U: Y$InitForm = InitForm();
. t9 E# U. B/ ?2 q$Listener = PostListener();3 l8 S/ b" L& ]
# H- }" H& _, S# f. F% i
?>6 \' ^1 \$ P! B5 p) P: J

4 V  y5 h' o" r' N7 t) [/ C: p8 x# t$ \) u& f* q& x" i

: D5 |/ w- g1 ^1 e2 Z5 T* u- D  `! I1 p7 O  Q, H9 \
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-7 19:58 , Processed in 0.067433 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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