飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php4 f) \" _! L# {" y5 K! i( u5 \! w! `( b/ E
function Connect () {3 _; R6 J$ I, M2 O
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB # ~8 ?/ q3 f' `, i+ A( ]

* u9 k9 G8 C$ ], }Failed.');
  i8 X* h/ j; `0 F0 y}
& v& d4 d9 S! S8 P  U9 F9 JConnect();: J. N% A: s9 O& S
$ }/ u: q- L8 J5 [7 A
function InitForm(){0 T2 ?$ s9 h1 a7 ?" L
//layout for the form  g* t: a/ r( i: ?& Y/ ^" q* t3 Y, z
echo "<strong>Send Items.</strong>
: r( x8 r0 s$ ^' G<form name='select' method='post'>2 J4 G5 j# X$ }, e. o
<lable>Character Name</lable><br/>
, n3 `0 s- _+ a3 b4 \<input type='text' name='char'/><br/>* ?1 V& T4 l/ {. B4 ?$ A
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
% U. r' @3 F4 }- t/ o<input type='text' name='item_name'/><br/>' Z( h% n) _2 }5 U4 J1 x
<lable>Item Amount</lable><br/>* ?* v6 J2 ]# T! M5 J
<input type='text' name='item_amount'/><br/>
8 |; F# K# Z' Y. ^  f<lable>Item Upgrade Amount</lable><br/>
3 \; U8 d) T" r<input type='text' name='item_upgrade'/><br/>
/ ~7 \7 l4 W7 \4 z" B" k* Y<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
' H/ S% C6 u, d8 _. L; O  |7 C8 ^1 E: T. ]8 j5 c5 F, F* ^6 Y
</lable><br/>+ a( @" H9 |/ T1 @/ ?0 ^+ C! O
<input type='text' name='item_element'/><br/>
6 x% k% v; h) n$ [  ?<lable>Element Upgrade Amount</lable><br/># O/ `5 x9 B7 N& s3 _: _( m
<input type='text' name='element_upgrade'/><br/>
5 ^  g& I# r' F- f" N<lable>Pierced Amount</lable><br/>2 J2 R7 F1 m6 p2 Y5 L
<input type='text' name='item_pierce'/><br/>4 `) `0 z4 a. L5 ^, o# J3 K3 P4 I6 V
<input type='submit'/>
5 x) g' d4 J+ R$ E</form>";
2 K2 J4 O) V2 c  j}
- S. X* z3 A- b2 J+ ^4 s4 G/ _% C' J+ B/ M/ n& y* r
function PostListener (){9 p" t8 |; l0 f
//Add more post variables if needed and add them to initform() function aswell9 c4 D+ Q' c8 k( H; _3 t2 N0 d' X

: x. K* [* z4 D/ a2 `3 z" t################################8 Z6 D& q1 F4 N+ F
##### Connection and Post ######
# B9 P1 n  P/ g; O- _7 H. v+ s0 E( C1 Z9 s################################( W5 {  ^0 e8 ]! Q3 K6 A
$name = @$_POST['char'];
3 R6 U1 p8 Z9 q, c+ M$ItemName = @$_POST['item_name'];
# Q$ j( i2 B( z0 ]( ~/ ?+ J4 n$ItemAmount = @$_POST['item_amount'];
9 K# p  k% C8 [: k$ E" x, {$ItemId = @$_POST['item_id'];/ B4 p4 P/ Y8 c0 K8 h+ b
$ItemUpgrade = @$_POST['item_upgrade'];  a9 P4 k7 K2 d+ n
$ItemElement = @$_POST['item_element'];
3 A4 m3 z9 b: d9 c) J$ R$ElementUpgrade = @$_POST['element_upgrade'];
' D7 h% g; m, i) S8 X$ItemPierce = @$_POST['item_pierce'];1 m! A6 H5 M: O! x% m) k
################################
. M. m6 P. P+ p) a* k
' U. W: h' D+ g9 X//Check both variables for empty value& ^& v& d+ p8 c1 t3 W' G. c3 T

9 z! J/ Z) F# s0 C! e  r  k. M/ {+ r2 vif (!empty($_POST['char'])){
+ d7 n0 ]7 |9 N* L8 Z$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where 7 ?, V5 M9 J" p$ @1 z0 w; z1 z& o

3 T. ^# E  M0 xm_szName = '{$name}'");2 ~: }, G- I! w" Y3 v" ^3 x) q
while ($row = mssql_fetch_object($find)){
  g7 }7 Y1 X; F8 pecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
8 R4 u# G" b1 s2 ~+ p5 i- Z$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
4 x9 ^. A* X( M  t# U' T/ E" d3 j! D7 J. D
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
5 X* c7 `3 {* u' d
* i( Z0 z; h( x& Y* [' j6 q[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
) W- L4 @' N5 U/ |) A
% O2 `# D  i. j0 c0 g3 N9 LN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
* Z8 C- h3 Y0 _' X- c3 o. W. n; }
'{$ElementUpgrade}', '{$ItemPierce}');");
2 Q- c% Y, G3 D6 J1 Q}. q* H0 G; E2 w
+ o$ J5 c- N( S* h0 q* G
}
" J8 G# ?4 g0 o3 H. s  z
' g' U3 \' q/ \* ]0 v% K}
; a& |- U# R8 S! }2 |2 N1 P1 P4 n2 F2 j) w0 x/ X
$InitForm = InitForm();
0 Y' \+ ~/ u  S$Listener = PostListener();
, Y6 D; H+ _: N+ i6 R: y8 @0 c! b" E9 v% L2 \
?>
' e* h, ^8 A9 c) B* m/ V
# [6 J, v3 }+ e% ~& y' q% v' A* J5 l8 l! G3 q

. i7 z- T7 z1 P6 O7 @( a! j- K
3 F9 R2 u( m5 l6 |+ l2 X; L
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-12 00:10 , Processed in 0.105140 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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