飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1092

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1092
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php) e- S8 Q* ]$ \$ n" V
function Connect () {
6 |' A+ y  }) f) g9 _6 [5 Wmssql_connect('Server','UserName','Password') or die('Error: Connection to DB
' \7 I& P# d6 f: I7 f$ w; C" X' w5 P6 k8 N
Failed.');- ~, Z. d+ k/ d) S; w. b3 A$ U8 x4 L
}3 q8 N# P+ ?6 ]4 v, Y
Connect();  x: N1 {* P4 X' d

; o; k5 B9 n! k# r0 P* R2 \4 \function InitForm(){! F( k. @$ P  {! d
//layout for the form
* d, P2 l8 ~4 Iecho "<strong>Send Items.</strong>
+ ?$ M! |* P- R2 U. B<form name='select' method='post'>  s; H! Z; n0 p4 Z5 Z1 n/ j
<lable>Character Name</lable><br/>: w/ r, @& C$ j
<input type='text' name='char'/><br/>7 U$ `- x+ @" y* B! z
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
$ D2 F" t$ A0 r$ D7 m! n/ m& m<input type='text' name='item_name'/><br/>
$ F# Y, P% S: U$ k<lable>Item Amount</lable><br/>
; t/ M7 b9 u+ v  L) m<input type='text' name='item_amount'/><br/>3 ]$ s3 x, r- F6 W# j+ i
<lable>Item Upgrade Amount</lable><br/>5 Z- s: |( h$ [& E+ {7 Z! @0 `
<input type='text' name='item_upgrade'/><br/>, d* e- n  d" ^  q
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)9 ?  b' i5 i  |' R4 f. c
8 L. m" _$ O. h' `0 ~* |
</lable><br/>
  i, p7 p/ A2 s& P6 K) z- g1 F<input type='text' name='item_element'/><br/>
% U, n. [0 K4 U, F<lable>Element Upgrade Amount</lable><br/>
6 `; R# c+ d5 Z% O<input type='text' name='element_upgrade'/><br/>
) C7 F* s4 K4 n; ~<lable>Pierced Amount</lable><br/>- V: u4 d4 Y  L9 A! [! j
<input type='text' name='item_pierce'/><br/>
! A: b' z$ V# E' d: g7 F4 H* i<input type='submit'/>
+ J* r( O- g6 D' H! _# M  _( Y</form>";8 J: n, v2 X; r/ l2 x9 e, g
}3 b. i$ `1 D8 a/ Q! b# K
0 ]' j* Z0 {9 E( e1 M
function PostListener (){
, P) c" z# ~& P+ A//Add more post variables if needed and add them to initform() function aswell' `, _' T7 B" y# X2 P! c& ], `
, S7 S. f! E4 D; d7 {9 C
################################
& K) P1 W: R2 E$ I1 A##### Connection and Post ######2 k9 M; s7 L9 F2 d4 b, d! C0 A
################################8 @( @* T; v0 f2 i0 L
$name = @$_POST['char'];
( c; I. F, W4 e" v! Y- \1 X$ItemName = @$_POST['item_name'];. {* I7 q4 r  q- A, y8 J
$ItemAmount = @$_POST['item_amount'];+ f, I1 k( A: n6 j$ G) w1 K
$ItemId = @$_POST['item_id'];
. d! D5 n! g* ~; F3 e$ItemUpgrade = @$_POST['item_upgrade'];% J# A6 Y9 B0 F
$ItemElement = @$_POST['item_element'];
# `/ ?$ L  @/ O8 x0 Z+ f1 l$ElementUpgrade = @$_POST['element_upgrade'];& @+ R; ]1 X6 g* i+ ^, K
$ItemPierce = @$_POST['item_pierce'];9 z& K# \/ M/ y: ~3 p
################################
4 ]. L, t% s; A; r! Z  s; Q0 c6 O( g) g$ [
//Check both variables for empty value" p; V1 Z. J+ v9 I; Y* f
4 ~: t( D$ A! X! D4 n
if (!empty($_POST['char'])){! |. p- a; C5 }' ?' A: j
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
0 R  X5 r$ _- X. P* H4 q! ~$ C5 C2 G* ]# B* B0 `8 q  j4 A, \
m_szName = '{$name}'");
( h, @% L( s) i7 g# rwhile ($row = mssql_fetch_object($find)){
- B: D1 J& K; vecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";3 d8 h4 b! G% J  w
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
$ A0 T* H( M$ y# O
+ u! u2 e* q/ m' F& W3 e# J* e! U[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
0 [, \  t2 P" x: m4 _) ?( Q4 y9 p( p* l
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 9 h7 f6 p- [/ D" }8 g
/ P: I3 W6 h- k1 S0 R
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
: c! {2 |: w0 d! m, K- i6 c
% L' d( q3 [6 t4 p5 L: S'{$ElementUpgrade}', '{$ItemPierce}');");) G, U+ i! D& ~' `% b4 [
}
! O2 U! b7 i; q& i
0 \0 A) f! m2 _6 \}
1 d2 E* b" S5 [5 W- z8 Z( k0 B
7 U. P* K$ o4 H9 s2 U- Q}' w) n, c) K- @6 v" s) o

: U# a; e9 i$ \, _0 N0 E$InitForm = InitForm();
1 C3 k! Q8 R5 N5 C; u& @: D& \7 ?2 S$Listener = PostListener();' L" k2 r6 y, T, |
0 P: Q0 l( Q# K* M2 J
?>
& ~; S; [! @) Q- O$ o! H
8 ^; Q( t* R- p9 c; ]- X$ x3 a8 Y: ~) O

/ f: @" T5 M/ q- e2 w* W% v* r! y+ e( q
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-30 00:40 , Processed in 0.071219 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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