飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1088

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1088
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php$ |- J, n2 `- V  j, `$ v! G% A- M
function Connect () {( N" k) S( Y$ [% p# ?! |
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB 9 h- q9 o7 `. f6 k5 U

- t/ h9 m; W3 a! `Failed.');0 }4 N' q# R& `9 L4 b9 d
}
5 \/ g/ I2 ^& wConnect();
, Y/ Z2 l3 k5 P7 t" L/ `# u# H2 Q- K( R3 N% l- @5 Z7 }+ W# k
function InitForm(){
& h5 P/ P( j6 F% }//layout for the form, |5 ~& L. f+ O7 I6 K5 g
echo "<strong>Send Items.</strong>
/ K: ?" E2 e# ?. [  t( ?5 j<form name='select' method='post'>
' x; t. O& y0 `- ?9 _; z' [<lable>Character Name</lable><br/>. F# Y% g8 ?: ^1 d
<input type='text' name='char'/><br/>
. o0 k/ E& ]8 B$ n) n7 M% R<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
- J3 U- W) C7 j0 Q  `; }( @<input type='text' name='item_name'/><br/>
1 c1 N2 R9 X- G. R0 Y<lable>Item Amount</lable><br/>% d) S7 |8 v% |2 A' S5 ?2 R
<input type='text' name='item_amount'/><br/>+ g  F! R# i: s7 ^8 k9 m0 w' i/ M
<lable>Item Upgrade Amount</lable><br/>( |# Z& \  S# T$ L
<input type='text' name='item_upgrade'/><br/>3 x' \  y7 o( N' d9 C7 o4 V
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
5 f  @/ a. H( m7 j- u* D
1 _) N9 j  P8 c! }0 S( e# q% m</lable><br/>' \" w* J( X8 W* d0 _
<input type='text' name='item_element'/><br/>% R; T# s' L9 C- N9 _1 M
<lable>Element Upgrade Amount</lable><br/>5 ?2 y* ^$ V8 S
<input type='text' name='element_upgrade'/><br/>
: X) d: `6 H" A<lable>Pierced Amount</lable><br/>6 `3 D/ V$ q! C! S
<input type='text' name='item_pierce'/><br/>7 C  z0 k4 b+ `$ D. A! @
<input type='submit'/>
- S8 p; O1 Z- h) X$ \& Q+ h: p</form>";2 |  t. e4 g, B: B
}; d/ Z, D) M/ f4 y" N) @7 M3 [6 P
/ Q" U8 L6 ?& c5 m
function PostListener (){
. J2 a* W7 M0 L3 i) H3 _3 J//Add more post variables if needed and add them to initform() function aswell8 I+ V4 F* `; ^; Y5 l! Z# D

9 P! D# \3 v7 v) A' @. n2 Q################################+ `4 j  `6 I/ \& y. b( ^
##### Connection and Post ######" K5 Q$ r- p4 L7 X% d( Y8 T8 d6 a) O
################################
" W8 P) d5 |4 \7 J" e$name = @$_POST['char'];
, g0 j" H  i4 K0 i! s$ItemName = @$_POST['item_name'];* y0 r8 m5 I1 I- I
$ItemAmount = @$_POST['item_amount'];3 q" X' q  u3 E0 H* _8 B
$ItemId = @$_POST['item_id'];, B- E7 }, S" b; x
$ItemUpgrade = @$_POST['item_upgrade'];
* X$ T( ]6 p* x$ItemElement = @$_POST['item_element'];
0 b% X) a: Q! V  s1 n$ElementUpgrade = @$_POST['element_upgrade'];" [0 f' g% O8 @' }
$ItemPierce = @$_POST['item_pierce'];
; t. D7 J% g( d6 m8 G################################  U+ l) v8 i7 z0 `
$ Y& c1 ?% l7 p- P7 M7 ?  C  N, l$ }
//Check both variables for empty value% L  {0 _+ C7 b* i
* A! z. H. _5 E4 }, G+ o3 x: i3 l1 V
if (!empty($_POST['char'])){) F8 W1 m0 M0 h  I! A
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
4 J& e/ C+ S5 p& P* v- R7 Z+ U! T- t% {5 r) z, V; _& W* T: p
m_szName = '{$name}'");
6 r; q" [, C3 \3 Q* Fwhile ($row = mssql_fetch_object($find)){
6 c5 ~" S  H" Z* ^% a- h2 _3 aecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";8 T/ Y+ J0 c% k3 b
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], ' U3 |8 t2 _/ y" o8 r

# K) i' Y% O$ j7 k[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],   a3 w4 A8 {# ~2 G
. j9 i5 _$ J$ w/ [! k& l
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
$ D4 a  r& U1 U! X/ \8 b* ?6 a" u5 N! K, n
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', + J7 M7 k' D+ x) p3 v+ U3 L, \
' u& @9 n+ n. A7 W$ E, \
'{$ElementUpgrade}', '{$ItemPierce}');");1 S4 q' R# B8 J. \! K1 [) {6 S6 j
}/ |) r5 u' W+ ?6 b, e
% f; j; D. {6 t8 M$ n! c, y
}+ H2 {6 d' f9 J; q% ^- ?) K3 y
, R/ a& D* R7 _. ?/ {0 o7 |; T. f
}. c  j3 C  ]/ g3 Q1 [, \

, L1 q1 n$ g8 r$InitForm = InitForm();
* R* v% F8 U+ x. Y$Listener = PostListener();
3 F( W, N) a* g! \# i9 q. E4 C9 o8 }5 X! N
?>0 S2 q% m) R' K" z) ~0 y7 {
5 @2 J4 s& }+ Q" o4 r# o
1 P. e; ~7 f3 s  u8 J& ?8 _0 a

  [; c% v: v# `. U3 T$ w5 N2 s0 ?0 b% I% y  l+ E- D; ]3 `
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-25 23:49 , Processed in 0.058744 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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