飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
+ N5 c: r) `  a( B2 c# |& Rfunction Connect () {
$ t) |3 q% z4 Zmssql_connect('Server','UserName','Password') or die('Error: Connection to DB 7 w( `7 l- f- u) @

5 K* W) L7 V, ^5 r4 |8 sFailed.');& I0 ?/ }+ t; t. V0 r2 P
}
; d3 F. A0 Y* d, T- A* N4 _8 fConnect();6 m: J; D& D( q; ^: N8 n; J" O
% l) M2 f1 [' v- X- M
function InitForm(){( `* g* G  i* O
//layout for the form! H; z: C$ F% c( ]& U8 m2 }
echo "<strong>Send Items.</strong>$ t& n6 n: d# S# X8 R0 x: Y
<form name='select' method='post'>
! p" m( F: z+ h3 p  K<lable>Character Name</lable><br/>5 f$ t- ^( H) n7 l* g1 j; `6 V
<input type='text' name='char'/><br/>6 d, g- \6 Q# ]/ b
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>" J  p5 w& Z% t6 x* ]/ C- s/ Z
<input type='text' name='item_name'/><br/>
( m6 G9 g8 d. f4 o9 `7 H<lable>Item Amount</lable><br/>
) _- q" b0 i5 A<input type='text' name='item_amount'/><br/>: |4 B, T0 l& |7 Y8 H. k/ o
<lable>Item Upgrade Amount</lable><br/>1 f0 _& F' I3 n' \* u5 v& p* c+ }
<input type='text' name='item_upgrade'/><br/>/ |9 ^' v" k. j# S& C
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
" b. s- [- C' S2 Z) @; r
; j  ?) \, z5 }4 m</lable><br/>, \6 l4 @$ F2 Q1 b
<input type='text' name='item_element'/><br/>
/ l5 B* P. ^- X/ p4 V) U+ \<lable>Element Upgrade Amount</lable><br/>, f7 ^- L' K# f8 Q1 \
<input type='text' name='element_upgrade'/><br/>
" I+ J- }# i( h1 t<lable>Pierced Amount</lable><br/>2 p' ~5 j3 r$ `3 G2 t, q9 ]
<input type='text' name='item_pierce'/><br/>* J8 \& s2 x. P
<input type='submit'/>
. N8 {7 V2 S+ _3 @& f0 x</form>";
6 Y0 x) r& R. k% `}) O6 z. [. f! `4 d

) R) D6 }+ }8 W6 b4 E6 Q9 N! jfunction PostListener (){
% r; I& _6 _  B1 ?//Add more post variables if needed and add them to initform() function aswell+ ~1 @* Q5 Y9 t

1 `) K* l( ^) V4 C3 m% S3 G# F' k4 n$ M################################
! g( k' R( b. F##### Connection and Post ######
, s: \! F" v; u/ ]! Y+ N* H################################; l$ @% S" j' k) V
$name = @$_POST['char'];3 q7 E8 `. R4 i; \" D& e5 k
$ItemName = @$_POST['item_name'];
# W0 Q5 Z; A$ Q# m) d$ItemAmount = @$_POST['item_amount'];
/ S. ~/ N' C* K0 O8 `$ItemId = @$_POST['item_id'];
# [) @3 ?6 i( n1 O# r0 w2 w! F$ItemUpgrade = @$_POST['item_upgrade'];
: G0 D: w8 M; L- d# w5 R$ItemElement = @$_POST['item_element'];
( X7 c* [5 n1 d6 ^+ n0 `% O$ElementUpgrade = @$_POST['element_upgrade'];
! v2 ?6 u7 p# z  R; ?5 y$ItemPierce = @$_POST['item_pierce'];1 `  G+ i6 y8 r
################################
% Z( _, d" i1 l2 O5 Y& V( g3 `% E! L+ T1 v( b5 v. `
//Check both variables for empty value0 N* H" ^, I3 m5 m. ?0 M+ P
+ @8 w* C* c3 D. g9 T) K# H
if (!empty($_POST['char'])){
9 K6 l9 x% i! i3 \% f9 ^5 ?6 ~$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where $ _5 P7 o( K+ `8 n; q+ G
, O$ `7 c" |5 a
m_szName = '{$name}'");
. q& g$ n* _8 S0 s  q8 k3 |# ^: @while ($row = mssql_fetch_object($find)){
) X& ~6 h! b8 cecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";3 O/ A; X3 c" Q4 G
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
: b+ H* a! Z. e1 L" |+ c& h2 p, l* S  X+ u! W* O4 f' r9 f
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
; r7 p# T2 s1 t5 U; R- B( o
3 T" S6 i: E- r6 ^5 y+ I6 O# C[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 5 j/ a; n$ l8 |. W# q. T! Q# `+ c
" l5 h3 J1 J# N1 k
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', 8 r% k! B# E" A

1 a9 }6 f1 _# E'{$ElementUpgrade}', '{$ItemPierce}');");/ E4 F! f& ~( }( J0 n6 J5 a
}& G* f7 I1 s7 y4 N

! Z6 L6 I( K8 d* g}/ C, W0 |/ i" V+ G% [+ W) _
% m1 Y7 R" ]7 d0 h
}& X! h8 ]: V1 N: A

) K( g) y: @5 s: c. l; U$InitForm = InitForm();) [, F: @, Z2 G3 {; d+ F
$Listener = PostListener();1 v/ Q+ d% z( f

1 j4 O9 l' G# s7 [?>( ?- i$ m: A, q9 k: Y
4 s: z5 z/ p+ g9 n3 G2 s1 j' y
" R4 s& ^0 y* `7 `0 p

, N1 B7 \( c/ G4 u5 S1 K' S
/ l$ b5 B" A; |1 h8 q, Z2 F
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-8 02:00 , Processed in 0.064425 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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