飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php8 E6 ]- Z5 |# p3 h% W0 Y  B, I
function Connect () {, p' \' |  l8 |: s4 s# T
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
" b. O& `- R- s4 [; n, M; d" @2 X
- G3 `, D( g2 E4 KFailed.');
# x( {5 X* G" g: _+ C( a}
5 U3 x& h5 @2 M' v; i" ?6 D# D5 qConnect();0 M4 V6 L" T) ~) M

5 ?8 T5 J4 w4 k) Z/ m, Rfunction InitForm(){
& s: [# A5 G2 q9 l+ B//layout for the form: s* J, v: }: V3 O, ?- d% c7 y
echo "<strong>Send Items.</strong>
8 j2 L) M" }5 D; {2 U0 F' d<form name='select' method='post'>
+ L5 V9 s3 [  H0 h5 u) }9 p<lable>Character Name</lable><br/>  q- m" t) l( I- Y- ]
<input type='text' name='char'/><br/>
- h. T; \6 R+ l$ _, y: u<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>% T8 r5 q- c5 y7 D6 s1 ?3 g
<input type='text' name='item_name'/><br/>
& Q; a4 A- |, \: Q! L8 b" B# \3 S: {7 S<lable>Item Amount</lable><br/>
% p9 p# S2 t" C+ m6 a<input type='text' name='item_amount'/><br/>
: A6 Q9 _: t8 U, y  I, ?<lable>Item Upgrade Amount</lable><br/>
) I! M+ G* g( R0 N<input type='text' name='item_upgrade'/><br/>5 c/ M1 ?+ F9 E
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
  H2 Z& H  b2 o7 G8 O0 N3 j/ {0 D# S, E, L  |
</lable><br/>
1 L; Z$ s& |/ W* w2 M; F6 p<input type='text' name='item_element'/><br/>
3 i9 Y# r3 X5 N) l0 l0 o. q<lable>Element Upgrade Amount</lable><br/>
9 T2 z8 {! ^. \; J$ D<input type='text' name='element_upgrade'/><br/>: R. `" y+ ~6 A
<lable>Pierced Amount</lable><br/>5 T7 r% |( R& J1 d8 P
<input type='text' name='item_pierce'/><br/>+ p) y' ^- [3 f$ l5 i
<input type='submit'/>1 J& K4 \: u8 B" [0 I
</form>";2 D) b9 I- s/ J% D- l7 E  m2 [
}
3 H+ @1 [( c* \* e, q' `# z+ Z1 D: x. J/ {( S
function PostListener (){
( C& q. {9 _! x" c5 D//Add more post variables if needed and add them to initform() function aswell
9 w4 u# j& b5 Z. P: y% M! }3 U- y. j
################################+ t; A/ f. H( v7 E& Z1 Y
##### Connection and Post ######
8 E+ N' h  ?' m+ y9 v2 N################################- [/ _7 G9 W. L4 E* O7 j
$name = @$_POST['char'];2 R& s* f8 K3 w5 [# Y9 y) V1 V
$ItemName = @$_POST['item_name'];8 G9 r; B  p1 l
$ItemAmount = @$_POST['item_amount'];  m- n( W$ ~" d7 V9 O) g# \! I2 p
$ItemId = @$_POST['item_id'];4 v: [% _+ h, D5 X" ^( h7 N
$ItemUpgrade = @$_POST['item_upgrade'];* T+ z3 z! H5 X( p2 T1 ]+ G8 L* z$ p( J
$ItemElement = @$_POST['item_element'];
+ Z1 [& X/ y- b. u0 i9 Y+ a6 s$ElementUpgrade = @$_POST['element_upgrade'];
* g- W5 V: X; _7 K! F; A& N, h$ItemPierce = @$_POST['item_pierce'];5 Y/ A* O3 j4 ^' n: b# K
################################
! q2 L+ e/ m; u$ f; e2 J6 Q: D1 J4 ?: U' S) e
//Check both variables for empty value
  y, Y( @4 J7 q, ]
% J; a( q4 J5 ]- Uif (!empty($_POST['char'])){
4 V" w% J8 q: D5 S8 |$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
6 \4 t, b. g- a6 ^# @3 G
1 _4 w" B( H5 P6 m8 V8 ~7 Fm_szName = '{$name}'");
: _# u: t0 d( awhile ($row = mssql_fetch_object($find)){
2 h" d3 e4 F( z- m- s. \% l1 _9 g! Aecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
2 J& ~/ P' o7 k, g8 S, @! V$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 3 A7 \9 b, i' l. b( p
, N; F* q0 v2 Y" j: _  T1 U" z8 f3 p
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], ; `4 w. ]8 Q* O1 G) T9 J" G

& ?. q5 b+ A  a2 n/ g! U[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
; P9 u/ V, b; M) O) T
. i$ \3 K7 f8 b* i0 w4 c, k  v; eN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
& C/ `: E/ q& X8 ~  o5 H+ t& l
'{$ElementUpgrade}', '{$ItemPierce}');");
+ N2 q: `# d* ?5 L- p/ d}. F8 s+ i, e6 g9 H" m* p5 h5 y  C2 U. |
5 K! A& u2 z4 c% u
}+ [# R# [* F# I1 r: e

7 u/ w0 c5 Z  Z" n2 v}
) |& `6 x; o% D% A! G) f1 y9 t( }, M5 i+ u, X
$InitForm = InitForm();
! {1 K+ G* k( F5 M* P$Listener = PostListener();/ j# {6 m! @& n4 u6 i7 z

& q6 u& I# a5 \( I8 h1 S, w$ }?>
1 f- x% A9 g9 Z! a. Y  A3 Z: Z1 R  R7 F  q. _

7 E8 n1 v  B3 G' X
4 Q; k$ i, u$ @9 a" m+ |, d3 e  |: R  G; _- U7 ?
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-14 17:44 , Processed in 0.060555 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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