飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1092

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1092
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
6 t( Q' K; f* L8 v2 zfunction Connect () {
9 y) v8 R: M- y1 L) Y+ Gmssql_connect('Server','UserName','Password') or die('Error: Connection to DB
. v: g, J/ z0 f- X+ w: r9 i
# a0 x! z& E3 T& n* M# aFailed.');# H$ a4 `. V2 e
}# x5 d0 r, Z$ l$ ^" x* H9 q
Connect();
% p. }1 z, a5 i( U. i0 y2 C! r; g
function InitForm(){% ^4 c6 w! D+ u+ {; K% f
//layout for the form3 b* K" `& u* i& w
echo "<strong>Send Items.</strong>  ?, a! H) I. _$ G/ D( g
<form name='select' method='post'>
; h: Y: `- X: `# V2 D* e7 s<lable>Character Name</lable><br/>6 C. E. h; U7 n
<input type='text' name='char'/><br/>1 Q( a6 H& Z2 @5 P. O: ^
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>7 n% h6 l0 M1 n. ^2 X+ r  m
<input type='text' name='item_name'/><br/>4 q3 H* ^3 B2 l. O/ f) p
<lable>Item Amount</lable><br/>9 A  |+ e* K- M' u& D6 n5 G
<input type='text' name='item_amount'/><br/>
( c' S9 |& `& R' c<lable>Item Upgrade Amount</lable><br/>! O5 q/ o6 Z9 n: H& Q. s" f5 U
<input type='text' name='item_upgrade'/><br/>
- h% B0 z* \0 ?" A- D7 A# {<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)' k4 Z, D$ J" x( h! y
. ]9 C- F- [3 W8 i) Y, W3 x1 G
</lable><br/>+ s" i% @7 E4 e
<input type='text' name='item_element'/><br/>- Y) i/ Z/ @( g8 j; F
<lable>Element Upgrade Amount</lable><br/>
0 |; B9 j' q$ q9 I# S<input type='text' name='element_upgrade'/><br/>
: Z5 J/ |- o8 C8 m<lable>Pierced Amount</lable><br/>$ }) q" d! T3 u+ W
<input type='text' name='item_pierce'/><br/>
9 t4 B0 {2 u' r<input type='submit'/>
+ y: S2 c: s4 X7 A3 h</form>";
! |1 |& Z- m6 s9 }) K" z}
  p8 p9 a- Y2 I. F+ J
8 F9 }" |! l3 {function PostListener (){4 S" O0 L9 n! p  m% f5 n
//Add more post variables if needed and add them to initform() function aswell( ^$ v) x* G7 D6 N! {6 t3 W
. ~$ F, ]9 Y7 z; Z
################################
/ Z3 R& g1 U' _) l- L& k, D7 f3 m) K9 j. y##### Connection and Post ######
9 z9 }3 Z& J- J! W! {" {$ O################################3 \, H; ~% W+ i6 f0 @% `
$name = @$_POST['char'];
3 D) p# B, d9 O, L/ [$ItemName = @$_POST['item_name'];
' P: y2 S  B0 [0 E8 ?5 \. ]+ Z$ItemAmount = @$_POST['item_amount'];1 s8 r. Y: J# j
$ItemId = @$_POST['item_id'];4 W7 z* c: ^. v% h; f
$ItemUpgrade = @$_POST['item_upgrade'];
" u9 l& @" N" m1 u$ItemElement = @$_POST['item_element'];
% Z2 x: \) U' p$ElementUpgrade = @$_POST['element_upgrade'];
/ M9 S1 M0 z" [* l1 A, U$ItemPierce = @$_POST['item_pierce'];
& Z- Y0 S8 M2 i' p0 e' k" z7 r################################
+ u3 S+ G: r5 F0 M& K2 y0 _9 U* y* q
//Check both variables for empty value
! ], Y8 b3 H9 \7 K
  M9 C; ~8 R& k! Fif (!empty($_POST['char'])){; F! O% D6 L/ ]
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where 1 W+ f" D. a$ T3 i9 `

- ]9 m# W  ]( E9 }9 c+ g' d) Gm_szName = '{$name}'");
- w4 i; }: e0 Zwhile ($row = mssql_fetch_object($find)){
: n! a8 a+ {/ gecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";# a/ d1 }5 T6 Z+ i3 Y
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 9 \: ^$ ~! {' {. L+ p) J; v
# h6 o7 I# x; ^! \' n8 R
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 9 T* y8 @4 Z# k% w- n" b+ b

" I! U+ C4 x0 a3 m; |( o[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
+ l: Y3 H: A# A$ p+ \, T8 L$ g% |9 N6 J. q- R. c
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', $ e7 p$ v0 k' _( q: z* I0 r
& W$ f* _1 o2 G$ h6 V
'{$ElementUpgrade}', '{$ItemPierce}');");+ J  l# f8 j8 J; G
}
6 |6 k6 F3 N6 g( u
) ]: Y( I2 ?8 l! O1 L9 L9 X}
! u$ V4 @  V; c* k; x# t3 M( I/ T5 C& x+ N+ f$ j
}6 Y% C. k# l% d$ L4 t

$ U# b3 D+ V2 y4 `. s2 N" g$InitForm = InitForm();' n& P3 w- _- j  I, e  Q: j8 w
$Listener = PostListener();  E/ t9 s% e  q7 L
) q* ^8 X/ E3 s4 W
?>
1 j" y; z4 t6 c8 t9 ?
" _# e/ \! F5 l9 u2 i1 [7 c& Y
! n# [  i/ h, u+ D; u
9 y2 D; y9 q6 G# O4 y
% h! |- \5 o- F) k/ i& a$ }- k, u
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-30 07:14 , Processed in 0.072982 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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