飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
& i3 z! t% z8 D  v9 Y1 V" h* Ifunction Connect () {* f& P- B9 M. S$ |
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
+ ?; s& A% G, w0 h  U' F0 p: c( L) Q$ u; y+ L
Failed.');
8 L% z4 u: U) H, p% J}9 [: ^% F. g- S( d' n9 j
Connect();) ?$ e" @+ e/ g

% U0 e: e0 \9 X7 }function InitForm(){
: c" s. o: j* n) i( P//layout for the form
4 I) W2 S) ]; m/ t) iecho "<strong>Send Items.</strong>
9 t% |# v: l4 C<form name='select' method='post'>! S1 G3 q& Z! U6 d$ I. ?+ ]
<lable>Character Name</lable><br/>$ p! i/ X2 F7 M7 {8 _7 I# X
<input type='text' name='char'/><br/>: v+ o# z- K& z0 H% p" o% |
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>6 Y" i" ?( q% N* N- w6 ]
<input type='text' name='item_name'/><br/># d0 w' ]7 f5 O" `4 A/ @$ E
<lable>Item Amount</lable><br/>4 W8 I9 f5 M9 l# ^$ e1 D
<input type='text' name='item_amount'/><br/>% G* d, ~0 m8 {, V
<lable>Item Upgrade Amount</lable><br/>
$ Z+ d1 o+ i% B<input type='text' name='item_upgrade'/><br/>
* t# T+ B3 D( s6 }+ [# w: \! \<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
" M4 P0 A' P% q' W" w& _& O0 X& U# e8 {* _, Q0 p& G
</lable><br/>. Q+ R9 y$ _7 z- m. ]( }; E! V, M
<input type='text' name='item_element'/><br/>0 q  S4 \9 v$ _0 b2 E* `* }
<lable>Element Upgrade Amount</lable><br/>
$ Y! v5 ]$ X! c0 B% i$ f' k<input type='text' name='element_upgrade'/><br/>
" r6 J7 Z  ?/ w' P+ T! H# P; Y8 G<lable>Pierced Amount</lable><br/>8 z" }' ^, C, l) V: P) k
<input type='text' name='item_pierce'/><br/>
# i7 ?" A/ H& F5 F<input type='submit'/>
" }+ C) X; _2 A; U3 [- I4 D</form>";& D0 Q; J+ d$ S' y. j. n; p- e
}
: a$ U1 K! P$ P" _; W6 y; a9 Q; ~. z+ g
function PostListener (){
/ t) I- `8 M- @5 ?+ Q" q3 V//Add more post variables if needed and add them to initform() function aswell( [( T) P7 R) p
# \, v# S4 {/ l& I# ?$ P) e6 W* o
################################
3 O4 ?  S* a1 y: y0 c2 @* `##### Connection and Post ######. l  i6 F9 T9 G- f* j  ]
################################# ]  n3 q0 I# V! e
$name = @$_POST['char'];
  ^2 r, P. A3 S% l# Q$ItemName = @$_POST['item_name'];
! D/ _6 P- B2 S2 p. m5 H$ItemAmount = @$_POST['item_amount'];  j3 h2 Z1 P3 q: L  W2 X* w
$ItemId = @$_POST['item_id'];
. U; m5 V& |0 l$ItemUpgrade = @$_POST['item_upgrade'];$ f8 v; l$ u3 ~" `+ D0 a
$ItemElement = @$_POST['item_element'];
0 v$ D! s$ z& k( K9 k$ElementUpgrade = @$_POST['element_upgrade'];
1 s0 z; _$ }$ ?4 ^$ItemPierce = @$_POST['item_pierce'];! U2 o+ s7 `) V, b, L' _
################################
- A$ y- S' J$ X4 x0 M
7 Q) w0 |3 d) L//Check both variables for empty value: \4 T) h# @" |1 f

% V9 W+ G0 q7 f. h+ n3 iif (!empty($_POST['char'])){
' D1 z9 G4 t5 [9 I  r$ X$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
3 [3 F$ n' n8 }( C- X3 d. Y* `9 A# H
m_szName = '{$name}'");1 O% Z9 c' T: q5 |) G- A. o: {) f0 O
while ($row = mssql_fetch_object($find)){
$ s0 @7 \* c" T( B# h. Decho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";5 u. e5 T1 @, K! E
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], ; n1 H1 n4 `4 e) a5 m1 Q
+ u% A: t, i" |  V
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
/ t. z9 Q& v( }
6 I5 t2 [8 N0 E. O+ d: m3 C: o7 @. E[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', & Q) _8 A& ?8 N. }
5 V0 s( t$ s. A) V
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
1 `& L9 p/ G9 D8 S. k4 R2 q& m% j9 H- C/ ]* [* M/ ?' r
'{$ElementUpgrade}', '{$ItemPierce}');");* ^5 U  u, u  ?& i  W0 x
}
: i  L9 z1 O3 }
' m# t' O9 o7 q  ?8 f* E+ j}* a9 Y* v0 R0 A# e# ~4 s
3 ^& z1 s) U! s" K% Z0 h
}
8 M' ]) J# |# `! b7 k9 Q5 A! m0 R* I5 I) W
$InitForm = InitForm();
) M! H+ k: p: ^: L$Listener = PostListener();
1 k; Y6 S3 b1 [' [8 J/ w6 F) e2 U+ i. s- I
?>
9 m8 k* P* C% O9 O; ?1 l, s; i# b! g2 q4 G7 r, n: ~
; F& w4 l! W7 A6 f- @- [4 H3 A
/ [% F% R, W% U6 S! Z7 C2 b& i

5 D9 F% t2 ], W& B! }0 c3 K0 f
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-27 11:11 , Processed in 0.108736 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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