飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php, b9 {# }* r3 ^1 G* s! d
function Connect () {! G) E) Z. Q) u( x9 y
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB 8 J8 M' ?% {6 e  q' z

4 Y' `% B% V6 t9 Z, a2 ]1 t8 W- @Failed.');
3 J0 f" u0 ]7 ]3 S- _}
& y8 e+ `+ O% M; h/ `( Z# D0 eConnect();
9 B4 D& N/ E; P- o% N0 y7 j6 b/ g8 {
  ^% C" {& H! T7 \  kfunction InitForm(){
7 A$ c# t. w! Y6 E  J1 Z0 x/ b//layout for the form
6 U% P: q& ?2 w& gecho "<strong>Send Items.</strong>8 B0 B, c1 O, V/ f
<form name='select' method='post'>2 y2 o! K+ _' w$ ?2 e
<lable>Character Name</lable><br/>9 y3 Z4 T5 \9 M1 O( `$ v9 Q; g
<input type='text' name='char'/><br/>: a( Z) y% a+ g7 u
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>; \+ l4 t! n+ T* a' A+ G5 h4 Y
<input type='text' name='item_name'/><br/>7 b+ V7 G" Q' {) W# D
<lable>Item Amount</lable><br/>/ U- S/ `5 @+ O! m0 j
<input type='text' name='item_amount'/><br/>* d. A$ x4 @: ^) p$ l
<lable>Item Upgrade Amount</lable><br/>
: O7 L0 o* |4 w$ `* u<input type='text' name='item_upgrade'/><br/>
0 Q) P1 C" D3 C; l% _* }7 _. {4 r<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
. ^5 @, b$ \0 {0 {2 g8 N& N: |1 B" W0 N
</lable><br/>; {* K0 l# i, {
<input type='text' name='item_element'/><br/>
  X5 O: w) f% J- @" q<lable>Element Upgrade Amount</lable><br/>
/ }) u% ?) v+ `' c  i9 J<input type='text' name='element_upgrade'/><br/>0 h7 m' ^) G2 V
<lable>Pierced Amount</lable><br/>
" u9 F6 C/ n8 R" ]3 i. E<input type='text' name='item_pierce'/><br/># _; K1 V7 d( J) \! b/ K+ n
<input type='submit'/>
  J2 y  v! B/ B1 [</form>";- \4 C! q. \! p9 B
}" q# t1 M5 t; n4 J) E' U

0 q: q' s3 G  e( t' V# R& [function PostListener (){0 N5 l( M; n' H% h" B  V
//Add more post variables if needed and add them to initform() function aswell
/ @2 C) V/ F7 m! g: e8 p0 k2 h* Y3 R6 ^
################################$ P8 w: w' [6 D% j$ ?* _: z: V+ D2 `
##### Connection and Post ######
8 b1 s: F6 ^0 D+ |7 S8 {################################
. ?9 _% J' L- p& U$name = @$_POST['char'];
) R- f+ B. z: p$ItemName = @$_POST['item_name'];& f: ^* Y9 b' I, C; D4 H
$ItemAmount = @$_POST['item_amount'];
. ~; L; Z3 k( A$ItemId = @$_POST['item_id'];* O3 Q, ?7 j  B
$ItemUpgrade = @$_POST['item_upgrade'];% G8 o; i9 J6 ^; P
$ItemElement = @$_POST['item_element'];4 {; i) o& r( q9 ?  h5 u) ]+ x
$ElementUpgrade = @$_POST['element_upgrade'];
; Z9 F! o5 g6 T$ {$ F1 I* t$ItemPierce = @$_POST['item_pierce'];
. \, s) h: y5 g: E, g8 O! H################################
$ n; f( v& M6 A! l8 S9 Q# I6 K1 Z( q
//Check both variables for empty value$ z& _4 m" Q) |- j- C
: F# L7 l% d- X/ j+ s3 X9 P
if (!empty($_POST['char'])){' m) y% D: ]9 r3 Y. O& ?! U( n2 }
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where   w" e8 {$ }6 X
2 l+ [2 y- E% N! r4 a
m_szName = '{$name}'");
5 Y+ I" g" \4 ~! g9 v. J6 awhile ($row = mssql_fetch_object($find)){
# o6 O' v7 o% c% H) g# `% Pecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";, v# J: {: `5 _/ Y. o: h; E1 k
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], / a7 I: \( {; g7 y; \7 [
/ L2 e6 Y( W/ h9 o% [5 u
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
; m7 s; F# j6 G$ F# a6 w5 _0 p4 ~( ?0 ^! y
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', ' E! T; b. i" `0 l+ t

9 b/ h' n+ M' Z. \; B+ `N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',   M; [6 C+ B4 j# N" H0 m. Y
7 m2 S3 v5 b7 L5 A8 Y
'{$ElementUpgrade}', '{$ItemPierce}');");5 F- m  u% t6 A+ ^; X2 Y' m! n9 W
}& b/ C2 o& |" ]. I

+ X, Z# `; m) n" a}: R! M% e) T; I; @( m3 }, E

" X2 E* T/ A/ Z8 e* e}
! [+ h5 {3 e/ o. w) o9 |' _' D
/ u7 o6 s* X( a: b+ n$InitForm = InitForm();
* P/ X% X% W2 A4 Z! N- o+ E5 F$Listener = PostListener();
" a0 O! @5 a: i" \. _, {# t
% c1 C6 z* W( E* _: @3 Q?>! h9 P+ g/ ~& e8 k1 j6 A* C

, K& q$ t# n) W8 p& D/ f4 q# b* H/ D, @" S
# C1 J/ ~  J( a+ [

% u7 }4 U6 X6 G& C1 I
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-30 07:54 , Processed in 0.061533 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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