飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php6 l5 |0 r9 J* t- b9 A2 b8 n
function Connect () {
" [* `6 o, Z( l1 Vmssql_connect('Server','UserName','Password') or die('Error: Connection to DB
$ ^/ W! h$ o1 R: F
* R# z3 K  \6 _6 }$ eFailed.');
, Q' n* `7 R+ [6 E& t}' m( `+ }' {! D! I9 I
Connect();
3 J$ l( i9 ?4 O7 S' v: H/ ?( e3 `
function InitForm(){* k5 a+ \  g: ]2 W. L
//layout for the form# w8 U! H) V% a. X
echo "<strong>Send Items.</strong>4 f5 \% e# Y' h( J" T
<form name='select' method='post'>' J+ m5 W2 E' s  a1 r9 c
<lable>Character Name</lable><br/>
$ `: [, W7 t) l' ~<input type='text' name='char'/><br/>+ v! [# |- S4 B. n( O
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>5 \) |' ^2 ^2 X% i
<input type='text' name='item_name'/><br/>- ]3 T) K5 [, Q% N1 Y/ o# X
<lable>Item Amount</lable><br/>
& S. G  d; Z% H: z<input type='text' name='item_amount'/><br/>; U: f' U/ @- R, K
<lable>Item Upgrade Amount</lable><br/>6 D) a& N% K; j  z8 ^: l9 b& m8 |
<input type='text' name='item_upgrade'/><br/>
* i) y# i8 n) _( b0 M% r' U<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.). m4 ^5 V: J+ ^& l2 |' M4 ?* p0 p

8 u% M5 D0 o# i$ p' B) r# w4 e</lable><br/>9 Y* G# A3 @* F5 Q1 |" [& A  C0 Q
<input type='text' name='item_element'/><br/># M2 `4 W. x' }  `# I- |$ J
<lable>Element Upgrade Amount</lable><br/>2 u  Q1 Y* D: d4 V- a
<input type='text' name='element_upgrade'/><br/>8 a, P) b2 U" O3 T' l2 @+ H, O
<lable>Pierced Amount</lable><br/>
/ F# t& K6 \% T, n7 ~2 T, `! z1 q<input type='text' name='item_pierce'/><br/>
% A! D1 I% Q' L. t/ J4 P<input type='submit'/>
( U+ h. R3 @. m3 x2 S5 Y2 V3 j0 N</form>";# t! ^$ [' ?' I1 e% p4 w2 {
}
: q" D. \9 E" t6 \: z
: y8 N9 L3 F. ^/ f$ Cfunction PostListener (){
, |7 o, I- `+ C2 s//Add more post variables if needed and add them to initform() function aswell1 D7 x5 b9 ]( O7 N+ X* ~5 F) W( r

/ }! d% u8 L& l( E+ p################################) ]3 y- e& |, w2 H; F/ ~2 j
##### Connection and Post ######% Q5 z9 [  \6 }. P
################################
9 N5 p* b; ]+ x- O  P7 p$name = @$_POST['char'];  u& N! x" |9 V3 j
$ItemName = @$_POST['item_name'];
1 O7 Y3 S# @: q9 X; V+ B( n1 E$ItemAmount = @$_POST['item_amount'];" |; m2 S2 X% N( @" N
$ItemId = @$_POST['item_id'];1 K$ J8 ^( D' x* b! |% i8 u
$ItemUpgrade = @$_POST['item_upgrade'];
, C, L1 K' a. M8 E, S$ItemElement = @$_POST['item_element'];7 z) n4 k  Z* h; ^& A6 S
$ElementUpgrade = @$_POST['element_upgrade'];
' w! ~1 T( N, B8 O7 j% A2 @3 j$ItemPierce = @$_POST['item_pierce'];
5 T1 s( z. N/ L  T3 z! a################################) ?: v# B- P" V. n! T9 Z9 y) Y

5 c; l4 t# \5 g& u; W//Check both variables for empty value* W- v8 P5 V: f; F0 H, d5 q
+ e( J. q# }/ n$ R  _4 ]- o
if (!empty($_POST['char'])){
/ |0 ?0 P# `' c5 z0 A$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where 4 Y  S4 J# e6 X1 q9 g

2 C7 }2 m' W. z6 ~m_szName = '{$name}'");- g' @& }' l0 L
while ($row = mssql_fetch_object($find)){
" D6 B8 S9 [8 vecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
' B+ W+ i8 g) O4 x# u: m8 c2 _+ S$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
0 x& \2 p# \! s. i! B& S) ]+ h
2 s4 j9 C/ @: m; F+ n! x[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
* y0 {0 [7 b" R. k5 s) A, l. j
: G' D6 J8 S9 G4 K( N# Q[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 7 [( x+ {8 A/ ]& a' R, J, g+ O

6 R, O4 m# [) E( i  ]4 ON'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', . M4 l0 a  L2 m8 R3 M

( J- P( d8 d* n4 K0 D'{$ElementUpgrade}', '{$ItemPierce}');");, @1 W, @0 I' S; c0 K& ~
}
. {$ p% ^) {$ z: q% ]- `0 y: q! o* K- w" V% o% [: z
}
  i0 g# ~  H4 ^6 e5 y4 B1 R6 G9 y) R9 [
}
# u6 o2 d9 w& P: n- H$ Y+ B
6 ~1 M3 R9 [! [* `/ S5 \' |2 A$InitForm = InitForm();8 R! I7 {) k+ |3 m
$Listener = PostListener();- p( C5 P. s$ V, z7 @, x! f% G

! L- y/ b9 N! X/ g8 P! \?>& w6 Z/ F# S2 m

( N  t2 e5 V* W3 g+ E. j0 o$ S! e$ r. Y  @2 Q( R3 x

( Z& E* r  ~3 ]- X& j6 X
  @7 m. S) d# z4 R- ^- z
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-14 03:52 , Processed in 0.078398 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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