飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php; O; p2 P0 q7 d8 F2 T, |7 l% P
function Connect () {
/ @0 v) B7 }) W. q4 Omssql_connect('Server','UserName','Password') or die('Error: Connection to DB 0 U8 E! T" ]% j- N
% u# J, D8 Y+ P5 W8 B
Failed.');9 M' b# R* G7 Y; f5 {/ q; N
}
) m& v& R. O# F2 z$ `( }# vConnect();
7 a) M: |1 Q" M8 [5 h1 i
3 o! c- n" I+ D- V( ffunction InitForm(){0 I* z- @" ^) F, ^
//layout for the form* U5 n& @8 Q% f) @$ u) y: b
echo "<strong>Send Items.</strong>
' F& Y4 o# j" g& z9 T: Z1 x0 f<form name='select' method='post'>0 _5 Z% l  Q6 B1 [- L
<lable>Character Name</lable><br/>
/ j% y$ P- I% X% [& d<input type='text' name='char'/><br/>
3 X! X/ W/ o( T8 b4 y<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
; m8 l; P5 e0 c7 x+ c8 |<input type='text' name='item_name'/><br/>2 I& K+ U9 c4 C! V
<lable>Item Amount</lable><br/>* E" \  E5 x  v( c3 b
<input type='text' name='item_amount'/><br/>
$ s5 M- F' n: ?. }<lable>Item Upgrade Amount</lable><br/>, I5 a0 T: F$ ~& `
<input type='text' name='item_upgrade'/><br/>
& A4 j: F7 [. v* `! T/ F<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
# ~4 r) j" \0 T) f0 J, v$ j3 q" {# l* B
</lable><br/>/ I. x# _+ Y: c. k3 x
<input type='text' name='item_element'/><br/>
; e. y: O( v0 @# L- k<lable>Element Upgrade Amount</lable><br/>0 t' q2 s; Z8 _1 E& k" j4 a
<input type='text' name='element_upgrade'/><br/>1 v; G! F. [  L# j. U: e& |0 ]
<lable>Pierced Amount</lable><br/>) K9 l+ @& x6 P8 V
<input type='text' name='item_pierce'/><br/>5 ~( v( |) i  b* K9 j
<input type='submit'/>2 g2 ]" n" \' G" F2 \  \
</form>";
; H' ?7 P; i0 x& c& O7 N1 s}7 B" L3 C- t5 |3 n* @6 @# Y

( g% V7 e- V) i( b5 Kfunction PostListener (){
8 r% |6 P2 ^8 w8 g5 D  f) H//Add more post variables if needed and add them to initform() function aswell. Q' ~$ s' y. P6 i9 A6 j

! ^3 Y. M' H/ ?################################3 T; X5 x* M* R- P7 }4 S+ j
##### Connection and Post ######
/ z. G1 J( ^( {6 [+ w1 ]################################! A/ `: q% `9 R5 U# c) R- T
$name = @$_POST['char'];
  W, o: g8 h8 O$ItemName = @$_POST['item_name'];9 p( B4 i$ L9 W5 `, R% p4 T
$ItemAmount = @$_POST['item_amount'];! T4 @! ^1 h6 @( Z  h9 P
$ItemId = @$_POST['item_id'];& h4 d3 Y7 }6 X  _
$ItemUpgrade = @$_POST['item_upgrade'];$ l0 j7 s1 }9 Y, [9 b" [
$ItemElement = @$_POST['item_element'];  s- [7 Z- s5 r  h! w3 S
$ElementUpgrade = @$_POST['element_upgrade'];  \2 f- K9 Z( Y2 G; J& i- I
$ItemPierce = @$_POST['item_pierce'];
' B& H! Y2 y1 G& J1 J0 `3 m################################5 c* T5 i$ z: E6 x

# Y; U2 X# z. S8 u- g  ?//Check both variables for empty value
# S% |( D9 @  e! d8 v: g* l; |$ [+ p! l$ ]6 q% C
if (!empty($_POST['char'])){
' q5 z( i( E3 s/ U$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
; y! X" Q" \* |+ k: N6 @& r
; a" p3 V# L; ?6 t! l) l# c3 vm_szName = '{$name}'");
$ R# w4 c8 [: `3 \& ^% x/ zwhile ($row = mssql_fetch_object($find)){' L9 F' j# _% f9 t& z
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
7 S; u! f5 @: K+ _$ z$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
8 C# U1 f& M; L$ x
& Q( Q8 ]5 z5 W[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
# R+ M. }$ w7 m" Y9 u! ^+ c: x% d0 v0 P+ t8 `" x
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', # Z( ~3 O: _5 h6 X3 l
1 R' u; `7 d4 r# ~
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', . g( B- i- Q( k. A  N$ h
; r0 e+ q/ \5 }
'{$ElementUpgrade}', '{$ItemPierce}');");
2 c% ]/ {7 W3 j}+ `3 z: i& J  W4 @" J
5 o2 o/ [) l- J1 _" B9 E. }! T# t! p
}
- P! h9 b7 ?/ P6 j" R) g- [$ h  y( j$ U, f1 U- Y
}( k% I; l9 ?- w0 K

6 C$ x7 z0 v$ z$InitForm = InitForm();1 O  e% T* v" O; i$ F2 G
$Listener = PostListener();
2 I7 g2 v  x2 A' H! Q* G* P# j! g# |$ y- r1 A% S! T# A
?>2 y3 y" b, i/ [

! H9 a: j7 p" o8 p* r0 g, s
8 e3 E. [' o4 |( W  D& l& F' t
2 L' N9 T3 g% X' u" p3 P- z$ ^* I% t# p! ^4 Y' m2 Z! e+ n
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-15 09:22 , Processed in 0.074658 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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