飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php5 |+ ?. f, @  y6 |3 L; h
function Connect () {
0 y0 t8 p8 B2 o1 z4 zmssql_connect('Server','UserName','Password') or die('Error: Connection to DB
; y9 W$ G& i" n- f# @! v7 Z! X2 p* R
Failed.');: M. E: U% c1 {( t, E# F
}$ [6 l( j8 ?  _1 f% b
Connect();
+ V) r) |7 B5 Q
+ K. Q7 E2 A( I" O( j7 U* H$ h/ qfunction InitForm(){
' t3 l$ I) `. P; [% m, I//layout for the form
* W5 V$ s7 e! U/ L1 Xecho "<strong>Send Items.</strong>( R9 o+ P6 C0 o' t* D& g2 B
<form name='select' method='post'>
4 b7 A) C0 P- q6 t<lable>Character Name</lable><br/>
  s( U6 p; K. D& _  y1 i9 t4 k<input type='text' name='char'/><br/>
- d- N; J0 q# ~<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>8 U% N, M" h+ q6 \5 v5 c2 x
<input type='text' name='item_name'/><br/>
$ u2 n# K3 ~! R) K. V$ h( U- s" j<lable>Item Amount</lable><br/>  J2 s, w& k0 L& @9 n& t/ Y
<input type='text' name='item_amount'/><br/>
) W$ Y+ \7 v; h<lable>Item Upgrade Amount</lable><br/>. t5 T' z9 g& s, w
<input type='text' name='item_upgrade'/><br/>
& y. ~' t& d8 N5 O<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
- g9 A1 y1 M. q
+ G" m* d4 f* N2 }. I4 ?: @8 I</lable><br/>9 D) x1 [4 S% e2 D$ x0 R7 g% @& b
<input type='text' name='item_element'/><br/>5 u* Q/ B9 [3 e" ]; ?" b
<lable>Element Upgrade Amount</lable><br/>9 f, S6 R8 x1 N! B6 W: ?/ V
<input type='text' name='element_upgrade'/><br/>: Z) L1 \8 \: W4 W- o" O+ }# O, l8 F
<lable>Pierced Amount</lable><br/>
1 z' ~$ |+ U2 f<input type='text' name='item_pierce'/><br/>7 R4 D4 r5 Y8 A
<input type='submit'/>! v* ~* `+ h) S# c- @! y
</form>";1 y0 B8 X% q! j: B8 u7 w0 b* Q. n2 g
}
. n7 A) Y3 m6 f; u& D# v3 e
  p4 @! a7 s' K" l7 }- ^function PostListener (){
; i" t  p4 ?* s. F0 _6 x- m//Add more post variables if needed and add them to initform() function aswell: E8 Z$ O) k' J8 _, S2 q& f
) ~  ^) _# Y* H
################################
& R$ }: o" R* b7 ^2 I##### Connection and Post ######% C4 e9 D+ G2 j4 v0 J" f5 L
################################
) g( g* O% U# t6 z* [6 ^( f$name = @$_POST['char'];
- a4 D- }) ?$ j2 V$ItemName = @$_POST['item_name'];5 G( t$ t, l% N3 h
$ItemAmount = @$_POST['item_amount'];
. f/ g! l$ V5 I: C0 r$ItemId = @$_POST['item_id'];9 Y  g, c5 z& S7 J/ `
$ItemUpgrade = @$_POST['item_upgrade'];- q* q1 s2 d3 N. X/ s
$ItemElement = @$_POST['item_element'];1 ~6 R7 g* L' S8 z- I9 E0 ~& n2 P, Y: S
$ElementUpgrade = @$_POST['element_upgrade'];: h" y' X6 c: q; Y
$ItemPierce = @$_POST['item_pierce'];2 L" p, `$ v" D# Y0 V5 Y
################################
" p0 ]# r2 c" v. @7 E
6 f( M/ c+ U5 k0 J: V9 R//Check both variables for empty value! q3 V8 g: H  o# K1 ?; ~
) k5 ^9 e& T) ?9 `2 F
if (!empty($_POST['char'])){7 H" }' y$ T+ |6 n+ X7 _
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
/ T% N! J! _' [3 e
! f: K' I% I" h5 T0 r& n! Im_szName = '{$name}'");* Y3 n( h/ `6 ~8 `5 Y+ K8 u6 A
while ($row = mssql_fetch_object($find)){
( n% i& ?( V1 Z6 t" P+ T7 K( M, r& s, Recho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";& v1 z( M% c8 N+ F
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 7 K7 m$ x9 T' z2 ]# k8 u; k& z

* g- W' [9 T8 Y: i7 @" ?! h2 L[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],   ^8 N7 @) `. q% d; z9 [
+ c* W, [3 u& Z) ^1 B- P
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 8 ^7 _' u/ ], t' v( G9 j

; k- D( Z4 ^8 j5 UN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', + t1 n$ v) F3 C. f1 @
5 e/ @- ^; w) l. g+ A" {" }) h1 {5 e
'{$ElementUpgrade}', '{$ItemPierce}');");
/ r# o+ ?1 F0 s0 g5 Q# N2 r}" v/ B4 c; y9 h2 X8 Z. A
$ ]/ e' z: K! u
}
& R% v- \1 N2 s2 K' ~+ p% i' y9 h3 J0 Y- ^) V, M# P' B
}
. k: k2 y" w. h. I9 c% K' V! q& Y0 N5 Q; h, D; E
$InitForm = InitForm();; e& Z$ m/ \2 z* I  N  ]  ?
$Listener = PostListener();
5 {& D* l- A; N# |: m* |9 s) I0 W3 X# j
?>4 X, C8 d* |/ B9 f0 d6 @
7 K* ~! A0 q$ v- g8 r1 P4 t& g: x. T: [

. L  e; |: L, S& u, w+ v& k/ |4 r- e
" `$ j* Q$ b6 |" D% D
$ J# s1 m/ j0 t7 K6 h
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-21 17:40 , Processed in 0.060871 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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