飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php. v; n* @- ~9 B! b0 \* K7 @9 [
function Connect () {) a4 h% S$ G6 G9 R
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
9 t* @% A2 z- ~7 F
; U" E, A9 T/ G) p* qFailed.');6 i$ {4 o  B! k; g: s3 e
}& m# n. T+ O) N2 L: s, K+ C
Connect();  y9 A  O5 m9 H  J% F
) \3 [$ V- A8 V7 `) w
function InitForm(){
6 P0 \  r3 g* l# `+ i, Z# ?//layout for the form9 i$ @- q# |5 ^4 i" X/ m/ e
echo "<strong>Send Items.</strong>
/ X$ B& M# p! v% H% Q<form name='select' method='post'>' `" K; t; B' C) F6 a, `
<lable>Character Name</lable><br/>: B/ [* i! \4 ]% h6 c  }
<input type='text' name='char'/><br/>/ g8 z8 y- s. s$ V- f7 h
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>3 ]3 u, D% s0 l% X9 F5 `3 b) P
<input type='text' name='item_name'/><br/># M( h9 J6 u  o: Z! h. E
<lable>Item Amount</lable><br/>7 V6 N8 q, N/ s1 m/ `
<input type='text' name='item_amount'/><br/>
/ O  O2 M$ O7 ]$ G8 a, o: m0 M<lable>Item Upgrade Amount</lable><br/>+ K# _) R) O1 \6 p8 |# a
<input type='text' name='item_upgrade'/><br/>
  u' z) j; ]" D3 j( z  q: k  s' d<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)9 H: F+ T: G" e2 Y
3 O0 x5 n/ X/ |6 l9 k. E$ g4 r* p
</lable><br/>
) H3 J6 P9 F& [7 G$ @5 J, [$ Y5 r<input type='text' name='item_element'/><br/>
; G' T$ n, [* \% V7 g% Q9 T; Q<lable>Element Upgrade Amount</lable><br/>6 s0 q9 @) R, o* h( D! z+ X: p
<input type='text' name='element_upgrade'/><br/>
: t, x& y: ^8 j7 F/ E" f) g<lable>Pierced Amount</lable><br/>$ z5 t7 Q$ M  w7 ~
<input type='text' name='item_pierce'/><br/>
. g8 o- b$ H6 w9 e) @7 a: e2 G* C6 X% b<input type='submit'/>
" @7 U  t) p% q3 Q0 A* ~! W/ M- v$ g</form>";# n! Z5 U) W8 ^+ o+ ?" `% U
}
8 E7 n1 f7 z% d" e" g% O1 Z8 P& [
) F0 _! ~! ~, A: \! {* wfunction PostListener (){
! T3 c7 L0 Z1 k$ Y0 K# Y//Add more post variables if needed and add them to initform() function aswell" ~$ ?  h4 h+ C; v" `2 B0 Y
$ l# a& J# d: i8 s$ ?) |
################################8 @& @9 e4 i  Q$ O) |
##### Connection and Post ######
, E) n' Z. i- a2 k) s) W( a6 p################################
- U9 I# `! R8 M2 _: \# M$name = @$_POST['char'];- ^: I, i" C6 L4 @! G3 s/ \
$ItemName = @$_POST['item_name'];# X/ j  [7 a! A" [  S' j; L; ^
$ItemAmount = @$_POST['item_amount'];/ v9 N) a$ L' t* m
$ItemId = @$_POST['item_id'];
! J. R7 v3 \, j/ g$ItemUpgrade = @$_POST['item_upgrade'];; l6 o. S; G2 @
$ItemElement = @$_POST['item_element'];
9 d2 V2 v# ]% R3 C$ElementUpgrade = @$_POST['element_upgrade'];# x' i' Q" J1 r$ w
$ItemPierce = @$_POST['item_pierce'];
& j: _7 E0 w: [4 O' N& _8 f################################
5 ]" U2 A2 l$ e# C4 p% K9 U
" [+ g' Y) f# ]$ a, z. n//Check both variables for empty value
7 o% Q/ I8 F1 h4 D" r, [( e: k. O& z: c, U. M! b, @
if (!empty($_POST['char'])){
( F6 E* Q( d4 z8 j* t6 p$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
7 k7 w6 g5 w- c' I7 w# F2 h; V: x' W0 c8 E
m_szName = '{$name}'");
4 W  _5 y4 T% F+ E5 p# B+ swhile ($row = mssql_fetch_object($find)){- K  F& c  u9 x9 j+ j
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";  z1 I) a6 C- C4 i0 @, ~  D0 k
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 5 i9 X" I; F/ p) y0 W3 ^  A
7 @. m7 E0 Y' S4 I! p
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 8 g" M* S+ u  i( t" ~
/ w' d2 X; H0 n
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', ' K. Y' l4 ?& Y

6 W; ]2 }$ j0 m4 A. d5 WN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', 7 ?' z- u, x4 i) I

3 \6 ~3 ?* o* A'{$ElementUpgrade}', '{$ItemPierce}');");3 |. l% ?1 o" W* f
}
7 Z0 n1 }* a6 ]0 i* ^
* H- k6 C4 f2 ^# d}
, S8 z- y# Y; U' O
( t0 |' ^( T$ u* K( c}* ]' ], ?  \1 q

* X& F- L& i  c" Y' @9 R- h3 r$InitForm = InitForm();4 e# F( |7 E- y. X
$Listener = PostListener();
2 f+ {( y9 R4 Q6 x; l' N: [' a9 W7 t* ]' U! S  p+ J) U7 Q
?>
" k/ d) H+ z2 K1 ~4 E: M+ j6 t- }' m+ i

5 W$ f. M, G: E7 E6 W/ X8 o) t* a( @; ^- H
% w$ m1 K5 x9 s$ A' S: z5 `0 b
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-13 21:12 , Processed in 0.057978 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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