飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php1 f7 @, H* X. r/ z! c; s4 [
function Connect () {+ k* v% J0 a0 b( I) T# Z/ C5 f
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB 5 ~% l/ _$ [9 D2 `; g- z% ~* l
+ d+ X7 d& {$ s- S( ?
Failed.');" z: V: Q3 A! _. j( O2 t; |
}
# w  ], V+ u" t! H4 U: YConnect();
7 {. g8 ^: C- @# b7 w5 v9 o& y$ j7 q4 q  o7 T3 k# u8 q  |+ P
function InitForm(){
: D9 R4 b' ]& g1 H* ^. k//layout for the form
, X6 i7 J% z4 I+ R) Iecho "<strong>Send Items.</strong>
" T, B4 {( t& R! I) o5 h1 b+ o<form name='select' method='post'>
! Z" V/ c" f! Y# X) n2 L& D<lable>Character Name</lable><br/>
" [" Q0 X9 P* s1 K( f<input type='text' name='char'/><br/>
2 U3 X1 X! Z" Y6 |<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>2 ~4 f# k2 M. X7 O
<input type='text' name='item_name'/><br/>4 R+ {2 H& ]% i8 K1 C4 v
<lable>Item Amount</lable><br/>+ ?! [, O: a& I9 j; Q4 u9 t
<input type='text' name='item_amount'/><br/>5 C% t" h& m3 @, @% g
<lable>Item Upgrade Amount</lable><br/>
0 f: J) A* W- h. g" F<input type='text' name='item_upgrade'/><br/>0 x, X: K$ j4 m7 b; m* y
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)9 Q- ?& i8 W3 h. N
7 p3 t( q: t0 m- ^7 v+ _" y6 ^% g
</lable><br/>
! z- O/ I7 [! n! b<input type='text' name='item_element'/><br/>
! g6 Q, k# `% o' m) e7 ~2 F/ C<lable>Element Upgrade Amount</lable><br/>
/ ?' Z* Z5 \2 m# ~6 O' d<input type='text' name='element_upgrade'/><br/>
4 o4 H2 M- c5 O  p4 F<lable>Pierced Amount</lable><br/>" H. K- k! z% |9 f; C: w) D$ I
<input type='text' name='item_pierce'/><br/>8 P- K- i, N: b6 K" Q
<input type='submit'/>+ ~& d* q/ U, y
</form>";
  J3 @9 J4 F2 `4 L}
4 D3 Z5 z% v( r- K' J7 }2 h6 H. {1 h( }! l3 v: g$ u( ~
function PostListener (){  s, D& h9 f; j
//Add more post variables if needed and add them to initform() function aswell
- o0 b$ A9 u+ N/ R) {' A3 t* O2 _) I4 T0 P1 p1 c. q
################################! ~( \8 ^0 ?# A! ]0 f& z
##### Connection and Post ######
/ p2 I2 U9 S* I% U################################9 L7 y* I" F( Y4 `: @1 F( H/ Y
$name = @$_POST['char'];
/ G4 S& u$ ~% J& d2 ?* s$ItemName = @$_POST['item_name'];
1 V; E1 N0 e, u( {! |" Z- M" R$ItemAmount = @$_POST['item_amount'];
' Q: o5 T8 f! K8 }' Q1 z$ItemId = @$_POST['item_id'];( B1 |1 c* d" i0 c
$ItemUpgrade = @$_POST['item_upgrade'];
7 ?/ h/ K/ ^( T$ItemElement = @$_POST['item_element'];
; S$ Z4 M, I! Z/ t# t) Z  o+ v+ V$ElementUpgrade = @$_POST['element_upgrade'];+ f* ^& f- l1 k. C- C2 d
$ItemPierce = @$_POST['item_pierce'];7 r3 J" g# F6 I9 Q
################################3 |( h* N, G& }* F! q: a# f2 p4 O
) E: r* j8 H% h7 l% j8 |
//Check both variables for empty value" e1 ^2 M- D& q8 Q/ m9 S

9 a: S0 M4 P- m: mif (!empty($_POST['char'])){
2 b4 i6 G5 p! u6 [+ x$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where 8 ]9 Q9 _8 L  S4 c# x
, L9 X& Q4 f- Q& K5 ~
m_szName = '{$name}'");
- }: R: U/ s0 U! {$ zwhile ($row = mssql_fetch_object($find)){
# E4 Q6 @/ N& J. q% M" zecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
2 z' C5 }& K# P: Z: H0 v1 W$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 3 ^, B  d: H* c5 V0 M/ n/ P
+ g( @8 r! r* K' e
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
1 x1 ]4 F; _  {; d1 C8 W+ A8 N' z% @- i  v
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', / K0 U$ n: i; n/ s
* k2 C( }* r% E# C% n1 w
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', ; W$ S6 @( c, V6 m4 q
7 X! `( e: }1 C* q
'{$ElementUpgrade}', '{$ItemPierce}');");6 |: Z3 c" W8 M9 f
}
1 ^6 K4 o. ^& V- p7 ^+ }) K
! o9 D: m9 x& r) A8 j5 O& M}
) F' P4 g- ]4 D* D9 _7 `
9 ^8 U' ?  n' n! L9 w" Z/ I$ h}
6 o, |: t3 @  [3 V( _3 V1 W* ^) F3 r
$InitForm = InitForm();
6 }6 P( d6 i8 d$ U& i$Listener = PostListener();9 {3 v2 {4 b6 X2 d# F/ |# t: K7 ]. H& ^
% h% i; l3 O& s
?>1 R9 g* D4 a6 @5 x( e$ u. w

; ]2 j8 o3 ^/ }2 S" ]4 G+ ?* L5 Z! z5 J/ B5 X! H  a6 P
, E1 P, e, M) S6 ?8 @3 \8 W
1 Q, g$ ?& a0 u; Z) A( H. _
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-12 18:51 , Processed in 0.059774 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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