飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
7 u+ y2 @. \. r8 w: h1 ]function Connect () {
% X8 o# g  W6 h# S/ \: R6 zmssql_connect('Server','UserName','Password') or die('Error: Connection to DB
1 E. g; N" o) \6 f1 y6 q2 {+ {" x0 ]) d
Failed.');  a/ L0 U8 h$ p) j1 b! |
}
  Y% B. ~8 B' X" ^Connect();
" J7 A8 {. C. G0 c( p& B' w# }: x0 \* k2 O3 E: _' ?. R
function InitForm(){8 g7 q3 F& w  b& a1 @
//layout for the form
' P# L& N; Q) ^) U0 fecho "<strong>Send Items.</strong>) N! |" P! S% _( `3 y& m
<form name='select' method='post'>7 p+ U! c2 T; C; j- k' u
<lable>Character Name</lable><br/>9 {+ [, d, k6 ?$ G4 V
<input type='text' name='char'/><br/>* n' c7 H8 n$ B! r* q  V. A* J
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
* S4 ~; ]! h9 K& ~; l; |<input type='text' name='item_name'/><br/>' M! @4 c, `! s/ s) P
<lable>Item Amount</lable><br/>$ y" W' W+ I6 x: ^0 h( ~
<input type='text' name='item_amount'/><br/>& h- o9 z! S6 U  |
<lable>Item Upgrade Amount</lable><br/>
7 O. F4 d  Z  O$ X: Q& U<input type='text' name='item_upgrade'/><br/>
) N% K4 d8 N7 ^" \( ^3 D* F<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)% ?# }0 E. ^4 l  N+ X# r- l* F

/ r6 j9 A2 |0 J' k. a; X</lable><br/>; O" F% q2 @5 }
<input type='text' name='item_element'/><br/>; S" L$ J3 F" J. t/ M
<lable>Element Upgrade Amount</lable><br/>/ B; W& B. r* [% a3 y& M% N6 a7 ^
<input type='text' name='element_upgrade'/><br/>2 |2 S( C4 N3 ?; e* T* n# l: ~, f
<lable>Pierced Amount</lable><br/>
3 v5 O% P# W) }0 m* P' V) |<input type='text' name='item_pierce'/><br/>
% Y# C& |/ e3 V& Q$ R<input type='submit'/>1 E' @: t9 w2 g4 T5 J$ s8 ~
</form>";; U, m* Q1 w9 G6 U1 W" S" }% P
}; ~* c! c& D& D. m- ~0 R$ F
" Y9 F# k  u* K
function PostListener (){6 @, ]6 B6 [; B7 A* ~& `* [" ]$ I
//Add more post variables if needed and add them to initform() function aswell0 a# h9 \1 @, C* F
0 T" E: I+ P; a( U& B. e5 [
################################5 `5 p; c% c# H% S$ f! x
##### Connection and Post ######
" p6 d) K/ {4 Q8 f3 F$ |################################; @% p# O9 a4 x5 L! ]
$name = @$_POST['char'];) L4 p0 F% P  M( B5 i# U- |$ c
$ItemName = @$_POST['item_name'];
' a+ F9 ~% |  O2 J+ p0 i$ItemAmount = @$_POST['item_amount'];
7 b* X! m. ^5 v6 N  b$ItemId = @$_POST['item_id'];: o( k2 b0 \# Q/ g
$ItemUpgrade = @$_POST['item_upgrade'];& D$ m; B" @6 k2 E, s
$ItemElement = @$_POST['item_element'];  l$ q5 m+ o# P& x+ Y
$ElementUpgrade = @$_POST['element_upgrade'];
5 N. S% Y# `( O( b$ItemPierce = @$_POST['item_pierce'];1 A% x- P& D! E& y/ K4 n3 j- I
################################
7 a/ v& ]& h6 n  f5 ]- |2 k6 H. T7 d; e$ w% V
//Check both variables for empty value. f5 `, K0 G, D) I- F( }' x. m( H* N

! a7 m- t2 ^9 c3 ~9 oif (!empty($_POST['char'])){% C% C& V3 t1 {! T5 o, u
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where & n/ `7 P8 I2 ]; n$ ]2 z
9 V. {4 i) z6 O- @* @  b8 ]
m_szName = '{$name}'");
" C+ B5 V: f7 l! O8 |1 [while ($row = mssql_fetch_object($find)){
. b' \' s* d9 w9 f0 M3 ]+ w4 Techo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";' |7 H: f, w! E9 W, Y
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 9 n& J' {5 s& K8 a
- g% M6 D- o; c( _) l9 O1 P) j
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 2 ?7 W6 |3 j5 K* o( J/ ~

6 t! A) }6 S/ [5 J[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', . n  M5 [- X6 y) u
. H  {) K) V- u  Y6 P8 ^3 }
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
/ V$ h. a$ V! d& S
9 ~6 q. C/ F9 v% s4 F2 W'{$ElementUpgrade}', '{$ItemPierce}');");
' ]; \$ ]9 x, j- R}! G9 p* a0 f- C- n8 ~5 Z

" G& z( }8 _( P5 _( b* D" ]$ C}1 J0 s  N8 |* Z" ~- Z3 i! [

% j3 W/ b2 g. I; N) w$ m( Q}
+ F1 N7 [5 y9 L. ]  `2 V4 m- g/ u3 F) j
$InitForm = InitForm();* q9 F* N: S6 h; f* b$ H
$Listener = PostListener();
* B1 Z& o. t* G) O4 E3 U: g
3 K  s; w9 K2 A( F2 K; s2 Y  ~2 ^, B?>3 @3 |6 C3 K/ ]5 e; I

% D* [+ ^2 Y$ F  ]8 N" H8 S9 p. ?! t  F" N1 q5 b3 A$ P2 l$ Q9 r

6 g4 N( Q! \4 b( D
( ~& ^' e6 W: W4 t7 E4 E
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-3 09:54 , Processed in 0.061380 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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