飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
5 h6 `( r  r- C3 s; l6 J, kfunction Connect () {
9 K7 H8 }4 {2 m% S  D" Hmssql_connect('Server','UserName','Password') or die('Error: Connection to DB
$ d: l; E8 x' w8 E
4 G' T. g/ D+ Y- X+ b  T4 ^Failed.');3 m- T% s9 T; o6 g
}
1 ?2 E8 L% B3 R, iConnect();
/ \+ ]- G; t: H! ?( J/ [/ k4 f7 ]
. N" y9 Q5 R" E5 Qfunction InitForm(){
4 y5 {" x4 x( S; g5 ]//layout for the form% L- [  N* V1 M2 ?: r3 S
echo "<strong>Send Items.</strong>
2 z( s( H. {( @/ Y/ P- p<form name='select' method='post'>
" H% w/ [2 ]& s5 T4 p<lable>Character Name</lable><br/>; S4 d5 R9 [# z, U8 H" |2 _
<input type='text' name='char'/><br/>. L1 u: j+ c8 B) o
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
8 W7 }% x" w- h/ i% E3 S<input type='text' name='item_name'/><br/>
7 _1 T, m# S2 f- ~<lable>Item Amount</lable><br/>
: p1 L0 R( @# Z+ M0 T<input type='text' name='item_amount'/><br/>
  D2 O* x( p0 Q" Z( w, W; p+ V<lable>Item Upgrade Amount</lable><br/>! c/ s' c6 G$ y$ [" a+ b
<input type='text' name='item_upgrade'/><br/>5 x- ~" E# t; O1 y- E4 s
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)& Y" c5 ?% q1 j8 Z  Y6 A
- S! R0 q+ B: r% C3 [, y* v- c
</lable><br/>
9 o6 ~( f% N( ^( a" Y<input type='text' name='item_element'/><br/>; X4 ~: k8 F+ @, D; \3 }
<lable>Element Upgrade Amount</lable><br/>
: ^2 T- M: B" r3 {<input type='text' name='element_upgrade'/><br/>
  ]2 J7 c! R0 m6 ?* d<lable>Pierced Amount</lable><br/>
; o5 D  g1 J: j$ Q6 k, e<input type='text' name='item_pierce'/><br/>" L8 u6 P: Z3 v6 M2 z3 v$ D
<input type='submit'/>
* Z# z8 K4 a& i  h# H- I* K</form>";* [& ^" Z& K- Z' `
}
" X% `1 S" Q! m9 u+ J) Y: j$ v+ K8 e  @5 w* H7 o4 T3 W  ]$ D* L
function PostListener (){
- j6 V# x# m, s0 w" Q//Add more post variables if needed and add them to initform() function aswell( u& y+ E, [' P4 g9 {. J6 q: I

, v. H6 B1 U9 d1 h1 K; A4 s################################+ m& R/ d6 e" B
##### Connection and Post ######
! X5 s; f$ |! ~# D+ g" ^################################& }; G- o& d* \/ i$ W
$name = @$_POST['char'];- j3 G! e& A, q, q0 R7 L5 \
$ItemName = @$_POST['item_name'];" n, c  U, P! v2 b9 T' Z: V
$ItemAmount = @$_POST['item_amount'];
' W5 C! v8 @' r3 @9 S- A$ItemId = @$_POST['item_id'];2 @8 R# L3 Q8 v' P
$ItemUpgrade = @$_POST['item_upgrade'];
/ ^% }+ J) W% Z) q' @) w" u7 v# m$ItemElement = @$_POST['item_element'];
, x8 E! s* `' P/ R$ElementUpgrade = @$_POST['element_upgrade'];
- o* z! |" Z  ^! u0 l5 p$ItemPierce = @$_POST['item_pierce'];, _9 p/ E  Z: @
################################, V) t, p" @/ ^
' q6 R# z. z6 ~) l3 q" {8 f
//Check both variables for empty value
4 n7 A& J! f$ I. A* R2 U! F0 O8 \- k7 D7 O* |
if (!empty($_POST['char'])){1 e# i3 l8 B* i% e& V
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
2 P; v) x0 j# V
( e( d7 K) A" I) n- C- G; `3 Tm_szName = '{$name}'");
% @, i/ _' e2 L- `5 D9 fwhile ($row = mssql_fetch_object($find)){
  h, Z0 G/ [0 necho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";9 B+ d# ^# k) R  e/ R
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
& l, M& a  w/ G  T) k4 ^
7 i3 r% M; `+ t. e. H! f' }) `2 p[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
$ h" T$ t# q% E5 Q( g& Z. f' ]# x/ A
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
. z+ J' G8 f, P5 b/ L. m
4 c0 x! I  W1 d# s; w( H7 u6 h" [N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', 3 l. |  R9 \5 E9 \( a
1 ?, |) `4 X$ S; Y  O5 s. ?
'{$ElementUpgrade}', '{$ItemPierce}');");' V7 t0 J" p( u& m# M
}
9 z4 `9 A; j! H  f' k& @) j! m/ w/ J9 I
}
# T2 u% r+ j7 [6 n% Z' X3 R
! K' X) P* z9 W. u, F5 @}5 t$ p8 T$ I9 m! W

% m8 N) s% x6 ]: c/ q$InitForm = InitForm();
0 r  `7 a' f/ ]# L. d' a$Listener = PostListener();' g, e, _. e. a- p( q! u* f" n
0 k7 h, A( d$ V8 O7 L
?>
- [9 ~) R) v# g6 c+ H/ W+ @; m0 @7 {
0 |% |) C, {1 }* h& k6 X  Y
) A4 X; p* M8 s3 O+ X$ ?
' U' ~2 L; w. v1 r6 l3 ^/ X, z. N9 s' c4 |( T% i/ U: P! O% d% M
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-8 14:34 , Processed in 0.058735 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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