飞飞世界论坛

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

物品发送脚本

[复制链接]

200

主题

203

帖子

984

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
984
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php7 c' I- u) ~: L4 Z! o. T0 e: q
function Connect () {
5 X9 y) }$ ?7 }; ?0 {mssql_connect('Server','UserName','Password') or die('Error: Connection to DB 5 ?, O9 _6 T. I( l
2 N4 c# A6 Y% i) @% O4 o% y
Failed.');
2 z- F; r5 d- \2 j}
( ~4 i$ L4 n3 _- BConnect();
( A& I5 }1 P8 ^. E, V
5 i$ p( @: x2 V9 t9 yfunction InitForm(){
( m2 h7 V$ M: x3 L# |8 H//layout for the form  a7 R1 A5 {- S0 q" ~
echo "<strong>Send Items.</strong>
: R6 J" h% Z& N<form name='select' method='post'>
2 b( z1 K. e9 e3 G<lable>Character Name</lable><br/>
6 A. A3 x3 S) E( R+ ]; {  o6 N<input type='text' name='char'/><br/>
: P# f6 z, K1 ~; a! o! ]<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>! q: A! u9 e( U3 j' g8 O% q! P
<input type='text' name='item_name'/><br/>
* R: |% m: N7 j0 C7 S9 Y4 p<lable>Item Amount</lable><br/>
) U. M4 v9 D5 c) V  S<input type='text' name='item_amount'/><br/>" w( ~7 ~+ M7 X' ]6 p9 {7 A: [1 f1 b
<lable>Item Upgrade Amount</lable><br/>
3 @# }( a1 u* F2 d. [# d<input type='text' name='item_upgrade'/><br/>
3 P8 `& f- i) B* d. e2 E8 W<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)4 D8 e( w. K+ `/ a7 S$ D

' j2 v. F1 f( i( K</lable><br/>
2 N1 o# c* {# s! X0 a; w" c<input type='text' name='item_element'/><br/>& ]6 O% a/ r' O  f; s3 D1 s2 M9 n6 M
<lable>Element Upgrade Amount</lable><br/>* U- s0 i( h) X3 A$ t
<input type='text' name='element_upgrade'/><br/>1 Q7 W4 I' A8 @& u) Y3 w" Z3 \. O( [
<lable>Pierced Amount</lable><br/>
& t* w: g5 x7 U<input type='text' name='item_pierce'/><br/>
8 Y  A1 e* F6 ]/ _<input type='submit'/>% J$ P7 H( q. F2 q+ |
</form>";1 z7 V9 L6 R% R" B+ H7 Q' s% d! \
}
8 z3 S$ ]# @  b! j
/ w  V% Z# ?* Hfunction PostListener (){1 X+ H: ~1 h3 c3 z+ L
//Add more post variables if needed and add them to initform() function aswell3 d1 X3 a: B) b1 R+ @& B
! G2 c! ?9 F! F% X( A
################################
7 c$ W% ^) q5 y, U5 F4 C##### Connection and Post ######
: o: J+ d; H0 x2 ~################################$ N1 r* O" |( U7 ?! \6 j1 C2 T
$name = @$_POST['char'];  I$ E- \% O2 [. z- W
$ItemName = @$_POST['item_name'];4 z; h; q4 r7 p( _
$ItemAmount = @$_POST['item_amount'];
* J: m0 d( G" W. D/ w6 r. t0 c# ~$ItemId = @$_POST['item_id'];
- T6 T9 w3 _  b5 s% T$ItemUpgrade = @$_POST['item_upgrade'];
3 t2 h6 V+ P4 E$ Z$ B2 P( X* q$ItemElement = @$_POST['item_element'];
: g: m0 Q8 R/ l( |4 c$ElementUpgrade = @$_POST['element_upgrade'];
  }! k- [6 y' C" ~$ h: n! s$ItemPierce = @$_POST['item_pierce'];1 M; i* x+ z! k# A0 T8 C: L; }" u
################################4 q$ S! a2 @) ]+ G/ o; x

- Z- \; v* R7 S//Check both variables for empty value* {1 |$ }6 H/ J* X
4 r( d* t: F5 k9 Q' `5 n
if (!empty($_POST['char'])){( \; Y& R( y4 M, |* L& h
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
% e2 q; V, _& b; X5 Z; q; {. {" F" y" M/ x+ N  V: X9 W
m_szName = '{$name}'");
  _9 n; v, `/ @) U1 d" J- gwhile ($row = mssql_fetch_object($find)){
: x, A, ^1 S" K1 b0 \/ M5 Lecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
0 u' Z: F4 L! S* q, q: t5 h$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
* i* x6 H% t7 O1 `
: C, M, j$ I! M[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], ! c1 s3 h$ F  s( Q& q- y
4 H( s/ f; N/ N# z1 |6 ?$ S; \
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',   E. {2 m% v5 {1 q' a9 A
' d7 C3 x5 m' L
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
/ U* F. N+ K* {% F& }8 Q, u7 A! H! ], Z/ L- M
'{$ElementUpgrade}', '{$ItemPierce}');");4 m" Y0 i% |  W4 F* |
}
% b1 [$ X' I! R& K+ z" Z) v* m" m
}
; N- y: H0 z7 ~* P" ]- j  r5 m5 ?2 B9 ]# k
}, B3 E# t8 I) m1 O* }' }

4 f6 u2 f! N* c9 M0 i$InitForm = InitForm();) T# d* k3 o0 G$ l# r' ^$ V
$Listener = PostListener();
# \* g* x" _0 Q% q8 b
4 w$ @5 i' E/ N# Z# B?>! ^" s! ?. l  {; q
2 P5 O6 W  }$ l7 h5 G7 X7 ^" V  L
, |! y% f7 e( V8 L3 v+ Q" G- i
8 O1 @! s* k% U5 s. n
# I6 T3 B: N3 D% C6 a9 ^
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-8 13:10 , Processed in 0.070574 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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