飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
4 z$ w6 Z3 y" yfunction Connect () {
. s  b9 }6 x6 C2 B$ D: d) gmssql_connect('Server','UserName','Password') or die('Error: Connection to DB
: ^! y, H6 l6 c
4 R0 m( v& q4 M6 a+ Q& D6 mFailed.');7 x. d( P  T( D5 x, ?0 b% m
}. u2 Z% b, k& l# z
Connect();8 r0 B3 e5 ?) G- L1 C
/ d% {( y: h3 O3 q  [% P9 T* |3 N
function InitForm(){3 c: S9 {  k6 x
//layout for the form
& ~" s% t, U1 c4 q6 L. E6 ~! d: L6 _% oecho "<strong>Send Items.</strong>$ _7 a/ Y) P; y& t
<form name='select' method='post'>
$ x$ O* Q: X  [4 z; h<lable>Character Name</lable><br/>: ?5 M8 Y: r# M! E1 `
<input type='text' name='char'/><br/>
8 B0 Z$ m1 v% Q% t; K; P6 n3 a5 d<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
1 z9 z. c: R' e1 s" P# {( t/ R<input type='text' name='item_name'/><br/>
2 h7 T+ A5 Z, y9 d) G<lable>Item Amount</lable><br/>7 M9 @) c# [3 a( R2 r
<input type='text' name='item_amount'/><br/>0 B8 V$ J; g* r" M$ G6 Y) \9 J
<lable>Item Upgrade Amount</lable><br/>
! }; R* m( t2 c# S<input type='text' name='item_upgrade'/><br/>
# N+ H' W7 z2 U( a9 B, ]<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
" @5 X! s. A' B$ x" Q$ R1 q+ y0 Z" Q# R' H
</lable><br/>, y! K3 @+ R4 I" p, h% u" b
<input type='text' name='item_element'/><br/>, h0 X6 o2 c% D% R5 J6 m. O
<lable>Element Upgrade Amount</lable><br/>( \' Z" \" L) c# \6 j3 N& Y
<input type='text' name='element_upgrade'/><br/>
( W$ ]9 ]  S, }<lable>Pierced Amount</lable><br/>
7 K6 z1 m' b2 O0 _* E3 [<input type='text' name='item_pierce'/><br/>
9 D$ @7 w+ r  r4 t4 `' k9 a<input type='submit'/>
7 y  ^# F2 C# P</form>";
2 I" N: _8 L7 ^5 R" E" P}& o8 t+ ]- Y) e# }. `$ g& I- Q/ n
! ?3 x9 ^6 R9 q; K3 L* s) @( O
function PostListener (){
; }" s" [9 H& Y+ o3 ]7 N//Add more post variables if needed and add them to initform() function aswell. {1 l' b- t. s
% f% Z2 \; w( d& }2 q4 i4 }1 E: T
################################, G$ r' _9 l5 L1 F8 l' I  o$ @
##### Connection and Post ######
0 `( ^3 ]& L1 {7 X; v. `( a################################
3 j0 u4 v6 O) M: ~; d* u$name = @$_POST['char'];( d/ I/ _# M/ p; p) f8 ^1 `
$ItemName = @$_POST['item_name'];
( S$ l+ T/ A8 ^8 @  M8 y! O- l$ItemAmount = @$_POST['item_amount'];
7 ]. S6 n' L2 G$ItemId = @$_POST['item_id'];
5 g: f8 l1 f- J3 N$ItemUpgrade = @$_POST['item_upgrade'];
. v/ I1 |+ V: N0 B2 @0 f- z$ItemElement = @$_POST['item_element'];
5 U. i6 g" e; ^; ~3 G/ u$ElementUpgrade = @$_POST['element_upgrade'];& g, Z+ O, v  Z/ ~" z
$ItemPierce = @$_POST['item_pierce'];2 j* B! {% [0 s  w
################################% Z0 v! G: l% o1 F+ m' D8 p

6 D% V$ c5 n  v# k//Check both variables for empty value" N" V# g9 b3 Y, i' l4 |1 X
3 f0 a0 ^& ~; ?, O/ G; L& m6 O
if (!empty($_POST['char'])){3 x. c7 |" k7 Q" f. z! ~9 M6 ]
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
4 U1 ~/ V4 l! E; a8 E3 n. E
) A* P9 ]; j; l& N* A4 I& wm_szName = '{$name}'");1 x. `9 F# N6 `( d& q9 s0 E' W
while ($row = mssql_fetch_object($find)){% w# j) U! H$ v2 A/ {1 g/ }
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
: e! K: Y: L9 }9 W" |2 l4 N, u$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 2 B' d6 ^& t( D: C3 ?. Y- W% ]
. m+ F  d" W0 G9 b! C
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
* D, Z5 w* @/ f  ^
9 W' Z1 I; W0 a7 [0 P* U1 F[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
4 c* S) A- N/ M4 [* e# Z, ^
* Y; ^+ F9 v! a! U7 b* i, VN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
. a8 Q- `' A8 m9 ~8 P. b/ i1 N$ u! M7 q/ m3 W7 R8 q0 |) o
'{$ElementUpgrade}', '{$ItemPierce}');");
7 ^: H' @4 h- j" t}
' C! J1 q6 }# e' Q5 u% e# z  V
$ L. F1 T  E2 x* v% X( k}' A- ?$ E7 n  t7 Z$ q( n
& T; G; [0 T6 R5 R! b' E5 b
}
  T! E5 }+ T" C. c5 M3 ~: G' x5 a) C
$InitForm = InitForm();
( M1 b4 p* W9 L5 a$Listener = PostListener();
4 J( r( P. _) K, A1 y2 p6 O0 C# B# S1 M4 A* y/ \1 b* J
?>
* c3 P; k0 P9 X- {: W# K9 d6 L) D& Q7 n3 C& ~, }  M

8 U: N2 T3 w  i6 V3 S8 Z6 `3 h
6 ~7 u- W1 b! H6 b4 R; |7 e- a: u; n0 B4 ^* F
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-3 23:41 , Processed in 0.062011 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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