飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php' q. p/ I  ?- L- n# T
function Connect () {- K  m8 p0 R5 v" M, r8 b
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB - N% A# l& O5 L

/ f+ x! U0 y. sFailed.');
# X/ S" Z0 }" }* l: I% e}6 _' Q( ~  F# v% C2 e
Connect();
! x5 j) h. B8 q. O
8 L; s$ M: ^' w- lfunction InitForm(){4 B2 g: {, o0 c% F" u  H- {0 ^% {
//layout for the form( [4 u- u+ K0 [: K0 c8 g$ B! G
echo "<strong>Send Items.</strong>2 ^- O# t/ d: N% p/ z
<form name='select' method='post'>
& G  o8 P- |! X<lable>Character Name</lable><br/>
* w8 u4 Z7 Y9 B7 N8 Y+ ^<input type='text' name='char'/><br/>
; A5 ^; x8 p# H+ g& C0 K+ G+ \<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>8 Q& I* M# k! r8 u
<input type='text' name='item_name'/><br/>
* p8 F) N, R& x* x+ K# F$ c9 \<lable>Item Amount</lable><br/>
) Q0 @5 c; D; @! a<input type='text' name='item_amount'/><br/>1 B( C6 U3 _3 q: a6 M2 d( j
<lable>Item Upgrade Amount</lable><br/>
- Z* S5 L0 N8 R4 _  V<input type='text' name='item_upgrade'/><br/>3 s& }. t: G: X% p  p
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
$ G6 y1 }# g% }/ O) a/ O5 T
4 w  v" \& g5 ^% u+ L" s, X: O</lable><br/>5 A$ V' F7 X( N& Z' @4 J
<input type='text' name='item_element'/><br/>
! B( V- c7 G$ }/ @. Z' L<lable>Element Upgrade Amount</lable><br/>( \  S& I8 l* x# T# H! I# w
<input type='text' name='element_upgrade'/><br/>+ p( }+ \. y  }. G+ B
<lable>Pierced Amount</lable><br/>/ q$ s5 Z- w" n" C7 d
<input type='text' name='item_pierce'/><br/>8 ^5 ]/ a6 E( z* B9 w4 j
<input type='submit'/>/ h6 q: j" U' i( R
</form>";9 M4 D4 M$ e4 D$ y9 y; T! J+ A
}: Z0 x7 v& D4 f8 s+ ]' g- P

0 i$ |! o* W5 a: _function PostListener (){
4 N2 H0 d1 R6 x7 Z& v//Add more post variables if needed and add them to initform() function aswell: H+ e+ H2 h0 X3 A8 a% A4 s
3 W0 Q2 @, `# G  z' F
################################
6 g$ P2 f. D4 g- C##### Connection and Post ######
6 x& o' J2 n2 P. g################################
" k& Q! u) y( M9 h6 ~: i$name = @$_POST['char'];
: d9 F9 j8 @7 b  N$ItemName = @$_POST['item_name'];
' @/ f# }9 ~+ y, V; o; y& c$ItemAmount = @$_POST['item_amount'];9 F8 i% D, M) Q  _
$ItemId = @$_POST['item_id'];
0 Z. M; R3 _0 H. |0 v$ItemUpgrade = @$_POST['item_upgrade'];0 X: G, d0 G/ G( K7 @
$ItemElement = @$_POST['item_element'];
! ~# H' q0 C( S( i/ H$ElementUpgrade = @$_POST['element_upgrade'];) L, B' k6 {2 x6 u
$ItemPierce = @$_POST['item_pierce'];
* _3 g3 v) `# P; U: A( `, P8 D! t################################
1 n) q- p- T) Z- g2 E; _
3 [3 h5 a% s5 Z% Y+ ^9 R! f) V0 i% K//Check both variables for empty value
' S3 R. y4 ?8 D/ y* z
3 ~, F( n* n" ]) H( K# z/ u9 Xif (!empty($_POST['char'])){
: Q! B3 v* d, @3 `, A$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where : B) \- l7 p1 E0 Z: R
3 Y; X% @% l2 Q+ `
m_szName = '{$name}'");
5 m3 Y# y3 M9 Q; e0 {) Xwhile ($row = mssql_fetch_object($find)){
; I% d# S- k, }; m4 {& uecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
5 L& Q) C- t" U, J. c' m! L( N$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], * F8 |: s9 x6 N

, ]0 p! O8 `( F; u% b[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
' x# y* Z. ?8 x! d% r2 ~9 a
$ Q# o8 P- ^8 @& z  r9 }3 ^# R  W[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',   c4 F) k- r$ {' s

+ d+ @( K! \7 ^0 u. m  r7 f; _N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', 1 |# v3 s) D' ~5 a; c% b
( B9 E+ k8 d8 {+ ?" r7 ?' j1 _# J: x9 \
'{$ElementUpgrade}', '{$ItemPierce}');");( u: }8 l# N5 N2 f8 Q" B
}
' I" s: V: }$ e% t$ D
9 t. F9 G# a: V) B}" [' u. s! n& q

' {. h( q; m. b4 B! h: |: m) Y}* k3 p6 b- B/ {6 {  i

7 ]/ b1 _) N  s5 `2 k* n$InitForm = InitForm();
9 c) \& u0 n. a  K+ ?! y- m5 Q$Listener = PostListener();
# s& L/ c+ [% X- I9 J% V& Z& q& L& W: u% ^* F
?>
3 L6 C# @3 q% l. @( Z$ t
7 {' g- L, _, Y: l& P9 C
4 R6 \" x7 d" Y8 F% k$ g
" B' p3 f1 {" a8 \6 U) t) U9 R5 N  u& T0 P+ A1 Y# A1 Z# o
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-13 08:41 , Processed in 0.061348 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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