飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
8 B% e% p2 q) i8 e6 Ifunction Connect () {6 J1 S" U6 V# j+ L( r3 k7 |
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB ) I2 ~) b0 b- q

8 E3 N! M) W! C& {Failed.');; h, p. i7 Q1 c% t- w$ b- G4 I
}. d$ f# J* V" F
Connect();. ~' k6 u) o0 I" k) _7 P6 _5 L

; n& x5 Q5 o3 [' [8 j% ffunction InitForm(){" s+ T+ I, U* K  C
//layout for the form9 t; Z0 r6 O1 t! m
echo "<strong>Send Items.</strong>
0 [  s8 ?/ [( l+ R: H$ L) C<form name='select' method='post'>
- O: n' F4 x9 A' ]4 O2 i+ Q, X<lable>Character Name</lable><br/>  h2 l) O/ Z& ]( H0 B' E) H
<input type='text' name='char'/><br/>
$ y/ Z- X, e; O<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
7 b$ `' T7 z; @9 q<input type='text' name='item_name'/><br/>- ]" D7 l" a# Y2 ]9 Z- w8 o/ H
<lable>Item Amount</lable><br/>
1 t' ]# V( f0 `$ a<input type='text' name='item_amount'/><br/>
( x% p( K: I! c- H- u* f<lable>Item Upgrade Amount</lable><br/>* c: ]' k: E& Y$ P# J$ N5 h9 P: |5 J5 j
<input type='text' name='item_upgrade'/><br/>
; F9 r$ J' c' Z5 h<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
2 ], C0 B$ r& H. v/ p- f
) A  o, s: L# j</lable><br/>" d: n7 u6 Q# b7 [. ]& K
<input type='text' name='item_element'/><br/>" B$ }# y+ l9 M) h2 O+ R! f
<lable>Element Upgrade Amount</lable><br/>$ |0 ]5 f2 R+ x/ F$ Y6 R
<input type='text' name='element_upgrade'/><br/>9 r6 b% x  y  {
<lable>Pierced Amount</lable><br/>
/ T. v1 q5 k5 J; W: r7 ~<input type='text' name='item_pierce'/><br/>
8 Q! s0 a3 f9 Y' X; f<input type='submit'/>
- V; L& V) W8 K( s# l( K</form>";( [. ?( @; Q7 z. C+ G3 d, P
}/ E" y* y8 F' `2 |5 y
  ?" z  @1 M; _' F  B( K0 E( v
function PostListener (){
% ~' n4 h) G, j3 U( Q1 K1 g//Add more post variables if needed and add them to initform() function aswell" x1 e* Y; X5 E) G1 c: K, S- l
0 ^/ F& ^3 ~6 D
################################3 P4 i. G& S5 G
##### Connection and Post ######
. b0 I, L' x, E: r% C2 D9 r+ |################################
# e9 B* e6 x- U$name = @$_POST['char'];- r" ^0 T6 u+ B; O
$ItemName = @$_POST['item_name'];
% r8 v& ^# b4 i& G( c$ItemAmount = @$_POST['item_amount'];$ I7 A4 e, H# L
$ItemId = @$_POST['item_id'];/ q) ^6 D$ I" K0 j% x
$ItemUpgrade = @$_POST['item_upgrade'];
$ `" _9 g5 o- C- G$ItemElement = @$_POST['item_element'];
! _  Q- Y, b9 F( l4 y/ T- l& b$ElementUpgrade = @$_POST['element_upgrade'];, W2 c1 S# B! W+ C: e
$ItemPierce = @$_POST['item_pierce'];
( z2 R6 `. h  Q3 a9 U  F9 m- {################################
( W: A6 E+ d" G8 r+ w, H* s  W& P/ d
//Check both variables for empty value& x7 v* k6 Q' L# @) X

( Y% I  c& p( _if (!empty($_POST['char'])){
* t9 N0 ]! g% y5 _# I2 k+ {  M$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
3 w7 E; R' z; g  a% N; K/ q. L+ H4 u3 ~; S
m_szName = '{$name}'");
9 q( q0 F/ L3 N, {while ($row = mssql_fetch_object($find)){
9 v9 P# o5 d# N1 secho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";2 O2 N. J: Q' [/ s  |5 ~6 a
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], ! T$ M# I! Q/ y& i& Y3 y( E# B/ S3 }# i
. Z$ P. @1 R: p) f0 R
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
( W& M6 E: y. E# u$ A
7 G1 C9 y8 i0 x: g* M[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', # }! x' u7 H- o
3 {4 ]0 s+ S' f0 }3 ], v, H: s
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
( ]5 x; P# R2 G4 J, B3 W1 n0 i
' {' L7 Z5 @) K- R5 D'{$ElementUpgrade}', '{$ItemPierce}');");$ q" Y& s6 [3 a) N+ P; s/ l  j( Q
}! T% e4 @$ H( f1 d( L* @
9 {1 ?& V4 `3 E5 v) I1 o
}9 o' \/ r7 d+ c8 }
+ b/ S: z; b% @' ~% A+ b4 e
}3 c1 R$ E6 u# `4 @* `( j$ h3 [% q
2 w, t& H. ?2 ^
$InitForm = InitForm();8 G# O- n0 [1 g$ @8 Y/ x* j8 r
$Listener = PostListener();
2 Y% K- F/ {( Y+ x! x$ E" ^! m. k7 i3 Q- M, b8 P; {1 c
?>1 d8 s. L/ d  i0 v1 d" t

- p6 a3 X- a0 ^. i7 m: s; h8 t: y( G0 R7 d0 X5 u! X% H
* j/ C7 x2 f! e( F$ k3 {* w
9 u6 c: r5 y& M- h1 J( L) J
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-8 20:50 , Processed in 0.059096 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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