飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php( r  q; L& P4 A! ]' M. z2 @
function Connect () {
: K! F! c2 _6 ~, t2 W  N# E" Cmssql_connect('Server','UserName','Password') or die('Error: Connection to DB ( I1 o* w1 U" P- @. p  A
; ]% C( u5 K- g' ~( g& V- z
Failed.');; a0 z' m1 C- n, r
}; X) w$ a+ C( W' j4 @7 B
Connect();
- i" ~* X2 w' C/ q4 C; P+ V2 J+ a; I( t8 q. y) n* q9 c
function InitForm(){
3 x! l% _. [/ E5 E//layout for the form
. {2 l. K1 X: n# Uecho "<strong>Send Items.</strong>
6 |( U' b& q3 I- {- {<form name='select' method='post'>
$ E& m6 @. o0 ~<lable>Character Name</lable><br/>
8 a1 {. `" P% @<input type='text' name='char'/><br/>
# I* @6 f, q: }& T7 _( p: ]) r( F<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>+ y) A1 p, H, t
<input type='text' name='item_name'/><br/>" `9 T0 B' X( _" t, \; p, p
<lable>Item Amount</lable><br/>* v6 C3 d; X' N2 d$ C+ v7 ^
<input type='text' name='item_amount'/><br/>
# _' e( u+ G7 P. j4 K# [) r; A<lable>Item Upgrade Amount</lable><br/>
0 P5 D; G+ m+ S' |4 Y. g<input type='text' name='item_upgrade'/><br/>9 {1 y2 Y" y% m* k
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)1 d4 @9 l3 }& [/ R5 s* A
( E5 ~- v2 M; E
</lable><br/>
% u. a. {( w, e6 Q<input type='text' name='item_element'/><br/>
2 W3 |: R% r" S, N2 N<lable>Element Upgrade Amount</lable><br/>
) x4 R; k. g$ W<input type='text' name='element_upgrade'/><br/>
# Z% R  j/ n: @2 w<lable>Pierced Amount</lable><br/>
% Q* P" y$ {8 [' x<input type='text' name='item_pierce'/><br/>8 H: ]* h. U6 {2 X# U# z
<input type='submit'/>
# ?4 r8 T- S/ o/ @: k</form>";
: j; f+ |9 v. i  x}
' Q% Y8 s$ ?$ [7 _# Z" Q% ?/ m. X8 h! \5 L: |; ?9 v2 F; p& h8 W7 l
function PostListener (){
2 n2 x3 M  h$ n( W* M//Add more post variables if needed and add them to initform() function aswell
2 l9 N9 a2 R6 I8 _! J( j# B: r+ U9 z" ]1 t) N/ k) B
################################
& h/ m) x3 |5 d# ]##### Connection and Post ######
2 v( G1 o; C; [! T################################
( c- w3 A6 @+ p( F$name = @$_POST['char'];
+ `, w( a. X( A2 i! }, v: n$ItemName = @$_POST['item_name'];
! i7 ^) P4 C: Z1 H& o5 d/ T$ItemAmount = @$_POST['item_amount'];
5 U2 {: Q6 @- T$ItemId = @$_POST['item_id'];
8 y4 f" ]0 V$ V" {" `9 F$ItemUpgrade = @$_POST['item_upgrade'];9 E5 @- c( X  v& g# i  G1 z0 B0 ~
$ItemElement = @$_POST['item_element'];
3 K0 A7 d- ]$ H1 g$ElementUpgrade = @$_POST['element_upgrade'];
1 ]0 }  Q7 U) b$ o$ItemPierce = @$_POST['item_pierce'];1 A  p1 R3 j% G8 \1 K
################################
; ^# Q2 j" r$ E0 R; G' w2 \0 @
# B7 {! \! p8 K% ]3 o//Check both variables for empty value
- j1 I" d3 l3 H3 B% L  d
; k$ u2 [% W' X+ }& I8 @8 g: |/ eif (!empty($_POST['char'])){
' H0 o5 e: Y5 X' I9 F$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where 0 {5 A5 L0 v; ?6 x- e

" l( L4 f" D2 B' p) V' t; n7 U, }( jm_szName = '{$name}'");( A, H1 K: a8 j
while ($row = mssql_fetch_object($find)){6 {+ }. [: ^9 A
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";: m! _* z* A( _7 }
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
% ~! a4 L7 R2 ~: \, Z3 g7 K4 W6 P/ X3 G* V1 [: \- [( g0 F
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], ) Z& S% g* |# W9 \( w) w' I

4 r) j: F: K- e( X[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', ) ^6 _4 k' U- D* K! w! L6 \3 O
# K* u/ A$ h" x& }4 Q
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', & I9 h; h& ^4 e2 T: F# I- L

! K# ?; P6 c2 e6 r; @" V0 m'{$ElementUpgrade}', '{$ItemPierce}');");
8 {( R6 l2 P, a% W  R$ G}: m* Q- f: n3 e6 R( h( G
( o2 a" v# ~: \  C7 s' _
}
' k7 s9 J1 {  d- c, x) D, g) O6 d8 S  Q  W" K5 d
}
- s# L& t% p0 n* ~3 d; K! m7 p  E- g" u' _# E
$InitForm = InitForm();9 `6 q4 ]2 A4 a9 m% @" g2 p
$Listener = PostListener();' H# p  Z2 D+ @/ N3 n
( Y$ j0 X/ X% C. p0 F
?>
; m" F$ ^# a6 u8 i& S. Z& m
" D) J' S8 L5 L! Y. ]* ?7 h! U" Z7 t) ]/ h( G: b& Z+ P$ e

  ^. f) h; Z5 F! `
* H( V! G8 j) i- H3 Y- O
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-16 19:01 , Processed in 0.059624 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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