飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1064

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1064
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
: }  U/ @" v- Q: `; v% x5 F, d6 }) u* |function Connect () {
- {2 X/ ~3 z1 Imssql_connect('Server','UserName','Password') or die('Error: Connection to DB 4 m& k" p( v6 ^# |5 f7 J( R/ k3 I7 d

/ t4 b" Z2 ]$ q5 a( ~( DFailed.');
& ^* [  G1 Q- o  r( N, G0 K}
# H' E8 |. h2 h; o0 SConnect();
3 f: G1 {# V+ Q* X' Y* G/ P2 {# ?2 g
function InitForm(){
  E/ U- C- f* ~( y. L. \1 h0 d  M//layout for the form$ ^8 R& K) z9 E  c) @
echo "<strong>Send Items.</strong>
- {' I- [- V) V+ |7 N<form name='select' method='post'>
! O3 B: X$ a$ `* z& d3 C% n8 R<lable>Character Name</lable><br/>2 K; n- F( m  ?5 J0 h" X  U
<input type='text' name='char'/><br/>
6 S, _% |: s/ E5 k# W9 j5 u0 h<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
4 n, U* ?6 i% |<input type='text' name='item_name'/><br/>
" I5 d' y2 ?' N; q% ]) O  l<lable>Item Amount</lable><br/>
; f/ e0 s% P7 \<input type='text' name='item_amount'/><br/>8 e( c: M# e: n# R! O  Y
<lable>Item Upgrade Amount</lable><br/>6 c" U% \. W! r# T1 ^- t
<input type='text' name='item_upgrade'/><br/>
" T: _/ P1 j% F* w: w) p: j<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
, o- l4 U1 }, ]1 r5 {4 ]; v. q
</lable><br/>5 k) x! u6 C; O' z8 u) J
<input type='text' name='item_element'/><br/>
- h0 h, E3 M. O0 I/ B<lable>Element Upgrade Amount</lable><br/>' D( v3 W& t* T/ d- o! Y
<input type='text' name='element_upgrade'/><br/>
* k% C1 S! V+ {9 h# p4 ]. z# q- I<lable>Pierced Amount</lable><br/>
* R6 H8 b: B# k<input type='text' name='item_pierce'/><br/>; M1 Q% ?( i2 M  f4 O# Q& z0 L- E5 n5 Q
<input type='submit'/>' n2 b. a. \# v0 p. T9 L, q4 T
</form>";5 v# r% f" ^* f2 Y, j8 Y, J
}
# L0 q! T( O& |( t1 {9 ^3 Z) c4 R8 U
function PostListener (){
; p, {' \/ }2 D5 V3 Y% G, j6 |6 g//Add more post variables if needed and add them to initform() function aswell% ^! `  g+ C2 A6 g+ u
2 L$ i) [) j+ [9 G+ f: V2 Z/ J% }% x! x
################################4 L' H( }2 G8 m% j( u
##### Connection and Post ######
8 C4 @3 T! C2 O( G. Y: M% j################################9 e/ l2 v2 R; z. U9 }
$name = @$_POST['char'];
, A" J8 I5 |" H6 e$ItemName = @$_POST['item_name'];0 w- O! _# m* C1 p" }1 z
$ItemAmount = @$_POST['item_amount'];* F' r0 b  D, ]' d% u2 _9 t
$ItemId = @$_POST['item_id'];
  h! }* L- y: s, p$ItemUpgrade = @$_POST['item_upgrade'];
5 g7 C2 W) X7 i: G' [, Q$ItemElement = @$_POST['item_element'];, |/ A  J2 c( j" B' ]1 a5 W2 z
$ElementUpgrade = @$_POST['element_upgrade'];
' e6 }+ {: C% W% b% D. Q- f$ItemPierce = @$_POST['item_pierce'];
$ x: r" [$ P7 H  M: h################################
' X4 H  v: t2 u0 T7 U4 X
$ h( H6 u! J+ R+ C//Check both variables for empty value5 G! [7 [& o6 i1 q# ]# {

5 x0 L3 G4 q) p+ h  ^/ m3 Z* Oif (!empty($_POST['char'])){
9 O% o) d- K0 K$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where   l* u3 y. ?1 L( I3 P
1 l& y# v7 h; `& j
m_szName = '{$name}'");
: s* X( c$ l) [: Owhile ($row = mssql_fetch_object($find)){5 w9 u+ D8 y* n# E3 `- K
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
1 t  {' P4 K- x3 n0 o$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
8 I# z8 T2 b* t9 r: Y$ u' A, e' D" ?* \8 f* y. ^9 a
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
6 m7 _1 K) i( F$ r5 Y5 M: r3 ^7 l. j+ L, D! D: h
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', + N5 c! C- X5 l) m
( f! z. d7 D/ `% T0 ]
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
$ P  F2 C, ]! [! L8 L8 c: Y7 L  p* I9 Q
'{$ElementUpgrade}', '{$ItemPierce}');");% \. y4 |4 E; |6 v
}
7 y: W/ F0 ^4 y
. q0 m; m* ~5 t8 N. |4 ]}
2 a- z* l+ p: p. J2 Z5 D: ~  _7 H7 i: @4 a# X7 T
}# m4 k9 N" `' }. r5 V

  Y" n/ G' ^. b( d$InitForm = InitForm();, n$ t. H: i- G$ @+ U1 f/ {) C/ g
$Listener = PostListener();
$ `, @* D, d% x$ J4 y# Z  P* N# ~- T: k
?>
& B9 J( C4 A* y6 Z, E! Y9 \% m$ q' n3 w  V5 w" _4 C$ C' B. V
9 }2 e4 K- l4 \9 F

# J. s' a' F7 L; X! M# \7 o' m* |+ @9 _- ~* u* S: @
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-7-19 07:02 , Processed in 0.057937 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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