飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1094

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1094
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
/ K7 ~8 m- u6 R6 H0 S; p, Ifunction Connect () {8 Q" J* Q: F" e  @
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB ' h$ o% q, A9 W; X

4 n3 ?9 M, m+ M+ o7 d1 |Failed.');
! }0 n+ a7 [. g1 B}
( R1 {1 H: E# n& ?1 d8 X6 j/ dConnect();: ]& P! d1 A1 I6 Y9 D$ f" M' f

, M9 `6 e/ r4 ]$ I# C: ^" Efunction InitForm(){+ b0 ]. M" J  p6 z/ [. L% y
//layout for the form& [, X' N! G2 z0 l( x+ B$ f
echo "<strong>Send Items.</strong>) \/ @) i# M9 w# D+ u" I
<form name='select' method='post'>
) b- ~  e' z. m  i<lable>Character Name</lable><br/>6 J' {/ ?- r) {9 t
<input type='text' name='char'/><br/>
4 A0 U% }* D+ l2 e; T. D" L7 u<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/># v( }& k+ e9 C. l+ y/ ~
<input type='text' name='item_name'/><br/>+ r! _- |& T# q4 P) K
<lable>Item Amount</lable><br/>1 J  o6 W6 v) D- E
<input type='text' name='item_amount'/><br/>
: w1 H% f, C) t0 O7 e# _9 r<lable>Item Upgrade Amount</lable><br/>$ y& ]; s" N. k. t0 G# z
<input type='text' name='item_upgrade'/><br/># G# Y/ W9 h4 |$ ?9 F
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.). i6 |' e9 Z/ H$ D3 b8 S

2 u% Y, D" P4 A( p7 [2 p( M</lable><br/>$ ]& ^. q( C( R2 a' y4 K
<input type='text' name='item_element'/><br/>
. G( N. a# @+ ~8 ~+ u<lable>Element Upgrade Amount</lable><br/>- S- }# W2 h4 m0 F1 Q7 S! C
<input type='text' name='element_upgrade'/><br/>; F2 M9 B3 Y$ F: V8 ?& t+ R
<lable>Pierced Amount</lable><br/>
- Z- j: V9 O& \6 s" `<input type='text' name='item_pierce'/><br/>
4 i4 A0 S- W3 u. d- \  E8 M9 {<input type='submit'/>( f7 w; g4 q, I7 H/ Z& C" }
</form>";& H* x: Z. |' L0 D3 W1 k
}
8 L0 h" u' n. |1 j8 v/ A8 ]" o
5 T( U4 }5 q% @function PostListener (){: Y8 g8 k7 }( t2 l- Q
//Add more post variables if needed and add them to initform() function aswell
! \- p8 c, R. H+ X2 F; V4 C: r
0 [4 P8 J! {7 w& m2 E  \+ H################################
0 n4 x. L) M+ T4 o- _##### Connection and Post ######
; C) r% ?# k7 H" x################################
4 w$ S; n# |: o. T1 L$name = @$_POST['char'];, P0 h' X: k# V' S. z
$ItemName = @$_POST['item_name'];
; u4 q5 \& w4 E+ S4 j/ g$ItemAmount = @$_POST['item_amount'];
4 Q) r7 r' d/ Z, P3 g' o# x$ItemId = @$_POST['item_id'];
6 W/ Y* j5 R4 {. B: U$ItemUpgrade = @$_POST['item_upgrade'];
$ K8 _( ^6 s& s0 m+ \) n$ItemElement = @$_POST['item_element'];8 t* V, p% ]3 l* t. ~! g
$ElementUpgrade = @$_POST['element_upgrade'];2 S: i& o3 K- c0 c" a- S
$ItemPierce = @$_POST['item_pierce'];9 J- O; q$ I; ]- `1 Y
################################
/ ~- J7 u: f7 \0 f' Q5 w* B: P1 c" \" U- v2 ?1 K( u8 T
//Check both variables for empty value+ C& `' ]4 h# `! z
  n3 Z! ?7 e' W
if (!empty($_POST['char'])){
# u! L% Y- Q8 C& e* T: g! E$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
; y  p' m0 X% \  s& }; f9 L& ~% B. h$ j9 _& p
m_szName = '{$name}'");
: `% \; }6 L- x# @% L7 uwhile ($row = mssql_fetch_object($find)){9 z, F0 F# A0 J" k
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";' a+ U% T) y) u& ^7 ?7 d7 [
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
) n- f! y5 f/ w# t5 ~- [& I' j) ^
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 6 W3 H& |( A, R
/ {2 b! A$ y' k# y( j' t. l
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 9 S' t; O; I2 N: a8 V
& l5 U3 n9 F+ {0 S  U1 g4 i( I$ W
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', 5 F2 G/ ~4 J: U" a" q* Y* B  f
4 U; p! Y' k4 `) D
'{$ElementUpgrade}', '{$ItemPierce}');");
0 v8 t% @8 T  A* }$ J}# E/ ~7 F. P/ r2 w4 M' d; A
$ H  t! Q% e) L, p6 S
}7 U1 c3 H" e0 t6 r: Z4 u) v

9 L3 o/ Y6 A; \3 F' |8 j}& s% X8 N0 P% W4 w# y

% S: t5 ]9 D" k# e3 Q$InitForm = InitForm();
  w! b( c3 x  J4 V$ @1 G$Listener = PostListener();
" M3 r8 p; F6 r$ x6 C# _! u+ e* e% }6 M; u
?>
7 o/ C- [: ?5 _% V8 l* h5 ?" b' R2 L( I3 d

/ W* @- W# y& J) Q/ x. Q+ L1 T
7 Z6 }* V0 Y- L& i7 }' U
9 o( ^) V( w: P. s/ V
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-31 19:47 , Processed in 0.073571 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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