飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
1 k8 L( N! c5 r, ?# k% \function Connect () {
8 e, Q" B; D- E8 Q1 s( Bmssql_connect('Server','UserName','Password') or die('Error: Connection to DB
7 Z0 N3 u- M# \) z, u6 q  Q
$ A5 Y% y& x3 B, O. u$ f3 ZFailed.');
/ }3 Y$ e8 j. b6 A4 B8 V# n}- `6 {) Z; }, [$ D9 `& l
Connect();( V9 L+ M- b6 `4 q; K- ^: g/ h
2 E2 F8 p: ~- e; A8 s6 @, b& J  D
function InitForm(){* \; \: d5 j( R7 e
//layout for the form
3 g8 c' k# q2 {) k* j! M2 Uecho "<strong>Send Items.</strong>: q: Z. S: [# z: u5 K; M
<form name='select' method='post'>' A' Y+ Z$ p) I4 h4 A5 R3 f8 ~
<lable>Character Name</lable><br/># R+ v( V: w7 ^5 E2 a
<input type='text' name='char'/><br/>
7 X2 u& S% K* H1 {3 m0 g2 `<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>' R  K3 p6 v$ c- e0 a, F4 H! t6 ]# u
<input type='text' name='item_name'/><br/>
5 v$ ^" }4 k- z% L<lable>Item Amount</lable><br/>/ t; a6 w. t' y* d/ ]
<input type='text' name='item_amount'/><br/>' o$ ^/ b2 g& a
<lable>Item Upgrade Amount</lable><br/>
4 C* M, J* j8 g" o- V<input type='text' name='item_upgrade'/><br/>* _9 [, C7 M4 V4 i$ A! T
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
% F% Z4 V: \+ A  Q4 E, O$ t8 A) ?& @2 D
</lable><br/>3 j9 x! y$ P4 G+ P8 ~5 `
<input type='text' name='item_element'/><br/>1 [2 S4 f# v+ a3 l* r7 J0 X1 L
<lable>Element Upgrade Amount</lable><br/>! C# b+ I7 ~% t" |# ^
<input type='text' name='element_upgrade'/><br/>7 |* j* f8 i) h  |4 }6 V
<lable>Pierced Amount</lable><br/>
8 u4 |* L. D3 p4 H* O<input type='text' name='item_pierce'/><br/>/ h- P& c' r  z8 h+ C; T
<input type='submit'/>
6 S# M1 t4 Z; D7 S: M</form>";' P9 i  l9 e3 u; B) H# r
}
. T# O7 [& ~/ G2 h4 G3 w
8 K9 q0 O8 E8 |" G3 Q) Pfunction PostListener (){* A; K4 g! `( `! f
//Add more post variables if needed and add them to initform() function aswell  X: B4 I9 x/ _$ j" e% \; \
- N- [, ^/ [' t% U* y9 f* s
################################5 b, D9 J/ i0 e) z
##### Connection and Post ######
$ R9 m# h! J4 M- a$ J################################
! n2 A# A* J! ^$ @* o$name = @$_POST['char'];
: k) K/ f! J# T7 E+ W3 V; p5 J$ItemName = @$_POST['item_name'];* r+ d8 ~- |+ f/ J+ u
$ItemAmount = @$_POST['item_amount'];# Y' _& v( F0 [
$ItemId = @$_POST['item_id'];
* e8 O) ^  e8 {3 [9 x* y5 e$ItemUpgrade = @$_POST['item_upgrade'];
& m7 S- f7 G4 n+ d4 {$ItemElement = @$_POST['item_element'];
4 B: j( m/ ]3 D9 m' o. c- D: E5 Q$ElementUpgrade = @$_POST['element_upgrade'];0 W' ^7 v$ G+ u5 X  y
$ItemPierce = @$_POST['item_pierce'];
+ d6 ?# N5 o) M- U+ D1 w################################
' }' A9 X2 h  `3 n) h9 N/ v( Y" w4 O$ |  Q! r% F) K  M% m
//Check both variables for empty value  ?3 b# R1 N) G% z2 Z# j
6 f# y# B, y! J1 f5 c
if (!empty($_POST['char'])){9 c" K: A! H5 }% _
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where 5 U* \# i( G( {

% W6 Z5 X& `6 A9 B9 x$ T* S% g/ ]! Fm_szName = '{$name}'");9 g. {- }" G0 C
while ($row = mssql_fetch_object($find)){
; a: M& }# O. J# G, a$ necho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
3 [2 {0 I# L: j& ]$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
. q4 j' A4 h  G1 |0 ?
$ M9 i1 Y+ S/ n$ W" O: F' k. {[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
0 a! F# V+ ^' E% w" W
# F( o1 b7 K1 O) D[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
5 b) q  [2 ^! ]7 g
& g  C7 f$ R/ f0 N  _- rN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', 7 u, D" g3 Q* ]% U+ c+ a1 g

  n5 ?6 R% B% ?8 u'{$ElementUpgrade}', '{$ItemPierce}');");
# m+ t& n& E" G- A' X- S4 ^}
) u7 G/ v+ ^/ v/ e- w* [  T  }7 o" }( ?8 }
}; ~* v, f" g7 H  x( S# {! p: O
# _3 W' ^, ^. N. w. P
}
& N' K/ c9 Q6 |) h
! Q( U! D( ?* w6 Q8 B* U$InitForm = InitForm();
1 [! l8 Y7 Y1 w9 _$Listener = PostListener();- @1 v5 W. X3 z

2 g6 j" ?9 m! o?>4 Z$ F; i+ [3 C" g% d

. C" c. R, V4 T
+ x% h& e8 c. O: z9 a- V3 J& f( |8 b5 _2 ~, Y: K! q
' C" A9 o! P( f$ e5 y9 W1 {
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-13 21:55 , Processed in 0.075042 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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