飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1082

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1082
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
0 e4 b5 ]% O9 Y0 @& ?function Connect () {" ?4 o/ k5 C4 G
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB   \; ]- ?& w1 n2 y( w% b
) J# U! S6 R" a
Failed.');$ `( _9 D# N; e+ T! v& i
}
6 O. P! @% ]$ u$ h. N- S* O9 W  vConnect();0 ~0 H. S. g# c9 ?( S9 D
& p6 \- A+ D0 e/ d9 D1 w- ?
function InitForm(){
% Z) q5 M: o8 T! a//layout for the form
# M4 Q8 S$ T( q1 b/ n1 oecho "<strong>Send Items.</strong>
' S& W/ M/ f# u' r6 |4 g<form name='select' method='post'># A. w- {, t( ~1 g
<lable>Character Name</lable><br/>
; j; d2 O) _) {/ x2 L<input type='text' name='char'/><br/>
! B& U0 R# s+ W<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
" Q  a) x' a. {! m2 f<input type='text' name='item_name'/><br/>
4 D% Z3 a+ \/ M* I: {3 v3 s<lable>Item Amount</lable><br/>
$ I: v* l' X# C4 t, ~1 M<input type='text' name='item_amount'/><br/>  \; O) Q- N, L  M% ~9 U( ]/ w
<lable>Item Upgrade Amount</lable><br/>
! x( y' r$ b  l* ^1 w. K<input type='text' name='item_upgrade'/><br/>
( ]& a/ k* ?+ L9 f' P<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
  l( B  ^1 \7 B4 [7 r+ f$ w+ b$ Z, ^# O( B5 t( F( I: l# p7 ^
</lable><br/>9 `- Y+ L6 g3 T5 C6 P7 x* I
<input type='text' name='item_element'/><br/>3 K, T! q9 R: M
<lable>Element Upgrade Amount</lable><br/>( {3 B( _- [: R) W  v. y2 B/ i
<input type='text' name='element_upgrade'/><br/>, X* \) K1 P8 I1 U
<lable>Pierced Amount</lable><br/>% K  J' N4 ?! g& K$ _/ }+ e
<input type='text' name='item_pierce'/><br/>, F. E6 M4 g0 L1 I1 e+ j7 v7 y; K
<input type='submit'/>- U0 i# H3 y) e; ]% v
</form>";
$ f6 r; Z( ~9 m3 ?}0 x( s$ [6 S  \. d& k" w" x
- r: D; C3 P: w0 H
function PostListener (){
- Y; ]. ]& @$ V4 ]' W0 |' j//Add more post variables if needed and add them to initform() function aswell
5 \. N3 w9 p/ Q9 Z% [9 P9 B) i' k% U  E, ~) _4 b& C1 ]2 T
################################
3 e" N1 e, O1 H7 ?##### Connection and Post ######( o% T# h. h+ K! {; P5 O" h/ O
################################! }( O4 y' ^4 E& {0 }: X
$name = @$_POST['char'];$ H% r3 R' R% O0 L8 D; `  A
$ItemName = @$_POST['item_name'];
0 y# M( o% I, `- _$ g$ItemAmount = @$_POST['item_amount'];% C- N( r6 R8 F1 d# c# T$ F- _- ]% Z
$ItemId = @$_POST['item_id'];
3 c- N8 Z* o$ l% n& N3 U$ItemUpgrade = @$_POST['item_upgrade'];
+ z0 f! P0 [' w0 R9 v; |$ItemElement = @$_POST['item_element'];
. H8 e. k  f' S5 f$ElementUpgrade = @$_POST['element_upgrade'];( k3 j9 Z$ L% o' Q! z
$ItemPierce = @$_POST['item_pierce'];
4 z% H5 j8 l3 g################################
4 v* _6 P. V7 d  @" F7 F( l9 C
, m/ v2 h* u! W/ s# C1 {  D//Check both variables for empty value, m! {* W- ]+ `$ _
) D3 P  h3 c- O
if (!empty($_POST['char'])){
& A8 z. h2 m9 f% o$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
2 {8 v$ g( o% i7 {+ d, a) w
: U/ W7 Q$ C' `; T+ z3 T" fm_szName = '{$name}'");
; b5 E& I2 L/ x! u/ U; d6 ewhile ($row = mssql_fetch_object($find)){
$ o) C: ]9 o0 |! qecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";  s  B0 F/ |8 i% S6 \" R3 ]
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
: R3 M0 |1 j0 a+ T% v4 B( M" }$ M3 S, Q) S
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
' v, x# S& q4 z
2 [) s8 B( z- a; c6 v& [5 g( G  X[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
: C0 t: \: p1 W8 _+ r7 i4 @
5 \- K8 M- N) X) n# \8 A8 ]N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
; ]1 ?6 J4 y' V2 E! r4 S9 V" U& }2 H' D$ P% A& q8 G
'{$ElementUpgrade}', '{$ItemPierce}');");
: [1 `- H: y; L. |: E- D) m}' w8 Y6 P  v0 A" S" D* i

0 ]' y2 T: c8 Z5 ]8 l: ?}9 c3 O- _8 p6 L# |

3 t- f5 F6 m4 z( S, u}
* ], z. a( K9 i! |% [- G+ U% J9 L# P9 d& E( K
$InitForm = InitForm();2 u' t. Z* b# G/ ?* g% `( C
$Listener = PostListener();) B& G% M' _( g5 H9 m, `" h# ?# o

' w) M+ Q9 {4 r) S?>
) L' V1 {' K7 O! S
/ @! e+ ~7 X, K1 f$ n7 p" B0 M
2 D3 s# A: F% b9 Y
0 q9 h. p; H# w* X$ Z1 A5 \! {, }9 P. ^) l
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-4 10:34 , Processed in 0.067750 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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