飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1088

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1088
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php4 {' U; t; _: @; d
function Connect () {
! W( e" i, e% y7 D6 n& l7 ]mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
* b6 I  R* T, J. {9 J0 C( Y8 K. }9 H# W. m  K8 W# }: i5 j
Failed.');3 _) h; ]# s& Z9 N, @
}9 x, m6 T6 P& y5 {* Z6 Q' b8 h
Connect();
( M5 Q" m, Y! l7 a
) J# z* d9 @# Q  N- B; @# l  hfunction InitForm(){
6 q' F/ ^& X0 ^9 V1 N! u( a//layout for the form" ]  V- o% {  K* ^4 b# e
echo "<strong>Send Items.</strong>( r8 j" Z$ U/ N7 N# b0 q  o
<form name='select' method='post'>
4 n& j/ C2 i2 g5 W8 o; L* C<lable>Character Name</lable><br/>: R$ ~/ A: D* c6 M4 {) W% D
<input type='text' name='char'/><br/>
/ C# d  v+ }% C<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
) s) K" E- J. `. o0 s, \& ~8 C<input type='text' name='item_name'/><br/>. ?9 P9 Z' J/ G# _$ A6 K3 s9 R
<lable>Item Amount</lable><br/>
: x5 D# D! K5 u* m- Q0 M7 ]' u) ?<input type='text' name='item_amount'/><br/>
9 V+ W$ e# `- G4 m  @5 H* T<lable>Item Upgrade Amount</lable><br/>
5 j2 \5 P1 F2 g; H" g<input type='text' name='item_upgrade'/><br/>
, a3 @* T7 J' m) m3 N<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
$ x0 X9 `8 a7 e/ h
( @  x& C$ a7 |  q* e4 o</lable><br/>
; n, `% Q' n0 ~/ W<input type='text' name='item_element'/><br/>
8 q% m' z. r: Q( A2 Y<lable>Element Upgrade Amount</lable><br/>
% o$ [. v9 Z8 ]  w" B$ b' @<input type='text' name='element_upgrade'/><br/>
- E! ]$ \$ z: @* a6 U% o0 c- c& x# c<lable>Pierced Amount</lable><br/>
0 ~4 s9 [" `  g: H* s6 C<input type='text' name='item_pierce'/><br/>
; |6 @5 T. \1 X4 T/ c: h- X<input type='submit'/>% u6 O; i4 S8 ]9 G' i8 \8 P
</form>";
/ j4 G8 r6 Y6 T# L}
. x; n! j) q5 L8 |: A& i3 O5 y& \. b' ~6 o
function PostListener (){
, }" I6 k! Q$ R* i  H//Add more post variables if needed and add them to initform() function aswell( m1 b8 Z9 t% Z/ N6 _% W

+ z9 S* f4 L6 H! u7 [################################" B& ~: N: [4 s! x
##### Connection and Post ######' P; y, n7 F. L# g' c# s
################################6 n" q. x8 L* D' X" C
$name = @$_POST['char'];
. e3 k+ ^' L3 r6 a$ItemName = @$_POST['item_name'];
# D. c$ j; F2 X$ Z  p$ItemAmount = @$_POST['item_amount'];" L! B7 ]$ Q+ d9 S
$ItemId = @$_POST['item_id'];5 ?' A  }7 e" `" ~, Z9 e! ]
$ItemUpgrade = @$_POST['item_upgrade'];
  c( G% |/ F' n$ItemElement = @$_POST['item_element'];
( d2 i9 x4 K. i# e$ElementUpgrade = @$_POST['element_upgrade'];
0 G/ g/ R+ O  h8 |: k$ItemPierce = @$_POST['item_pierce'];
3 H/ [+ q, ], q4 g- S# q################################  u  t5 p7 E) y& Z# e

7 ~. m. d9 E0 u( Q//Check both variables for empty value
; \! O4 w5 m9 n% y, ^  \( V# c& z: l+ O7 I8 b- e3 [
if (!empty($_POST['char'])){+ R0 @3 s; t  {
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
. c$ V  o$ A( X# X* `# e* h
3 k+ O. f. X' ?. Z4 w% @m_szName = '{$name}'");1 y5 I' t9 h+ D
while ($row = mssql_fetch_object($find)){5 n: ^& j0 |7 m7 G8 }
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
3 M4 q7 L1 F# v) S  y$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], $ `- X1 l; f8 I; l8 I

" v& P$ [4 P# l$ A, L[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
5 O# F. Q( P/ }4 x+ D$ Y  n: M  J( ~# X8 P; q/ N' c
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
1 h3 z1 M. ?. w' Z; Z- _0 ~0 z1 U3 a! ~0 Q
" v0 K/ O3 U( y, ]N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
8 F9 ]) W( y5 N$ L; J- F; ~) @6 f8 c3 X
'{$ElementUpgrade}', '{$ItemPierce}');");  o3 L" _' t% @) J
}
/ s, F& }( w" n3 O
. h0 p5 k! M  H$ O& p5 c+ S}' U, W4 ~/ O; c7 R# h1 w7 d3 p

. \6 t7 B" j. X# j6 [}
7 H1 ~  w# T8 O6 K- _9 e+ X# y8 ~6 I, T
$InitForm = InitForm();# |! z2 @+ G' P) v2 r4 A) `( d$ M
$Listener = PostListener();8 x5 O) w2 p9 `

! K6 ~* e: P: l3 D?>% W2 E- n, E0 N! R  ]# }( `" ?

- @. X9 c  ~% q+ ^1 J9 M* T/ G' p$ D- D) ^4 {8 Q4 ]
9 x9 m: D& }# |$ q$ ?0 s

  T  P* C" C! g7 A# Z- o4 r6 g! }
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-23 15:26 , Processed in 0.058475 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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