飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php5 i2 }+ |! F* w% r
function Connect () {6 D, e! b, c! q2 p- K( e, _
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
! `' _  r+ d9 M8 k; Q6 p( J' Y
% f% m- ]6 E! t! Z' [+ v+ |Failed.');. f' L$ f0 W& H) I
}
+ W4 i5 y) g! \- K  _7 MConnect();
  ]1 D% n2 x- N" l9 J: b/ F3 \* R" B5 d; x9 E0 K- U+ Y' N
function InitForm(){3 g. W: i$ x( a" h9 N$ l
//layout for the form
" T* w6 ]  D5 c8 ^7 C3 [+ Q: w1 gecho "<strong>Send Items.</strong>
9 j- l# q, I' |3 p3 y0 [5 i<form name='select' method='post'>" F( E* {  e8 O; F+ }& T0 W, z9 N
<lable>Character Name</lable><br/>& U- {/ M3 l% p
<input type='text' name='char'/><br/>* F9 M4 v* _" n5 O2 [! Z
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
% G  N+ O. B% y# `" F9 n<input type='text' name='item_name'/><br/>
# N; K/ B% {- T7 b" w<lable>Item Amount</lable><br/>
* E: ?, o0 ]& n3 }! ^: o, K<input type='text' name='item_amount'/><br/>- U. M+ A/ |" L: g( C9 z+ Q) U" O- i
<lable>Item Upgrade Amount</lable><br/>
# Z; }( ~' P) E1 S4 u: W& I<input type='text' name='item_upgrade'/><br/>8 Q( T" G0 r! z5 C: K6 @3 h
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
! e9 w1 z# A; H# n& `$ {* \3 X5 k8 I, E( g- X% m
</lable><br/>: Q' O$ A0 W5 U0 T
<input type='text' name='item_element'/><br/>
  L2 `; N+ Y: d; ^" M4 Q<lable>Element Upgrade Amount</lable><br/>, P0 M8 T' e6 q
<input type='text' name='element_upgrade'/><br/>
' Y& f2 Q% ~7 b) G7 s<lable>Pierced Amount</lable><br/>- M$ S5 {: ^1 D, `
<input type='text' name='item_pierce'/><br/>1 }7 |: m' C" M7 W0 j" O( C+ ]
<input type='submit'/>7 r% D" k6 g# E( S  U' \: h
</form>";
1 n5 O3 C1 I- v2 ]; Z9 `}
. T4 R6 \0 T2 O) D! r, w& D
& F& L  ~4 J1 R+ q+ m$ }5 Hfunction PostListener (){
, B# [! V# z' H) E5 [//Add more post variables if needed and add them to initform() function aswell
% y- k( N5 w  G( x1 g, o, l& d. w1 _" D9 H0 v
################################
3 }* J6 @* G( z  \0 ?+ [##### Connection and Post ######
" Y% X! j2 _8 D3 S" r, l( N################################. T2 O4 A4 t- T
$name = @$_POST['char'];/ M3 p$ |$ ~2 c
$ItemName = @$_POST['item_name'];9 x1 r/ G! A0 M  G4 }
$ItemAmount = @$_POST['item_amount'];
- ]( F( Q) E/ B( X, B$ItemId = @$_POST['item_id'];
3 c6 z2 a" B+ }5 Z* \( X0 F; S$ItemUpgrade = @$_POST['item_upgrade'];
8 `" y# V5 \9 O) R0 D% V6 E$ItemElement = @$_POST['item_element'];
5 e5 C4 I  A7 a6 c4 m. u/ I# i5 w, L$ElementUpgrade = @$_POST['element_upgrade'];
7 S; `- @: s' t' H$ItemPierce = @$_POST['item_pierce'];0 m  f' Q% Q) J: ^
################################" D8 Y" Z$ @& x# ^; c  j3 _2 e

1 U3 c, l7 A9 I) D# x5 @; }//Check both variables for empty value: f  Y* |3 y: ]6 M
# d' m# S# T7 W) ?8 `% t1 @' H
if (!empty($_POST['char'])){+ }( M' J* \' o- a% G1 w) J
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where $ k$ T% e+ i! Q
. p" \$ n# `0 U) O, q2 I# E& w0 v
m_szName = '{$name}'");8 g0 l% j. H0 }* f, @& \; a+ P" w
while ($row = mssql_fetch_object($find)){
- U9 R) p" s4 Z- G+ _% s7 eecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
( Z7 V. |* D5 z; q/ K0 N$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], ( B, T; I$ [* l, `- w& J3 ^

( `: z# Y  X0 c2 y; W" d% O[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], - x4 E3 I; j- k7 k, E4 |2 Y6 H

. D5 V/ s- {8 ~0 i" @$ |[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 7 Y4 R4 ]9 A. ?3 U

0 O& G9 p7 l9 I# V8 PN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
7 K/ L% }, l( w0 m& O9 _
* A0 k1 j- W3 b& z$ i. E'{$ElementUpgrade}', '{$ItemPierce}');");% x2 [9 T) @% ?) C: ]3 M1 y7 u, y
}& S* h# i% M# Z0 U' x

& S0 V$ u1 U' `/ t2 P, H# p}: z/ i) c% O! n9 D- Q/ K1 k6 C
  k+ \4 h! Z- _8 S* [! o0 P4 E3 y! C
}$ v; l- }8 U: C) l! E5 A: J

0 Q; V. D; N& U) U& m$InitForm = InitForm();
( e" R6 l6 N$ Z* o2 e2 E+ t/ N$Listener = PostListener();
) W, h8 j, J; W9 f' R  ?. K5 I1 d+ {
- n- Y6 [/ O% A+ N& @9 N?>; ^6 `/ Q, [6 C: E

8 Q: L5 a+ |7 @; Z  O2 |: T0 _8 G$ f; d6 U0 |" w
3 `; {* l, o5 l; O$ V" F. T
( W  h7 ^# F4 g- y6 c
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-2 22:33 , Processed in 0.058699 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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