飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php; V4 f$ ^  H" n
function Connect () {& i8 _! g+ U4 m: ^/ x
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB ) r( E8 k7 e& o* m+ P
% ~/ @7 w9 J' F6 F; E% Q' `7 C4 y
Failed.');
+ p) E; i0 T8 m: s" E# |}5 b. m' Y3 u/ t( F: B' X
Connect();
: L, B4 L7 {) p# T! Z
6 k& N4 D1 _' r* s/ V' Vfunction InitForm(){- `3 i' Y7 |; {2 }1 s' {% P9 T
//layout for the form
, R" @. Z. j0 h5 f% vecho "<strong>Send Items.</strong>
) I. n: e/ H7 G+ F- Y0 \<form name='select' method='post'>
/ ~/ }1 M% }) D8 M( |% _# S0 W* ]<lable>Character Name</lable><br/>
) C- r! B2 y. k& W# _) x+ G3 h- p; Q<input type='text' name='char'/><br/>
4 @5 C" _% m3 |<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
# j! {8 _& u( w1 F<input type='text' name='item_name'/><br/>
5 t+ B8 E7 n7 ^& p<lable>Item Amount</lable><br/>
( J& \! H; y' b* y8 [, p<input type='text' name='item_amount'/><br/>
8 h& j$ n5 l  u4 C<lable>Item Upgrade Amount</lable><br/>9 I- T6 {" q3 t! }+ L
<input type='text' name='item_upgrade'/><br/>7 l) O1 [5 C% y; \( s
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
' Q: L7 G4 |7 _1 R
) ^& G# ~' B  g+ E8 i5 X9 ~4 }</lable><br/>
4 w( Y/ ]1 B( g<input type='text' name='item_element'/><br/>& j! b2 K( D9 e- S; g' h
<lable>Element Upgrade Amount</lable><br/>. o" D" V) L7 i/ P* I1 m
<input type='text' name='element_upgrade'/><br/>' o9 C8 W& m# T5 Q
<lable>Pierced Amount</lable><br/>; G1 b7 W! s+ F: Y
<input type='text' name='item_pierce'/><br/>
5 b! J; w/ U$ c# @. U<input type='submit'/>
! M* V! f* x$ q) Z</form>";
; {! M* k1 ~( B6 @  Q; v}# p+ H9 M- U5 J. y% A" }: U$ V
- F, q! t- u$ X/ B5 |  Q
function PostListener (){
, ~% K: R( |" o4 [" Y//Add more post variables if needed and add them to initform() function aswell6 ^: h9 v% a+ R% U* b7 _. {
$ B) b% x- E- t( l' ?
################################
9 I5 g9 X& b# b  p+ h/ J. Y##### Connection and Post ######; N# E, r0 ]; Q7 n( [" }# a' J; [: s
################################. L8 {0 N" q9 [" u2 j$ m
$name = @$_POST['char'];
- b5 F9 N3 b# e6 D7 w2 Z$ItemName = @$_POST['item_name'];1 w8 e, M5 H% C( t+ R
$ItemAmount = @$_POST['item_amount'];
4 V2 w5 v  @. P5 g0 x/ o" y& ?$ItemId = @$_POST['item_id'];' y! a1 s& S1 c
$ItemUpgrade = @$_POST['item_upgrade'];7 X) J$ x% U% |( r7 c' O
$ItemElement = @$_POST['item_element'];
6 a* N9 x) \" c& v) }$ElementUpgrade = @$_POST['element_upgrade'];
& o1 p1 F7 v: ~( g  W( w$ItemPierce = @$_POST['item_pierce'];
. p7 t& H# w. X################################
2 k4 i4 ~  {" |* u0 e& D- c! r8 ~) d) l: U( K4 `% ]
//Check both variables for empty value
3 f) X0 D, Z! s( `4 o+ N
" f  V; b9 t7 k1 Eif (!empty($_POST['char'])){
' T. L$ U2 t( ?* v9 x$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
/ D8 e5 l+ q; ]& P
* |7 p% Z, Y/ km_szName = '{$name}'");
& x* `: V9 j9 P. f' S& Q' x3 owhile ($row = mssql_fetch_object($find)){
' D6 L) I& U$ \  r* c5 pecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
  M1 t2 Z( J" h$ R$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], ) R. D, k" H, d/ {/ q8 w: i

( _( S4 `/ r( {# [[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
* S& _2 v/ m, r) N$ O  K9 Y9 l6 ?8 j. D/ |
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', ; I  M7 W: E7 J6 i
( c( G9 Z9 m" d' W& M$ z, M
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
8 V, h$ Z9 ]* Q, c. Z! ]: y
1 `0 o+ v7 z3 e2 b. U7 h'{$ElementUpgrade}', '{$ItemPierce}');");" Q! u9 ~! ^% C, D1 _+ u
}
5 t) ?4 t/ H* x8 j8 A( Y1 N4 H. k4 u2 J% z) o3 ?: c. }
}% i" P9 O- S( R8 h
- _4 ]) Y" m! c! R
}" |' c0 }6 m+ K
. l' C( w8 P, d* _% C$ p+ k1 z6 Y
$InitForm = InitForm();
0 b7 J2 l9 n! _; Y: Q$Listener = PostListener();0 R& f6 p5 a' \2 I
6 l) L6 p5 Q2 ^, k/ c/ h" A, p! [. z; V
?>* V' W3 o$ n/ j1 A* g6 `
1 g% ?4 ^" b+ d2 |9 T$ ^: a( x
9 I) u0 e0 A! @, d9 p- I

' @0 q0 L# a$ w' G
/ t7 R( d# s3 P4 G$ n" }
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-16 03:17 , Processed in 0.059906 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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