飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1088

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1088
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php1 R" N8 s' z$ e8 s6 L
function Connect () {% D8 Z, a: {* M& T2 f2 H$ U
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB 6 U7 E9 _: u7 O: f" f/ K

  b* G" p9 f+ DFailed.');9 S2 [+ d( Z' H$ Z' W
}
% q0 I" t5 J' p* H( \4 qConnect();9 Q9 N  t! b8 J" Y" w
$ l9 d2 |& [. e
function InitForm(){1 L9 y3 Z) ]* ~7 u" ^7 C' q
//layout for the form
" S) [( e3 S. H# Iecho "<strong>Send Items.</strong>
# U# T6 E. e, W2 Y2 ?) {<form name='select' method='post'>
9 h5 D% P$ H& U& l+ {* n<lable>Character Name</lable><br/>
4 x0 y6 Z  y( M1 L% M' k7 F, ]<input type='text' name='char'/><br/>
$ l4 [$ p3 n% z0 c* h/ }<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>% {$ B5 Q- L2 t7 M6 h9 D- X# u, g
<input type='text' name='item_name'/><br/>
# L& }- D. _( E1 f" W<lable>Item Amount</lable><br/>7 F, D2 D9 H5 w6 F
<input type='text' name='item_amount'/><br/>, F1 {- b2 ^* d5 F; K& B2 a' q
<lable>Item Upgrade Amount</lable><br/>2 C6 D7 r; `  _3 r9 B
<input type='text' name='item_upgrade'/><br/>
/ O, q2 u& S& D) R( S+ E<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)4 F* y  v& D. j  U4 o3 C
' T! }/ K, f% c; L  m/ ^7 T- d/ f
</lable><br/>
7 i. K) I% |; s0 I1 M7 o3 X7 t, j<input type='text' name='item_element'/><br/>
/ p! [# z# f. f  u; i<lable>Element Upgrade Amount</lable><br/>
" G( \& p% W0 _<input type='text' name='element_upgrade'/><br/>! Q$ k! F: I  R9 {! u- Y$ Y) [- X
<lable>Pierced Amount</lable><br/>
: Y6 Y% B# Y6 f* c+ Y5 ]<input type='text' name='item_pierce'/><br/>
' W6 C# W  Z0 q: m! e- Q- u  _<input type='submit'/>% c- C5 l) ^2 M: j+ i
</form>";
- {9 k. C; X8 p! w+ w# l}
3 t1 Z3 f7 G) e# q5 }( g: u, \  p2 G; d1 [; z8 w1 U
function PostListener (){
# y" E8 |( S. O  h& I//Add more post variables if needed and add them to initform() function aswell7 ^4 U. {' t& k, k* r( u

+ Q$ L, M5 ^- K! e- N) ^4 g% O################################
- z: I& Y8 A8 R$ d  ?# g9 W##### Connection and Post ######, V0 Z9 L5 f# B+ ^( E
################################+ ?$ Z3 x9 ?; G
$name = @$_POST['char'];
2 O, w6 H3 S9 {+ s0 r0 g$ItemName = @$_POST['item_name'];
2 D$ \' ~% k  \* p% U; I( b' i$ItemAmount = @$_POST['item_amount'];
- {$ ]  |0 g9 C3 L$ItemId = @$_POST['item_id'];
! |, A6 x" @* o7 d) B2 M$ItemUpgrade = @$_POST['item_upgrade'];: ]- ?5 S  C: l
$ItemElement = @$_POST['item_element'];" K  p7 f( r4 q* R8 }  l
$ElementUpgrade = @$_POST['element_upgrade'];5 F% g# \7 v- [. n: o4 I4 f1 V+ p) g; D
$ItemPierce = @$_POST['item_pierce'];+ d* ^. ?1 U$ A8 p
################################9 ^8 E& v5 ]' @, k# W
% W2 r* }4 J& g% f7 ]. T
//Check both variables for empty value
. ^- J' C- i' ~# X5 s: y9 o
- H) d0 ?* N2 U  Q$ aif (!empty($_POST['char'])){! u1 Q" I& A. Y" m
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where ) B& r7 i+ ]* u- D7 R
! v2 b$ ]  Y# t4 W2 G) {
m_szName = '{$name}'");
' T( z+ W: D7 cwhile ($row = mssql_fetch_object($find)){* E, C- [# \$ M  Z+ f
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
5 A: I: T1 R) h$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], $ [& z' c+ ]6 O6 i

4 [. V4 q9 F& l  N# @/ d( B, `6 u[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], . ~# E, ^7 k7 I1 `3 V

) J! t4 v6 N$ a! O/ w5 d" C[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
* J2 ]: _% n7 k5 H) }6 N
* C  V4 [$ e6 U1 G. `N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', 0 D6 E5 q, b& [. N

: O' U0 f* W, \3 f: G4 i6 f'{$ElementUpgrade}', '{$ItemPierce}');");) ^2 y; X! q4 f# S" o. z
}/ n) |4 i& I: q( o" g7 T3 |+ `

$ H% L% J+ g7 O. y}
1 x1 c$ n, L3 O( P* q3 C- H% h% y2 |% D' g/ n
}
# i3 E8 V/ T9 h& q% N3 g
( S+ J0 P7 F  V9 v/ c$InitForm = InitForm();
- Z2 l! d4 h% j3 ?$Listener = PostListener();
9 V2 x/ J1 b/ p% Y! Y% |: i8 p
) k9 A  y7 x+ P0 P8 Q+ t?>3 ?, S' ^, r2 X+ c8 N0 r% X, T% K

" A: f. h0 h/ C! C3 O- }! Y
' f# z4 h7 A9 m8 _8 q2 [& ?7 Y
" X8 j6 r$ n& G; _2 ]' Z9 Q6 T5 ~( V) \6 m3 r
回复

使用道具 举报

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

本版积分规则

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

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

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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