飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php1 |  }  E1 y" V6 Q8 I
function Connect () {
: v+ p7 h: Q; {mssql_connect('Server','UserName','Password') or die('Error: Connection to DB 5 n6 G, |$ x8 l' d, w) N9 z+ a

; B" N0 R8 A- }Failed.');
% Y9 w/ I% o0 {' ]0 h}
, E4 T6 q" z9 t0 T3 [Connect();
, g1 r6 ]& i, M! P2 t8 \# A. k+ {7 n) ~) u4 x! y! `- A
function InitForm(){
  ?% \; b! p% F//layout for the form
& ?- S+ [& k! K. R! {+ F4 L3 fecho "<strong>Send Items.</strong>
) z0 h9 H5 M# k" C, i" I' @<form name='select' method='post'>( G/ L! d2 z0 t$ r3 X, h3 ]
<lable>Character Name</lable><br/>
; S% ?% \' p5 R0 D8 {$ M- A/ \& q7 ?<input type='text' name='char'/><br/>
( e; ^, M) U: T" I1 C<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>7 a3 F" @  ?& }, S! o7 G
<input type='text' name='item_name'/><br/>
9 ~, B2 }0 S$ |3 @; d<lable>Item Amount</lable><br/>! h/ {5 ?' f- a
<input type='text' name='item_amount'/><br/>7 W2 V7 {6 Q' l
<lable>Item Upgrade Amount</lable><br/>4 I, s" w2 F7 y# N" {
<input type='text' name='item_upgrade'/><br/>0 e( d8 B5 U8 a0 g9 R$ P: \
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
' t% K- @" G! E& y0 f5 @: t
; y$ \5 @  t# Q  y) J</lable><br/>
( c9 o3 `0 I7 x2 R<input type='text' name='item_element'/><br/>( |7 E$ }) |& c9 P) {
<lable>Element Upgrade Amount</lable><br/>4 {5 @9 m' [: l
<input type='text' name='element_upgrade'/><br/>
3 J& N: Z& _9 j0 G<lable>Pierced Amount</lable><br/>
" l' O3 B0 Z, z" p2 Y<input type='text' name='item_pierce'/><br/>
: _% l# N  y# W* b8 T<input type='submit'/>' J, {7 w  T) |" ^$ G% |" v4 Z5 D
</form>";$ C; \4 z4 q, T4 g: V
}
7 L/ V" Q5 u6 l9 n( @7 y0 f; ^) {5 v- J0 c  G* L0 y) G
function PostListener (){( z/ k& ]7 P  Z- b
//Add more post variables if needed and add them to initform() function aswell0 e+ d& Y' y, b* d
6 S7 y8 U. g3 o* a. Q& l
################################
) ]1 n+ Q4 w; y/ f, Z$ g##### Connection and Post ######
; O" v. ^3 A9 K& q################################8 M, V7 Q8 c+ u& G+ P! D
$name = @$_POST['char'];
" H( t7 e: p& @$ItemName = @$_POST['item_name'];- R- n9 c. J7 c* X7 J' T* K
$ItemAmount = @$_POST['item_amount'];
" K7 B% W! l# ^+ S$ItemId = @$_POST['item_id'];% V+ ~) d& g" }
$ItemUpgrade = @$_POST['item_upgrade'];
3 j5 x4 w; {. C* Z) d$ItemElement = @$_POST['item_element'];& s' A9 B' O0 N" o
$ElementUpgrade = @$_POST['element_upgrade'];* I7 r* g4 ?" N6 e3 g& U
$ItemPierce = @$_POST['item_pierce'];) A0 P2 b. m/ p; h
################################
3 e2 S3 ~- I  a* r# K. d- @) P. p$ M
//Check both variables for empty value
  o8 L) x. d2 m2 A' O) H7 Z4 b1 _  C; r' J+ }" Z, y
if (!empty($_POST['char'])){
+ l" k- V% O% d$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
7 w1 e# B' b% y; `; c" ]1 T. {7 r& f: [" o- q( h+ g
m_szName = '{$name}'");# I: a4 x$ f; p4 d& n: G
while ($row = mssql_fetch_object($find)){; U! i8 J1 @) L" x, s
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
; E1 g6 `: t( C. @; H$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
+ R  j& W6 w; k/ W5 ~, a9 P
- ?! X6 w: v/ H2 X/ |- a[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
. r4 g" F1 K) [( ^' k8 Z- f
" z' `% R* ^6 g" `- @7 g7 {[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', / x- V9 g* b  U. Y/ z/ V, {0 c) n
9 x3 ?3 }/ E' k8 V+ D
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
8 a" s0 I0 E0 z1 k- _( B" h' i9 j9 j: D: X* ]6 M$ Z  \! O8 I
'{$ElementUpgrade}', '{$ItemPierce}');");  S6 [2 k% \2 ]- C8 f% |+ n5 q! p
}
( R3 u7 r0 n6 K: {. ]1 C3 D5 P
}
7 \' j8 b/ ?  L' f- s  s! N/ j
5 k/ D. ?1 P" c' O* ~# O}
$ O% r0 U7 v; Y/ F# @1 J9 s, i+ H$ r6 G) {- E% L0 ]* B
$InitForm = InitForm();
8 I7 E  }: `' I) R. z$Listener = PostListener();- c7 f2 }1 a8 r
6 u* ~! a$ `& b
?>
* K* \) d' v% ~2 |9 m) q
) H% _( N4 t3 B
; {. \# ], B/ g9 e% I; f2 h" W( s
: j( g; L4 y/ o/ V# q
) V- \9 ~0 R+ g, J% C; L' i
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-5 12:17 , Processed in 0.057396 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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