飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1092

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1092
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
. D0 r; O6 ?. d' Z1 _' y8 Y. yfunction Connect () {
! ^2 ]9 r" |( O0 }# l5 Zmssql_connect('Server','UserName','Password') or die('Error: Connection to DB
! c9 U! a: c$ y4 U1 m  U$ \3 i3 r" E$ g
Failed.');7 P/ j# y& ]' F# a( [
}, O, E3 o7 M* O0 L
Connect();' K: ^8 ?; V/ `5 B
8 {3 |8 G' l0 A0 m: \
function InitForm(){# D' X3 r0 ?8 L4 ~# h5 M
//layout for the form1 b# I9 |- v3 t! c
echo "<strong>Send Items.</strong>  ], W0 S) i. T, b, |. {+ w
<form name='select' method='post'>; f! D; f+ r2 I/ V
<lable>Character Name</lable><br/>
2 ~8 v' t: c0 ], e6 M4 e<input type='text' name='char'/><br/>* D; M8 H6 \  k7 w
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>, b1 Q. Y% q7 [# \: l+ A, x( p
<input type='text' name='item_name'/><br/>
3 y! U/ A5 ], e/ w<lable>Item Amount</lable><br/>, Z. z& J/ Y. \1 p7 e/ f* `
<input type='text' name='item_amount'/><br/>
6 w: z8 n( \# ~2 T5 @<lable>Item Upgrade Amount</lable><br/>
( H( n" N; P5 ~! r% s; F+ ]( E! O<input type='text' name='item_upgrade'/><br/>& Q, e, a% G  |; h4 b( a& W
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)2 D# S2 T1 x; n& Q9 _2 a

- W/ R  X8 p; [  n' q( i</lable><br/>( b* A3 `5 N: |; {' p
<input type='text' name='item_element'/><br/>+ x/ }4 m9 X3 Y. r( W6 k, s* h
<lable>Element Upgrade Amount</lable><br/>6 b% K, I" f# `' y! B# t
<input type='text' name='element_upgrade'/><br/>) y7 ?0 Q# ?; [  {2 k5 G& R
<lable>Pierced Amount</lable><br/>
4 n. x* b& n6 B<input type='text' name='item_pierce'/><br/>  Y5 ?$ ~7 n& e: _5 |9 @
<input type='submit'/>
/ _( J3 K: o- Q% r( A+ O; h: W4 ^3 p4 G</form>";
' l# C% a0 N* j7 V. a" \7 R}
* Z( O6 S, D1 m! e+ Z
+ P3 L. T8 \; L! Y/ l* \: i1 sfunction PostListener (){+ x1 u9 S2 i4 i3 N% \* s9 a
//Add more post variables if needed and add them to initform() function aswell
) ]7 _6 N0 y5 p7 N# R0 D  S5 p" _) u' M) E$ p, s: \& B
################################
: d) J( f: j7 ?5 @/ f##### Connection and Post ######
9 z0 E7 i+ ?- F2 c% H################################5 O' U+ m$ g, }
$name = @$_POST['char'];& f2 O# v4 H7 A6 ^6 R% \
$ItemName = @$_POST['item_name'];2 M( J4 h  m' m- V% K5 C+ w- l/ i& J
$ItemAmount = @$_POST['item_amount'];
; _% M7 L, r: J( I. O$ItemId = @$_POST['item_id'];8 z2 M# B, z! s4 g
$ItemUpgrade = @$_POST['item_upgrade'];2 |1 \& I5 U2 s5 C* n4 K
$ItemElement = @$_POST['item_element'];
3 Q1 [0 c! S* c0 a, w' x' @3 ~: \6 e$ElementUpgrade = @$_POST['element_upgrade'];* B2 ?% G8 R2 e) S
$ItemPierce = @$_POST['item_pierce'];: q7 {0 Z8 `, E' q
################################- n; ?# z1 B- `- S  D4 l

/ c5 H6 u8 l  l  R0 w- w5 q; e//Check both variables for empty value, M) D/ e+ G! q) Q

7 R9 d8 W: b2 |8 d7 a4 v! Z& H4 iif (!empty($_POST['char'])){
4 V) \* ~+ O' j% d1 U  s* T1 V! @$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where . o2 S% b# Q/ f

) D6 w% h: [+ @' n" J5 M; X- Am_szName = '{$name}'");" v" \, {2 I* F: E# k
while ($row = mssql_fetch_object($find)){( q3 o  ]& Z# n% M. V0 z( F
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
. c7 x# B: n4 @+ H; r6 Y: P/ r$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
8 j: N' |/ b0 y# S: l1 F- M, m" w/ E- X, f# R
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], / F4 A) a- M& M2 O) d- X7 X; n

3 M4 M, _+ p/ }5 B* i; T7 U4 _5 k[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
4 e% B7 V8 h) ]9 A5 y& O/ a  q* e2 D- f
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
& y$ o# i0 y: N) d! }0 Z* b. ^, F2 i& ^; J0 y- `$ s; F3 E. @  d/ U) J
'{$ElementUpgrade}', '{$ItemPierce}');");# f* g4 h  f5 w7 q/ N8 T
}
; F- q" ]7 y8 K1 G$ M6 o8 ]0 x- R- C. Y" |0 o2 W# \; c: V
}- s2 i6 F7 b5 }

& E( t. r7 |; l% o) a, P6 K}: Z; J% t5 U. F9 N" K0 k' F: G: d4 s

3 H7 K% O% Y4 T: S$InitForm = InitForm();
$ Z7 K0 I; v" g% d6 d, I( a$Listener = PostListener();, W# B' `  g" k

' P; e9 Q4 S: R( V7 f0 [?>
* |) s. p- o4 h  T  r& b' U& R4 z- l6 ]6 `
- n& E  _9 e9 S: Z
* ]6 p- V9 V5 E0 Y. \" \+ r
( p9 |1 i$ k3 A6 g4 [
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-30 20:49 , Processed in 0.062528 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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