飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
& g# h! o8 t6 ~7 G4 gfunction Connect () {
3 e6 U% k0 o) c2 Y0 e5 V2 x5 hmssql_connect('Server','UserName','Password') or die('Error: Connection to DB
: u4 p  {( A, `/ |. ^
! u, v- T# k' zFailed.');1 [) r6 g* H8 P$ D$ M( C( u4 B
}( F5 v5 D1 b' P" @( _2 `
Connect();
3 J. n4 s& |. \! \4 e% y( z0 |7 \. t) ?7 m/ r* P1 d0 _
function InitForm(){
4 K3 `7 n+ Y9 `//layout for the form
- A& M. o  `+ Kecho "<strong>Send Items.</strong>& W8 S* S1 M3 \3 y
<form name='select' method='post'>
: Q( J7 \; l4 d) j  m5 C<lable>Character Name</lable><br/>
: y! A' _& _$ h- `5 x<input type='text' name='char'/><br/>
$ s, ]% d4 S3 C0 v3 @3 H6 J- n4 |<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
( _( v0 p9 d& A" K<input type='text' name='item_name'/><br/>* Z- i/ X: c# o' d" d! ^- _6 i
<lable>Item Amount</lable><br/>- e: ~# ~% Z* k
<input type='text' name='item_amount'/><br/>
) z) O% u; Q) u4 P<lable>Item Upgrade Amount</lable><br/>( C5 ]- k, ^5 I) u
<input type='text' name='item_upgrade'/><br/>
; g& k+ R9 h+ Z' t<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
0 ]5 h5 }9 o. B4 C4 l
- A( a) x* i' t! W! T  k6 z" W* L</lable><br/>
* N% S$ z; w; S8 I<input type='text' name='item_element'/><br/>, Z2 R9 |8 C% |, b3 Y
<lable>Element Upgrade Amount</lable><br/>
& i& g! z& j( X/ m/ `<input type='text' name='element_upgrade'/><br/>
( Z* q8 D2 _/ w5 `5 u: e<lable>Pierced Amount</lable><br/>$ D  `: L/ H0 h2 I4 k& @$ e! n
<input type='text' name='item_pierce'/><br/>
) e: l+ ]) @" r4 G& P, Q<input type='submit'/>% ]& y& g" y" z. u$ y% Z) @4 i
</form>";3 s8 I2 w7 [9 [/ ~9 f
}
( c, ?+ C0 e3 K3 q) {5 O5 @9 e' P# l# E# q) h
function PostListener (){
# u6 K3 O# P, h3 b! [//Add more post variables if needed and add them to initform() function aswell# G8 p! _8 u8 ^* P9 c0 _0 r0 z) [

, W3 [( H- ^9 H################################
. `" S% C1 j$ M. }3 m##### Connection and Post ######
, ^2 v4 y. x! z3 [8 k################################+ J0 M: `' H9 j8 n: \: z/ M  \
$name = @$_POST['char'];
8 g. Q8 r( ^9 i/ t8 M5 r$ItemName = @$_POST['item_name'];
8 Y, [; d( \1 U4 V0 h2 z$ItemAmount = @$_POST['item_amount'];
& h5 R) D  H/ o4 G; @: p5 B$ItemId = @$_POST['item_id'];/ N9 C4 H8 w% b) j3 i- J
$ItemUpgrade = @$_POST['item_upgrade'];5 v. ?/ R6 }, b# _/ h+ y, b3 ~
$ItemElement = @$_POST['item_element'];5 M* ^3 a6 j5 Y( L7 D
$ElementUpgrade = @$_POST['element_upgrade'];& U( q; G& ]" |2 r
$ItemPierce = @$_POST['item_pierce'];) g4 E( W4 h6 I2 t& Z# K
################################6 ^3 n% D' }. }- P: v

7 V7 ]1 `8 E, n' N+ a; V, [$ Z//Check both variables for empty value. s1 \# y9 S/ m: W- Z. U+ ?1 K/ B
" H9 L4 ?5 y5 }, M
if (!empty($_POST['char'])){
: W% g: X: A0 A5 X$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where + @8 @5 H: W, U0 f' O1 w6 ]8 d3 }
2 |( j+ x  {/ g3 `
m_szName = '{$name}'");
, {! ^3 X7 ?4 U6 }8 I4 Wwhile ($row = mssql_fetch_object($find)){1 y- P; m' o$ y1 ]1 \. W6 N
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";, S9 j' |! K: [( ]0 Y% \
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 7 U3 @$ a4 i% }; l
, s" V, B0 y4 j
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 1 @- r/ S4 v+ n

/ s! L+ T6 O4 t; k% ]3 g[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
" K( U/ G$ ]: d4 y$ I3 [* {
, A( ]- U8 i* G3 O& Z" dN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
5 K- X' p/ K, S" P5 a! N
" q! z$ l9 ~# u5 u+ x5 y* y* l0 r'{$ElementUpgrade}', '{$ItemPierce}');");8 T/ q" ?! C0 B  A  Y7 Y5 P
}+ E3 a  n. n+ A! D- v5 D5 t# L

2 G  V# `, l9 L; D& B; w}
# c) K3 v( [1 z. z0 w/ s
6 W5 {; Z( _( o; `* h  h8 T}
" W- f$ q! C% G: e  y  u( G
' v6 Y' L* o  R  S- B: q$InitForm = InitForm();9 f. B( z% |# V
$Listener = PostListener();8 }& u3 G7 o8 V/ w

  f# p. ?- x5 c6 z8 y3 n?>; V/ B! O" `- E2 [9 ]

# G1 [3 ~$ L' u$ q1 x3 v( S
% M  r- O" X% ~7 V3 M/ K% q' f, }9 p

5 b7 p* p) D9 o: F: q) C  Q
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-22 18:39 , Processed in 0.066116 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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