飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php% \1 Z3 B1 v- F8 b+ Q3 f; a
function Connect () {
+ d( F$ T* V4 E  p2 t- c3 omssql_connect('Server','UserName','Password') or die('Error: Connection to DB
  `7 _' }: w! Z+ ?- B8 z( c1 v# J; D. L) z" V- i% ?
Failed.');
- [6 i; }' I9 C& [}
( ?( i/ Y4 k# @. q  {3 GConnect();
( i, L5 c6 @" j' N6 h; l/ X+ d; ~' l( ~, b
function InitForm(){
2 u; O$ \7 h8 R1 i//layout for the form
, L; M3 }+ i6 L0 |; s9 Kecho "<strong>Send Items.</strong>- V& s. m$ O) ^5 t& Z4 y
<form name='select' method='post'>% ^, J/ p% M1 t7 H
<lable>Character Name</lable><br/>! W0 z4 k0 R! z8 a8 C
<input type='text' name='char'/><br/>0 _9 Y8 y8 @( C% q" O' z% N
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
  E: _% Q5 r# w' k. V6 E0 Y<input type='text' name='item_name'/><br/>
  p% ]& ]1 i* Z7 \+ i<lable>Item Amount</lable><br/>2 G5 J. O- T3 ~* G- l
<input type='text' name='item_amount'/><br/>% f7 e# g+ S* ^* j" d4 m) e
<lable>Item Upgrade Amount</lable><br/>
  Q. s8 P$ m) Q% b<input type='text' name='item_upgrade'/><br/>
3 p6 E2 Z# c6 \, ], }8 y, {<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
# k/ `) m# G& l* L% d! _6 Y3 q+ _* T; m  H/ Y. o/ K
</lable><br/>
( R! E6 C, |, a& Z* u" o+ w7 h  e2 @<input type='text' name='item_element'/><br/>! V$ r: f3 A3 |. m# [) T- }
<lable>Element Upgrade Amount</lable><br/>
% m1 J/ M7 ]3 h1 v<input type='text' name='element_upgrade'/><br/>! i( ~: d& P/ R5 v% J2 X5 e
<lable>Pierced Amount</lable><br/>
0 O/ |3 J5 T- e+ I. X' ^" y<input type='text' name='item_pierce'/><br/>
1 T1 X0 D) Q2 j! Z  Z' \<input type='submit'/>
4 c0 L1 p5 ^/ E5 F/ ?</form>";
( y; ^7 i3 ?# I2 J/ j4 z, Z}. Y8 ~0 F" N+ Q' P$ E# ~, D
& x( [# V) l; h
function PostListener (){
5 V) h7 [& _4 o: y6 b. ]/ f( F//Add more post variables if needed and add them to initform() function aswell6 n  {. d0 z9 T# ?, p# G. D

9 S! P( F' G: Z5 P4 p################################
+ a/ k* N' c" u; `% u- n6 v, q9 z2 w, |##### Connection and Post ######
# o1 j4 ]2 i: e" J7 i################################
7 ^: X5 V1 ]" `/ B/ Z( R! N. g+ S$name = @$_POST['char'];
+ `# u3 H6 Q' a. {5 G$ItemName = @$_POST['item_name'];( }1 ^# o9 r: V9 ^7 K
$ItemAmount = @$_POST['item_amount'];" a: t4 K9 t0 v
$ItemId = @$_POST['item_id'];9 `0 ?3 B3 N; f% R/ j. `7 [. ^# H  J1 N
$ItemUpgrade = @$_POST['item_upgrade'];
2 r2 L! ], i. I5 h' b# _2 ?, b- O) H7 e$ItemElement = @$_POST['item_element'];, n1 S. G/ @# ~* K/ T5 @
$ElementUpgrade = @$_POST['element_upgrade'];; K5 o! n: G) J$ F
$ItemPierce = @$_POST['item_pierce'];7 [. q. y" d4 r
################################
' Z  H* h0 V5 r$ [
* v3 o8 G. g" @/ _' \. D//Check both variables for empty value0 _; n, w5 H: I7 U

/ D( v0 U. k3 {: c1 ^+ W$ tif (!empty($_POST['char'])){, [, O' ^) E% U1 i( O2 r/ o
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where : S9 d' ]* ]2 N% H- m+ A+ y0 \

" ~  T. {! [3 W. ?, h9 z( L) |, ?m_szName = '{$name}'");
% t, Q0 f7 z- r$ m! U/ Y- F* C. iwhile ($row = mssql_fetch_object($find)){
# a; e+ [' r: j3 Uecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";* W& ~& U$ p, V" o1 @
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 4 C4 a# \# w. Q8 T
; m# k4 |: f4 S( X. u  W, _
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
+ o  O$ Z2 q, e8 h) m
& k/ N  Y* q+ S6 y, e[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 6 a" |0 B% d8 t) @$ y
7 q2 N' e: s8 r) ]% P
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
  n9 _% U; H0 a3 o' [* G+ J# _' M& X
'{$ElementUpgrade}', '{$ItemPierce}');");
( _0 A, Y. ^3 D" t. c- |}  ?2 J- u+ {3 }- }& J9 E) N% ?

7 u- d: O* }1 X5 S}* v  m. ]- f+ `: O, i2 |+ _# P
/ p3 s1 y8 E- v' w" q* X
}
( U0 i0 o. s* ^% K, d8 q1 v4 o4 t  t2 _& V1 D+ x8 D. D& k7 i# d
$InitForm = InitForm();
0 x, \: ^/ f, B6 \7 ~$ i$Listener = PostListener();
1 U6 M' w$ L+ j& [* u" r8 C; R0 g  \# O
?>
! G, f, h  G' w3 X4 \. c8 }$ F# B8 n9 P. U
" o, \5 \+ O' x9 V5 {" C
" i* L$ k/ W& l$ n$ b, b
7 @! G5 Z! `7 P7 U5 Y8 C( H5 ]* \
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-30 09:27 , Processed in 0.058284 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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