飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
) i- U. J4 J& D- `function Connect () {
/ I+ N* X# {. ^; pmssql_connect('Server','UserName','Password') or die('Error: Connection to DB
1 t1 x% u6 i2 U7 c
6 ]# }5 T1 t% ^3 ~# C" dFailed.');
+ C% ~- o+ y$ R2 O; O" T}: N- ]$ E) s7 b
Connect();
6 z3 s; P5 t+ H7 F; v; m+ ^: Z& n
6 q+ @; ]9 z( d+ {- |5 \function InitForm(){3 U6 f5 A8 F2 T' \1 g5 m
//layout for the form
7 k7 ~" n, M$ recho "<strong>Send Items.</strong>
1 @7 B: W- G4 q3 m" [<form name='select' method='post'>; E; x) p* l+ D1 u
<lable>Character Name</lable><br/>
$ ]9 e: ^: l% r( r  }4 m  w" s<input type='text' name='char'/><br/>
8 f" ^! N) f& E<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/># Z3 Q2 {3 P, I2 i: e
<input type='text' name='item_name'/><br/>
2 {/ l# n- [" O- B: S7 R2 P" g<lable>Item Amount</lable><br/>
* @1 s1 {) I0 t. U/ w9 F- k$ C$ v<input type='text' name='item_amount'/><br/>; z* A% Y' \9 M
<lable>Item Upgrade Amount</lable><br/>
. W. A9 U6 U( U) U! m( |) l. ~6 f: V1 g<input type='text' name='item_upgrade'/><br/>
: }+ L7 i, f* T6 y' {<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
; J6 V& S4 P6 Y! `! l8 @
1 I  H3 e+ c+ v  L9 o. c9 A</lable><br/>
2 a9 o8 j& i# G- T: u  L<input type='text' name='item_element'/><br/>
4 F8 L8 _: q9 @2 _<lable>Element Upgrade Amount</lable><br/>' t1 H8 I! L7 _! _% f( n* f7 ?
<input type='text' name='element_upgrade'/><br/>
; n  `3 x  R0 ~! ], R) w* ?<lable>Pierced Amount</lable><br/>( O0 |5 b! W9 K( O6 I9 _$ _
<input type='text' name='item_pierce'/><br/>& d: w: `1 E0 l0 y* d9 k
<input type='submit'/>; C! l# D3 E+ w% I' N: n$ ^/ p3 L
</form>";
" o1 i( t5 C# @* U+ w}+ n3 t. C; ~, j  W6 }) R

" O5 V- W/ v3 t" b2 Ofunction PostListener (){0 t5 Y6 }7 x- d, n0 J- }! y6 x7 r- a
//Add more post variables if needed and add them to initform() function aswell# q4 v2 E' \6 S; M0 o

* l3 \4 Q. a! N0 f$ t! E################################
# a) u# `! _1 _% [4 ?: t6 T6 D; j##### Connection and Post ######4 r5 c1 }- ]( x- g
################################
$ e2 {( E: j0 h$name = @$_POST['char'];
' y" W7 ?8 M% p) w$ItemName = @$_POST['item_name'];/ }: |/ h- e+ E. a
$ItemAmount = @$_POST['item_amount'];
- z) j5 q2 [+ F; z* d/ `6 P% N$ItemId = @$_POST['item_id'];6 j3 m- z# h( q( x$ Z
$ItemUpgrade = @$_POST['item_upgrade'];
0 D0 Z' m7 c4 ?: w$ItemElement = @$_POST['item_element'];" I, ~, B6 F- C6 K: c0 d6 [
$ElementUpgrade = @$_POST['element_upgrade'];
# w6 G  }; S  U$ W+ [1 o  K5 U7 i$ItemPierce = @$_POST['item_pierce'];5 O) E; o: B" U) D$ k* l  J/ X
################################$ F, O* p  `$ o1 Q% o
6 y0 B4 d$ m. V4 N5 Y
//Check both variables for empty value  j4 i; j% I) @/ b: W7 h$ ^
0 C9 C# D/ E0 M, i, U: u
if (!empty($_POST['char'])){
: Y% X( `# F: O1 X$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where 7 J% i% W8 `0 p9 z
- N6 S# b0 g: }( h5 \% g0 ]+ K: C
m_szName = '{$name}'");$ x' a/ B, i; j6 i: d
while ($row = mssql_fetch_object($find)){
! P' }; t- G# H  Q- Z: |( qecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
/ t) D1 \8 }* T8 f3 x7 ?; i$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
& H8 I# Q3 F) A+ K
* C& q' l! X7 _) V[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], , Y/ |! w/ k: P2 `$ |

" L' L. P# h  i" z0 N& I5 i5 J# z$ v[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
, _0 g' A: H" |1 p( C. N. w/ Z$ Q  {2 D6 W- i
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
, |- ~3 M' j& O: N2 P+ b( m
# H& r0 Q# w" \4 p$ @8 u'{$ElementUpgrade}', '{$ItemPierce}');");, z+ o7 A) d+ M7 l# m7 l5 n
}0 x1 A; v# \1 P" O6 ~
! }4 {4 ?1 S. T! n
}
8 o2 F9 f& c8 d) E
. y5 x) Z# v8 l. Q6 m; ~( p: s% [/ K}
7 f- f* j3 W1 @1 }
+ e  q% g' w0 U5 }$InitForm = InitForm();
* w1 i% P( D5 r' O0 l: s+ y5 z$Listener = PostListener();( y' r: U' R+ V# D* p9 B: n& f
+ U' f- n" A8 u6 I
?>
, D( Y" z. @: g% u% f8 |' N# g
  [) C% C& Q% [" k
9 E. D4 w0 T/ p) o; W6 U3 L
: `3 p, Q. }% ~( Z" R
3 I1 t1 y( w; n4 j$ S. t
回复

使用道具 举报

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

本版积分规则

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

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

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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