飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php  k& e! c: U2 g1 M" Q
function Connect () {& V- i$ Q1 ?$ g/ @2 o
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB % \7 z5 {0 \1 |5 R! t' b9 U5 E' C
# V% @% y, @* O' p$ S
Failed.');- z- j1 E3 [4 L
}
- I* q* a0 ~: a3 v5 z! xConnect();
, |3 B9 d! ^% ^0 I+ |
# t1 j( m% s1 C+ ^# y' i: vfunction InitForm(){0 A0 V& `0 a1 W& m+ R% H
//layout for the form, J) }. R$ f' k& b
echo "<strong>Send Items.</strong>
5 c% Z4 D/ \7 i9 q6 C<form name='select' method='post'>
( a5 d$ M0 M1 W( U<lable>Character Name</lable><br/>' v/ w$ C2 u/ x) i
<input type='text' name='char'/><br/>( x+ h& w3 `/ H! R
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
- `( I; S% {* U5 q0 e! e<input type='text' name='item_name'/><br/>! C% \; [7 ]( r' z5 x/ a
<lable>Item Amount</lable><br/>+ P0 M- h( W% T
<input type='text' name='item_amount'/><br/>
' t( o) b. m* }& N, o6 n; |" u<lable>Item Upgrade Amount</lable><br/>6 U/ r" q" J- ^' z" \6 c
<input type='text' name='item_upgrade'/><br/># @. v5 b; h8 ]- B" W& M( x# c
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.); R( n. z) }0 W

: S6 }1 N' D- o# u3 U3 p  [</lable><br/>  \8 R  b" o. K2 o
<input type='text' name='item_element'/><br/>4 H3 [$ J3 ]4 O' P8 O4 N+ Y0 y: `
<lable>Element Upgrade Amount</lable><br/>
. m, V4 t+ Q  |! ^% f; N. C. \. H<input type='text' name='element_upgrade'/><br/>
  w. n1 O+ Z: u# I& q<lable>Pierced Amount</lable><br/>  a% g, `6 K9 i: g* f
<input type='text' name='item_pierce'/><br/>
8 H2 o7 }4 y& w* V$ C<input type='submit'/>
+ R9 T/ F; X# P4 a4 c$ H3 ]1 ^</form>";8 p  ~; a5 X8 I# x2 v6 _
}' M5 k5 K+ L9 Z+ J# N" A

! ?% w8 d( R$ A. H1 X8 W' Dfunction PostListener (){3 P  h0 K! ?' o& z6 j, t, J& j
//Add more post variables if needed and add them to initform() function aswell
) {' p( G- T# J; ]9 u
( R* E7 s* z. g' J################################0 P5 f: o* F8 s3 O- E, Y5 W: q
##### Connection and Post ######
$ z4 w1 z' A5 Y! ~################################' ~+ H# n: ]7 I
$name = @$_POST['char'];  X) D- Q7 A1 q( w4 F3 U# L7 x* X
$ItemName = @$_POST['item_name'];- A3 m+ M2 j4 ]: r4 I+ G  W
$ItemAmount = @$_POST['item_amount'];3 ^# Z. |( b6 u1 Z2 u1 q  ^
$ItemId = @$_POST['item_id'];# Z( b6 p' }! f# \. O- m5 z6 {* `( h( z
$ItemUpgrade = @$_POST['item_upgrade'];
5 |# a7 K& M( o9 C$ r. n% J$ItemElement = @$_POST['item_element'];9 M# _$ q  G  S* q6 d8 ?7 w
$ElementUpgrade = @$_POST['element_upgrade'];: r7 A' j: T0 w( P) z
$ItemPierce = @$_POST['item_pierce'];* z+ z6 @6 W+ ?; `# i
################################
' `6 }4 U  F5 }6 T9 {% R4 @
( a7 }( F& m5 D" b0 ^//Check both variables for empty value- |9 K+ G% I. d/ l
+ m, f* c" I2 F
if (!empty($_POST['char'])){
' C* n% z- p& s3 [0 J- v# G$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
. k$ {2 C0 V9 I' T0 v: u7 v+ P
! O- M- a7 W  S; o: P2 Y: P3 `4 Pm_szName = '{$name}'");
; [; s6 B9 @) W$ U: D' _while ($row = mssql_fetch_object($find)){8 p2 |0 S. k. Z6 ?& T* F
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";5 u, @& v% J+ y5 k5 K4 O' ~/ s. U. D
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
( {' C/ O- N% f' `' j  \: W  g) j, |; V; K  c, G  q
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 0 }3 z' X" Y% d$ s/ q2 P) T
3 ~3 a' P1 [4 D
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
, O! P$ y  I+ K9 l% A- k7 V5 V0 [& J5 J4 T% N4 m0 C
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
  s9 Z' j; ~1 {% ?  Q% @
/ ^9 i8 Z, t7 w  L4 T'{$ElementUpgrade}', '{$ItemPierce}');");6 a6 i7 o9 d( U1 e, X" A
}
7 m1 k+ C( E' z6 P
& i0 a2 j) [& ^}
9 ]: h4 @  y* `; [* ]5 {  F+ N0 k8 G9 }: g
}0 _  i- a/ c9 T# h6 o2 ?. m0 U

1 ?& t' R3 E3 b' g6 o$ j! c$InitForm = InitForm();" {0 S  K# V* A
$Listener = PostListener();- d% J0 s6 Q/ |5 v

5 v- Y# ?6 G6 C" M( \5 @/ a) ^: b! o3 g?>
1 E' L- Y: j! n
' T3 |! a5 w2 {! u. P
3 z6 e" [& y) P: J
) r# I8 [/ q) A% W( |2 Y2 ]  ]! j
  p  V, I# M: l$ {: k0 H$ T
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-16 06:58 , Processed in 0.060870 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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