飞飞世界论坛

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

物品发送脚本

[复制链接]

200

主题

203

帖子

984

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
984
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
<?php
' h% X9 L9 v7 e7 `0 I! ?* o$ Jfunction Connect () {
- M6 ]$ c: d8 n7 |, ^6 p& omssql_connect('Server','UserName','Password') or die('Error: Connection to DB
0 x' m' ?3 q5 \, X' O6 `6 e+ q7 T3 X9 k
Failed.');
7 O# \: N7 g" }) i/ G) B/ k0 v}
& P8 q$ N! @: l+ j; b* S  J1 K7 [) gConnect();( q/ ]6 W$ k" V1 Q

9 T& a5 Y+ {5 s& Y; o' P5 dfunction InitForm(){
5 C# U3 m; D: w8 @3 V5 T//layout for the form
0 |5 F$ `: S; x8 `( M: b2 becho "<strong>Send Items.</strong>
) u$ G2 c# I! m7 D+ y. \# a<form name='select' method='post'>% y  i% c8 C0 [8 Y8 R% P
<lable>Character Name</lable><br/>4 @) R# o9 b; @! Y
<input type='text' name='char'/><br/>! S+ e5 }  f. Z+ @. j" L( U
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>! {" E! k1 |$ z$ y
<input type='text' name='item_name'/><br/>
6 E- Q+ {5 ?3 Z4 X<lable>Item Amount</lable><br/>
1 D' x3 {4 z1 n$ u<input type='text' name='item_amount'/><br/>
6 Q( R4 v( h# L<lable>Item Upgrade Amount</lable><br/>, t* e0 Q0 z4 x& k
<input type='text' name='item_upgrade'/><br/>
) g( p3 L3 H& E: w7 y+ {, {; _<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
; z9 l6 f2 F" ^$ C/ L1 ~% `
/ Z7 S0 [5 J" ~0 Y</lable><br/>" _" L3 L2 Z3 I4 [7 L' o% p4 t
<input type='text' name='item_element'/><br/>
1 t% ^- C1 M( t2 s+ b) j& S<lable>Element Upgrade Amount</lable><br/>
9 M) R/ [! W2 e& v2 c  r<input type='text' name='element_upgrade'/><br/>. z, F6 f' P- L, y% \6 O( ]
<lable>Pierced Amount</lable><br/>! A* z: }0 h. t
<input type='text' name='item_pierce'/><br/>/ I: ?" ?7 h7 m6 S  s
<input type='submit'/>1 L1 f! O7 B6 j4 O6 A. \7 x3 t3 ^: R0 G
</form>";, R( T5 X2 Y; F  ~7 o1 w
}
, n1 Y7 e8 {1 k8 y, |8 [/ x+ z7 s# y: J. v' O( f/ I
function PostListener (){
5 b0 g8 R( U. R0 {% t: D/ g//Add more post variables if needed and add them to initform() function aswell: j/ T7 J6 }' {# O+ Y$ S
# Q0 c3 O3 u3 \
################################! O: V' U; T+ C/ n3 O
##### Connection and Post ######
' U+ i% y' A6 ~+ ^8 f* d################################
2 {6 m0 _  r& K! b$name = @$_POST['char'];1 R4 f$ a7 D9 A2 e
$ItemName = @$_POST['item_name'];
1 g; M, l8 j) t( Z+ O/ k* x$ItemAmount = @$_POST['item_amount'];
! ~5 k% b& C  q" N1 P' H, l' ~$ItemId = @$_POST['item_id'];
1 M$ F5 t6 n: D* N5 k3 ]$ItemUpgrade = @$_POST['item_upgrade'];
: i2 p3 H# ]* G& O% w* g$ItemElement = @$_POST['item_element'];1 R! a( G) x: a! ?, ~  k* R
$ElementUpgrade = @$_POST['element_upgrade'];
- m$ l+ s8 r. S1 d# `$ItemPierce = @$_POST['item_pierce'];" C& ^3 I/ S  t) W" \" E" O
################################. K8 d/ b- ], d. k9 ~$ f
0 p# K6 ^# g" r( U7 K" \$ u
//Check both variables for empty value
0 u" @2 N% e( ]6 f' M; C  {' s4 r% G' O
if (!empty($_POST['char'])){
$ S5 l  |% [4 R6 D* a: C' J) C$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
" A6 B6 I3 a$ t. ?
. ?4 r) f* V% ~' R) R5 c( wm_szName = '{$name}'");3 p4 Q* i! g5 g" a
while ($row = mssql_fetch_object($find)){
0 i) p3 l" z4 w" m9 N& r% B& fecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
% d' y. s7 h- Q1 p: A, B$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
- w9 [* ?! ^( m1 ]
7 N6 c& G/ P$ t& C& Q  _; {* M( @[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
- ], c. s! _# g" p4 n
2 F4 ?* Q2 S% W[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
1 r, L: G3 g# v  G' Y( v; ?  t; m7 H+ [0 O  R
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
: C# f% G$ P$ O& G
9 y$ W+ h* C3 Y7 `2 ?& r) F7 R'{$ElementUpgrade}', '{$ItemPierce}');");
' |5 i6 v9 N; _! [$ X}& C9 q$ B) N% n& b7 z4 z
4 a1 W" [0 h4 S% z
}
' c  m$ G/ C, @3 n. a5 J# t) |% k% g/ ~( M
}
1 ~9 @8 `5 w5 [" Q
, u, e5 T  ?6 w# J3 R4 l$InitForm = InitForm();6 X  D# ?8 j9 |8 V  O+ |3 K2 ?
$Listener = PostListener();
, h1 t: ?: B$ c3 c
# u- a# K- ]+ m! P?>" q; \4 p2 T$ \" H2 O
! M0 X4 n. b  G4 h0 _# N3 D: A% ~4 l
) n# d7 @* |1 }+ r  p! z+ d6 |- {3 x

* y; t8 \3 j0 w+ z0 }: u  z' W+ G) j) g6 e- g5 M
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-7 20:06 , Processed in 0.082195 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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