飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
2 ?4 y+ f- r8 W$ `1 @0 d* Mfunction Connect () {
, b/ Z3 q4 t, S( }' lmssql_connect('Server','UserName','Password') or die('Error: Connection to DB
) M# Q8 K0 R, I  F" T+ w3 z+ |0 L3 o) {9 ^1 X( K. a
Failed.');
; c8 G; {; `$ Z}
" z' L* ]8 N  a6 @Connect();
2 t1 ^. j. z9 [8 k/ g( ?
# V% {% U: E5 H/ c7 m2 k' _! Jfunction InitForm(){
2 t! t! g5 T! B. d: R# {//layout for the form3 Z: W, ^) i# t. X" t% k
echo "<strong>Send Items.</strong>
: a. c' f& h: E1 Z% Y- x<form name='select' method='post'>
8 U; ?5 J1 O2 h( G# P<lable>Character Name</lable><br/>$ W0 l$ ?/ C6 D8 L5 c
<input type='text' name='char'/><br/>, |( U( c. g- x/ d: T
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
9 C3 X+ z) A& T" r( G<input type='text' name='item_name'/><br/>. l9 T1 E2 m1 j0 A2 c
<lable>Item Amount</lable><br/># y" V1 j' B% _) N* b' ]3 ^. f* \
<input type='text' name='item_amount'/><br/>
; R3 @3 O2 d6 ~7 S1 P<lable>Item Upgrade Amount</lable><br/>
9 m+ z7 L1 ?7 j6 V! ?5 @<input type='text' name='item_upgrade'/><br/>. r; F0 j6 j# m
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)- n% P: r# u) k4 W# b' b. z4 N+ Z
* F- F, x1 B- H" e! a4 Q/ b
</lable><br/>
. t/ m' K# N% Y6 [' O<input type='text' name='item_element'/><br/>! V% W1 V! _) b0 ~' k9 A
<lable>Element Upgrade Amount</lable><br/>4 x8 r' U. d' r) Z
<input type='text' name='element_upgrade'/><br/>% W7 ^# O- Y& N8 t
<lable>Pierced Amount</lable><br/>
3 `! h; F5 `2 O5 L<input type='text' name='item_pierce'/><br/>+ j0 o+ U  \/ Q/ b9 L9 L
<input type='submit'/>
9 Q  t6 U' {' T! b* X  u</form>";% K, \+ I$ o# Q
}
1 x% B8 |' G% R( i; Q- F
* q, P3 C- P8 Y9 A* [3 qfunction PostListener (){- ?. M, ]0 F" n6 i
//Add more post variables if needed and add them to initform() function aswell
$ T. q$ D/ n+ W& g( V2 p& g9 J6 c1 @8 g, c$ X9 m5 d1 h
################################/ U! S' \: S) H; d. |( y
##### Connection and Post ######7 _3 B+ V# Q: S1 J
################################# b; X: q* S3 U8 D1 C2 q
$name = @$_POST['char'];
* w# }" A) v; E( t& P$ItemName = @$_POST['item_name'];+ V" b' M6 ]  F+ i2 r. _6 Z7 o
$ItemAmount = @$_POST['item_amount'];* K" Z" E7 a) y8 s4 \8 S  a
$ItemId = @$_POST['item_id'];8 p. Z! M; h. x  N0 u1 S/ f. j+ I( v
$ItemUpgrade = @$_POST['item_upgrade'];0 O2 P# v9 S/ s! |. S  M) E- ^
$ItemElement = @$_POST['item_element'];
% C8 r  ^  ]9 b  Y5 t; B+ H, W  g$ElementUpgrade = @$_POST['element_upgrade'];0 T2 h  L# ?) g5 J- y
$ItemPierce = @$_POST['item_pierce'];
  J, x2 N: [( s( l+ b9 c################################7 G; B0 m) y/ A/ f  d0 d( H3 f/ C
2 e# _% x8 o5 j
//Check both variables for empty value8 D0 q5 E) X9 N  |- R& s8 _

' d' L7 F8 h' U9 j/ E! d+ zif (!empty($_POST['char'])){
6 y0 H; _+ `* e8 n* N) @/ i$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where 9 F, @$ w# Y; R1 d. D7 R: X

3 Y% l" v# L5 km_szName = '{$name}'");
/ m4 }7 V' Z; ^$ o5 a" a; `while ($row = mssql_fetch_object($find)){
7 b* X! x3 b9 N  Gecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";4 p" z6 k" L. p0 n# Y8 G! {- O/ l, @
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
& B" M! I3 m8 T  J$ J
% V  e4 P2 ~- q; o[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], * S; |( U- e0 W: R" T
3 a7 j' M2 Y- W
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 1 y5 Q- i+ [( L: E$ z
% k) s: V7 J. e' g! g
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', 1 ?5 p# }& E7 Z
: r' U5 f. i- I( I$ r$ c
'{$ElementUpgrade}', '{$ItemPierce}');");
7 V/ |$ |; Q) K1 I/ ]% Y) m/ S}/ Q% w2 O- y4 P
9 ~$ a' e% Z1 L; M* ~% ?
}% ]- l% X6 H& L- @! d
/ G1 H8 |6 R) ]7 ~' A
}
: I' E5 t# f4 h3 I) g, q1 p( k0 |. f3 U2 V' E
$InitForm = InitForm();; a) Z7 @- G7 t0 C3 O4 G8 \
$Listener = PostListener();8 F' T( o/ p8 q8 e9 E8 `
5 y4 F1 _5 L( g
?>
7 {& t+ a* x+ j
6 ^8 s. `& P. g- b+ O6 A% N4 p9 P! W9 G; q9 p! ^7 p$ A0 c# G
2 S' v1 T' y* `# @- w
3 q+ R1 Z. v  U: ]1 W0 x
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-15 08:21 , Processed in 0.064133 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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