飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
<?php
- R/ P+ k, U. ^- Nfunction Connect () {
1 s" i# ?5 C7 D2 y# Gmssql_connect('Server','UserName','Password') or die('Error: Connection to DB 6 _  f7 N. Q0 v0 {1 ?2 P; }

  Y' v: g5 C( _( l0 QFailed.');
% ]$ Z1 c7 }1 X}
3 e. o2 R: k! V4 k+ U2 a; O0 {Connect();- h' H3 d6 C3 t& A
+ Q' U( w) B* H) Q8 G# e3 F/ ]# H- z
function InitForm(){1 U4 E, i+ ~0 E' `/ W9 l, y
//layout for the form2 z/ F& x2 w) x& R
echo "<strong>Send Items.</strong># _' A0 b$ s9 s6 Q0 q
<form name='select' method='post'>3 O6 i. z, N' R6 P
<lable>Character Name</lable><br/>- p( c/ v6 ^/ V6 z+ z
<input type='text' name='char'/><br/>) A! y- G. o: {
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
* e7 \2 T8 M; W! N<input type='text' name='item_name'/><br/>
/ j, U+ ~4 t- J. l<lable>Item Amount</lable><br/>
. B, \. P) C# X6 b8 o<input type='text' name='item_amount'/><br/>
, ?+ s, m+ ~2 a  \0 G<lable>Item Upgrade Amount</lable><br/>
9 N& ^* f6 G7 r1 E<input type='text' name='item_upgrade'/><br/>4 R3 K. x/ J( [4 u% u$ t
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
9 y. e' I/ E" O6 k4 x9 s! ~0 T* ~" w! x5 d1 k
</lable><br/>% v- @* ]! y* [* h( L  c- P
<input type='text' name='item_element'/><br/>: T- ~9 J# X" E; }) i4 Q+ T- x
<lable>Element Upgrade Amount</lable><br/>
$ j4 Z2 u- @+ H$ ~<input type='text' name='element_upgrade'/><br/>
' r# S& h4 a* Q0 m- J% `# k<lable>Pierced Amount</lable><br/>. v1 Y+ J* q. l; i1 Y
<input type='text' name='item_pierce'/><br/>: A( U+ Y+ V$ B# N: F' T  B
<input type='submit'/>
5 t6 ?' v6 O9 W2 s/ r' m</form>";9 ], Z; f" J9 _' Y2 N
}% I- e5 ?9 P8 `( ]5 G. {

5 g3 b" [8 j7 [. C. Y0 }) M0 mfunction PostListener (){/ L: D8 g  Y' `; p- @
//Add more post variables if needed and add them to initform() function aswell
; F% J) Q+ \, h# z7 \
2 c# ^# ~% A# _, L" `################################
3 ~% m* o6 j# q8 V##### Connection and Post ######  Z9 j3 p( @9 i% B2 e  ^2 j+ c
################################
, J; H7 I: h* R; N0 z/ _5 L$name = @$_POST['char'];
3 Z% M) b  l! d- b9 D7 ^5 Z( g$ItemName = @$_POST['item_name'];' n# B7 Z' U+ _) i- @& c
$ItemAmount = @$_POST['item_amount'];  X  ~5 N* Z1 w9 H  U9 s4 E
$ItemId = @$_POST['item_id'];' d+ H8 d' c' V; C# _* j( e
$ItemUpgrade = @$_POST['item_upgrade'];
* _9 [: j1 B. o# {$ItemElement = @$_POST['item_element'];
) r3 ?+ p& e7 i) D: z( [$ElementUpgrade = @$_POST['element_upgrade'];
! w; L  e* I8 S/ b9 }; t$ItemPierce = @$_POST['item_pierce'];
& `' }3 O# C$ Y; p' [% W- z9 a################################- P0 A+ Z& |0 S9 |

5 C! y/ U4 x# X; b% A2 Y0 N//Check both variables for empty value
  W" a9 g, P3 N5 B( G
, X$ y( a5 A) E3 L. s- Hif (!empty($_POST['char'])){/ x( G7 j- Y  n. K9 G
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
' J2 Y1 i" W" D5 s7 H
' [# H4 s7 [, Z% y9 |4 j' Tm_szName = '{$name}'");
; U. b: ^8 W% _6 k  C" Iwhile ($row = mssql_fetch_object($find)){
! n' m9 s8 g: Y3 r5 }echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
/ t& b* ]) x, x+ F! R1 c$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], / M9 T. \2 i$ }4 W7 @8 D

7 Q" X5 x5 s# l/ H- T! S1 p+ V[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
- l/ ]: X( ]; w: v, L* B5 [4 P! v
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 2 A9 S% Q6 q6 s

+ t8 Q& I7 f/ N' _* T  E' TN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', $ {2 X# x$ Y8 H- ~

0 @4 N) |9 T% l- P- f) q& k4 y'{$ElementUpgrade}', '{$ItemPierce}');");
# ]5 ]8 Y1 Z5 U}
( Y2 {. A7 a% R5 w) t* J$ r
+ T+ U4 T& m; M% A' b}' @5 i0 a2 C& _" m% W

0 E' j% I7 s1 A3 d}* H( q9 R+ q) ~8 x! K9 S: J6 T: o& v

, W5 i) ]# J/ e3 P  U$InitForm = InitForm();2 i* u* V8 ^+ e5 W9 `0 d
$Listener = PostListener();; l6 D3 l) R; a  W6 V

# E1 w! K$ K! y?>
# ^: A8 u0 @+ _7 n8 ?
' A+ _  S/ Y- X3 s6 F4 t9 F- D. a
* F# O5 ?' J4 p# b+ K: D4 X9 x$ D7 l* {) v' q# p
4 e6 e; g$ @( Q( i
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-11 11:37 , Processed in 0.062710 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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