飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1092

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1092
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php& K! j# B2 }: i: Y" ?
function Connect () {2 d: E: f  T5 D( x- d) V& x/ y
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
/ ]. y' F7 b2 L( j7 A' T8 B. O9 t. @+ r1 V  l9 j4 Q3 n
Failed.');
2 z$ w# [* q7 m8 s( O1 o) I}3 ]) A7 T$ ~# R. B
Connect();
* I& a7 C3 F1 M5 T" Z& a& j1 R- k& _7 L& q4 e% q9 D
function InitForm(){
! i; m- h. `/ g4 e//layout for the form
& j: Q, ]. j3 t2 ^' o( Xecho "<strong>Send Items.</strong>
0 n) N( i: T6 W" G% J( @2 ?2 _<form name='select' method='post'>
$ ^0 ], ]4 L# @3 b2 X<lable>Character Name</lable><br/>
# K/ ?: z3 I, T5 U& y! D<input type='text' name='char'/><br/>, _% ^; V) f7 G; Z' M' e9 p; g; @
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>4 S# D( i; y& u- G; `4 B( ^
<input type='text' name='item_name'/><br/>! \4 x" P4 w6 D! g3 |0 N
<lable>Item Amount</lable><br/>
- |& ^: l$ ]4 f9 a<input type='text' name='item_amount'/><br/>- k! z+ T3 l7 J) o7 h  G  q
<lable>Item Upgrade Amount</lable><br/>
; {$ Z) E; J2 a9 b5 r1 h% d<input type='text' name='item_upgrade'/><br/>
& g' S- C+ e3 }/ Z2 ^<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)/ B$ x+ H. B7 M1 ^! |& W: |
! p" `; a! B2 N+ c+ p3 j
</lable><br/>
3 S6 g5 X5 V2 [0 s2 \* B* B5 {9 F1 S<input type='text' name='item_element'/><br/>
9 X9 p& n/ N0 b+ J( t<lable>Element Upgrade Amount</lable><br/>) K4 m1 m3 i6 A3 N
<input type='text' name='element_upgrade'/><br/>- e5 o  H6 P. v
<lable>Pierced Amount</lable><br/>
$ K$ S* G* T' k7 Q6 C; \<input type='text' name='item_pierce'/><br/>2 L7 i6 Y3 L6 s9 X9 k, _* ~2 M
<input type='submit'/>& i2 O" x  A; J8 [. I# q
</form>";
' t8 H$ |& U8 ^+ r7 ~7 E$ u}& k3 D, T' r( `% b3 }- J  c: w. V9 C

7 g# V0 P6 i5 \+ b- X9 Qfunction PostListener (){; y9 d1 [+ p9 Q( F- X# v
//Add more post variables if needed and add them to initform() function aswell, o/ ]: G3 B/ a: z5 q, ?

( }0 S6 M4 t: X. B1 e, J0 B5 z" s################################$ C) g4 p! l+ E' @
##### Connection and Post ######9 D1 u" O" d# o2 ~
################################
7 A" z3 }& I9 t$ L1 A$name = @$_POST['char'];
2 B& p; T0 ?) y  Y$ItemName = @$_POST['item_name'];
4 H' q& k. Y- F& s3 o' Y$ItemAmount = @$_POST['item_amount'];
5 }( R( b  u! w$ItemId = @$_POST['item_id'];
2 @. E" [3 o4 t6 E$ItemUpgrade = @$_POST['item_upgrade'];* y* u3 ^; R3 B& B" G
$ItemElement = @$_POST['item_element'];" v0 i& {) x, _* o2 Z& g% Q
$ElementUpgrade = @$_POST['element_upgrade'];) \  @5 W; r4 t- ^  [
$ItemPierce = @$_POST['item_pierce'];
' d- J1 `( d- {' i8 r2 H% S1 r. ]################################
: Q" a% D4 ~( ^) _- C$ x7 j
+ B: [: m+ b, r2 e//Check both variables for empty value
0 u+ X+ A; ]4 b0 d$ B: K$ T/ ^) t# U- Q8 b
if (!empty($_POST['char'])){
4 G. m+ B. g7 [4 B$ T: X' T$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
! ^" Z  M2 V2 J; g* ~) v( k# I6 A7 O1 \
m_szName = '{$name}'");
, u* T' g+ H0 e* l7 s6 s  o8 f1 e/ a1 l! {while ($row = mssql_fetch_object($find)){
; ^4 K8 O$ V7 necho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
- V: W  S* G8 L# v% j# O$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], # o7 l: i+ {* u

" F5 [* C$ U: j# W[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], . V3 ?, ?" }: `9 S

$ j! `2 E1 H! M. v& L4 r1 x[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', , f% p) q+ U, p* z) l/ M( d
: Z& ~0 q8 x% w
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', , _" Y; o+ Y1 O- p$ W# x0 w

/ g: U/ |8 {; ~) Q1 x. _'{$ElementUpgrade}', '{$ItemPierce}');");
- Z+ E& L: ?  @: ^5 d}
# G# q2 T9 e/ F5 g2 ?1 Y/ [: f, \% ]1 U: e! z0 V  }
}  o+ ~& N) |4 }$ ^( [1 P1 y- K* p! x

: f" v+ S7 E, Y" i, o; P2 g4 Z}* d( O4 k9 q$ q5 X) b+ \5 k/ w
# ?: C, d* d3 g$ q0 b2 L5 p5 K
$InitForm = InitForm();7 A9 g1 e2 L3 y! f
$Listener = PostListener();
- ?; K' u- r  y) L) ?1 V, [. c' N5 s
( N; t$ J( e/ S$ w2 Y" G?>. ~9 N& A5 O" F! {1 [$ E9 s- m
6 j5 \& O6 s% G& V( O
  n+ B# K4 D5 }- y+ L$ ]/ O
+ k( r" U/ W3 F6 u) k
0 j% s4 i) x6 W. p, L4 d9 L
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-29 17:31 , Processed in 0.065236 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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