飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php6 ?" Q6 h" W% e+ S" A: p
function Connect () {
6 J1 C3 R8 O+ xmssql_connect('Server','UserName','Password') or die('Error: Connection to DB
; g) h5 \. q: |# E
2 f7 c! @& M, U0 C( u5 B& w6 j3 eFailed.');1 J9 g0 ?) y: @, D  G5 a
}& x! e; |3 u% y) y9 F
Connect();
* {9 @1 F9 k8 W2 A4 [1 o& ]3 T7 T8 a! m; ~0 x2 D
function InitForm(){0 `: p8 p& r! P/ I. Q
//layout for the form" ], o6 u8 m# Z: _/ M, J( I$ Q+ q
echo "<strong>Send Items.</strong>
# b: w! B  p! c6 Z( A1 r<form name='select' method='post'>
+ M. j2 |/ r8 C! L" c" |<lable>Character Name</lable><br/>* H% r/ t7 r7 r9 ^9 B& r8 O
<input type='text' name='char'/><br/>
5 Q( q& m# m" v/ s/ h<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>4 Z3 d, `( v- ]8 ^! Y  n
<input type='text' name='item_name'/><br/>
; [3 i7 K. v% v+ o& ?& X8 I" j/ {<lable>Item Amount</lable><br/>4 L, `: ^9 [6 E  [
<input type='text' name='item_amount'/><br/>
( }9 g6 E! e5 ~- C<lable>Item Upgrade Amount</lable><br/>
# c4 s  P3 A: J  B  Z2 |<input type='text' name='item_upgrade'/><br/>. p' S$ ~8 ?* @) _& N
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)2 k1 Q- _' u0 K' Y% q7 r4 b
% ]4 R' m1 B/ }' R1 ]2 u
</lable><br/>
! x1 {( c9 H; _* m  E; C<input type='text' name='item_element'/><br/>  Y# k6 @. {9 W' F# E1 N
<lable>Element Upgrade Amount</lable><br/>
4 a6 s) z6 k6 [% H0 B' n<input type='text' name='element_upgrade'/><br/>
' H- ~* O4 x7 ]. n3 D2 ]( _<lable>Pierced Amount</lable><br/>
9 s% G& @5 s! ~$ h# D5 X# E: w<input type='text' name='item_pierce'/><br/>, v* U3 J' A  F4 S5 v% e
<input type='submit'/>0 @; i# W9 G& }( O0 D; a$ S
</form>";! F* `& f: x+ x
}
% F% G8 e& x2 G' i. g) ?
; Q6 V0 J+ h3 ?0 kfunction PostListener (){
. Z1 P5 S% W: n0 M# l//Add more post variables if needed and add them to initform() function aswell
/ Y5 p: a# Z& R1 u0 m
5 _/ p* |" _: b7 S# `9 b2 @################################# t  b; T& j3 d5 ^0 c
##### Connection and Post ######
" G5 [9 C9 Q' x################################0 I) Q  H/ Y5 {) B; O
$name = @$_POST['char'];
4 b7 O9 f0 y  Z$ N$ItemName = @$_POST['item_name'];* ^1 y( U/ f- W% S3 G  [
$ItemAmount = @$_POST['item_amount'];
* o) l8 ?, D3 Z" N$ItemId = @$_POST['item_id'];
7 [9 F) f2 [, i; D; F2 i! a, }$ItemUpgrade = @$_POST['item_upgrade'];# K* X; }+ g. Y. i; S8 c4 j
$ItemElement = @$_POST['item_element'];
; W1 ]. M2 h. f/ V$ElementUpgrade = @$_POST['element_upgrade'];
7 h, F8 C2 X+ e1 ?! ?5 D$ItemPierce = @$_POST['item_pierce'];, y2 ?: f: J# c2 T# ~
################################9 x$ d' X, ^6 V6 l; i! G( l% A
# L% _" p, o! x* F1 p7 l6 y3 F9 @: x4 ]8 l
//Check both variables for empty value
  O) Y$ S+ ^% W  [7 s2 m
2 ^- b9 N) q$ z5 [if (!empty($_POST['char'])){  c# v% C6 z" y# h, {' e
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
( ~% k# y+ Z# @; b
9 J: P4 W$ n8 Q* ]* `8 [m_szName = '{$name}'");2 Z8 ~6 r) n* ~2 D8 Q
while ($row = mssql_fetch_object($find)){
0 F5 u% M. b3 z% h3 _& {; T1 Fecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";; f$ p& Q: F$ w% g9 _0 A) Y
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], , z! }6 j! V9 k1 ^8 e6 E4 b  M

' Q8 I% k7 c* r7 a! b[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], : |2 \( t7 g! p- [& y

7 O$ P/ h* S( U: L, g7 y, c[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
! ]- i" p  B7 Q
* _3 ]* G* [+ w9 KN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
! G6 k* [5 v1 F) h
9 e7 N8 g) t$ h0 l% m, l  Q. l9 Y) R'{$ElementUpgrade}', '{$ItemPierce}');");
. `$ P; T9 M" n9 o4 f}$ H  ~5 ?1 j# Q% E" r% S5 r0 ?& Y

' w# b- P- T8 Q( z}
! |( g" i6 i: w4 O  t# f+ J" [9 N
, ^+ j2 C) t" B: w}! G. w9 n! ]! x! I8 {" m
- T! i" c  [5 l4 T9 K
$InitForm = InitForm();
$ p0 U- O0 R9 O: B4 _2 u$Listener = PostListener();. {. `( f+ v9 |% \

; S* r4 P. c- N: ~% C6 r- A) }- b?>
) j+ z) F% ?$ Z# v- b
& W! @  J4 F" E; [# n* h. J' R+ u3 `6 T. L

: Z4 F! j; M4 V, h
0 u- m( r/ m5 C6 ?& s1 w1 |
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-18 10:46 , Processed in 0.061187 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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