飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php  ~  h4 m* ?& e
function Connect () {  l, x# \( O% T3 j# l$ E" \
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB ( E0 a# b- D. p* Z& X6 P
6 G1 g  g' O8 M" P! {
Failed.');
) k0 e6 h4 [! D* d5 E9 k; ^}5 x& |1 B  Y5 `# e5 j
Connect();
& w! q. I% j, n. t4 M5 ~! [. u9 v1 _& S# C8 f! r) ^* l& M! R) V
function InitForm(){
& H" Q' D' c! D  g5 l; F//layout for the form
1 v. @, y& z: a1 e' Z2 m$ Yecho "<strong>Send Items.</strong>1 \. S6 F" V! O
<form name='select' method='post'>. j7 q* L) x! L
<lable>Character Name</lable><br/># E; B$ m! @# ]3 J
<input type='text' name='char'/><br/>1 O# l5 S* i  v* _4 ?
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
! z/ z1 l% p- E, C<input type='text' name='item_name'/><br/>! \9 Z- J2 v" W. W, h6 k4 p; r
<lable>Item Amount</lable><br/>
* z6 g3 G/ A# G% ]<input type='text' name='item_amount'/><br/>& _; m4 L% }7 q. ^# {4 f! \3 s
<lable>Item Upgrade Amount</lable><br/>
' ^4 _, g$ ?. C& d1 d1 u<input type='text' name='item_upgrade'/><br/>
' n1 z! a( _  n6 A<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
1 C: t4 W) }0 x. X) C: F6 `
+ r% m% l! h$ E</lable><br/>  Y; t/ d7 W4 v& i1 l- p
<input type='text' name='item_element'/><br/>2 z3 t% H# N/ E) Q5 L9 a0 p7 Y
<lable>Element Upgrade Amount</lable><br/>6 w5 m8 f! l9 x
<input type='text' name='element_upgrade'/><br/>
% J, f3 F  u% B1 ]5 A/ O<lable>Pierced Amount</lable><br/>) J# H' p9 Y" L1 i$ e
<input type='text' name='item_pierce'/><br/>
: S7 Y8 q$ C9 b1 f& D6 z<input type='submit'/>
( i. Y4 e; X+ S1 F2 e2 ?- d* ?</form>";* B2 q4 I2 p) M6 t3 U5 @
}( [# v! U) d- |) @

" D- |) D8 u" h! T, d4 Mfunction PostListener (){
4 M  L% B, N0 E. f//Add more post variables if needed and add them to initform() function aswell( u3 k. B/ V5 a8 r1 v; i

( h, G+ D+ c2 b# Y8 I" i2 g$ o################################
! f& J7 u; I  T' u9 E; X, ?##### Connection and Post ######
  A( u( g# d) |$ B################################) D6 R' l$ ~+ `& i  A5 _; z2 ]/ K
$name = @$_POST['char'];
( O9 B/ Z: P. T- V3 V$ItemName = @$_POST['item_name'];
& J/ U4 Z" Y, o# ?$ItemAmount = @$_POST['item_amount'];
/ p( F! N( d4 Y$ItemId = @$_POST['item_id'];! k5 l$ ]* W2 J; ~: P+ B+ Y
$ItemUpgrade = @$_POST['item_upgrade'];4 B/ o* a8 @2 _6 `# E) a
$ItemElement = @$_POST['item_element'];1 i0 @2 W6 J, Z; [% Z! \6 u: j  [
$ElementUpgrade = @$_POST['element_upgrade'];
  G* f! M$ ~% a. d5 `* }$ItemPierce = @$_POST['item_pierce'];0 ^$ m4 z2 r( k5 l/ o- h. q5 y
################################
% P# S( t8 m( @
/ I# g) P# g* V3 V+ W% k. M//Check both variables for empty value
' B- r: Y  V1 j4 j9 T
. S8 i. r0 A; s# E) L2 mif (!empty($_POST['char'])){
, n5 k1 l6 j! `' q4 ?$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
6 w1 q- r: _7 Z3 Z" a2 S$ S* V6 h# K9 o- F  [* z
m_szName = '{$name}'");0 ]' ^; O* s/ t$ i& W4 s
while ($row = mssql_fetch_object($find)){/ J2 u2 u( O' V/ M" j
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";% }) g( [  U1 i9 ]4 S0 s
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 9 z6 D3 l0 x% z, ~0 f1 p, R9 f2 v
) e& U3 [. O3 y7 l1 W/ V
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
6 x( m, e. _6 t- D& b
9 O5 B5 H" N0 T[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
0 p* y$ V5 z7 o8 @- o
3 G/ Z7 e# w# F5 QN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
8 [: u2 k, _# Q! u/ u4 o9 K
& }0 H) |! t5 |# k. u'{$ElementUpgrade}', '{$ItemPierce}');");* c# r0 S+ ]+ E5 V
}3 O) k9 c+ [) J$ J# Y( L$ g

1 Q& P5 Q: s' V2 H$ ~; }8 x}5 R: M/ ^8 i  ^( z

6 ~. K5 Z4 M0 x$ z6 q9 P8 Q7 _}# u6 c: c! a$ J* O8 w0 b& I/ S1 H& I

! b! K% V5 c  D. s' r/ K$InitForm = InitForm();/ w+ _1 D0 Y$ I+ ~3 v
$Listener = PostListener();8 M1 ^" b7 [* D4 B" n& A9 l# b

; O8 x6 t" q  K4 J- ]& N. g$ H: |?>' z/ X9 q8 v+ T- J

3 k1 J4 J9 ^) }1 f0 i
4 M- ?1 }! ~/ y* k$ Q& Y' G: q; ^: q0 [! l4 E

, ]9 Q! q4 s3 L6 M! O  t! ?, V
回复

使用道具 举报

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

本版积分规则

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

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

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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