飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
<?php
: n; S! Z1 T# y9 w' j( g$ ~function Connect () {
2 J% b+ z4 C; k3 Fmssql_connect('Server','UserName','Password') or die('Error: Connection to DB
0 W! `/ m/ s' X# ~4 q" l+ z' `  j4 S  P3 N8 a4 e0 i: G8 u
Failed.');
; N7 d" I% w7 V( [7 d}
: N3 a& ^3 n7 jConnect();, O; S" Q# V$ B# k
3 L# g3 R5 h8 |' e5 U9 q
function InitForm(){
7 S  K8 K6 b1 F; N# D6 b( I//layout for the form
  K' p7 k. d1 g" A, secho "<strong>Send Items.</strong>$ `- n5 y) k8 V4 a1 a! S9 K
<form name='select' method='post'>; ~8 r- t% O2 O9 ]
<lable>Character Name</lable><br/>9 ^* H3 M* d0 t( y+ ~9 z) R
<input type='text' name='char'/><br/>2 m) @$ _! B/ G  j* A  G0 p
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/># D- V1 d$ X+ P# l3 w6 h
<input type='text' name='item_name'/><br/>
, W, T) R8 M2 l! z1 h<lable>Item Amount</lable><br/>6 y, c. G# K6 p. d6 m( L" H& k$ _
<input type='text' name='item_amount'/><br/>5 l. A5 w% w/ T: j
<lable>Item Upgrade Amount</lable><br/>9 Q  S( M9 w  _9 W
<input type='text' name='item_upgrade'/><br/>3 g; ]$ o* W* E4 \. {
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
2 V* h4 y' j, Z
$ t0 w8 J5 q# t. z6 i  v/ U* s</lable><br/>) M. r. p% e2 e% [& \1 U
<input type='text' name='item_element'/><br/>
! z# I* N) |" a8 ]5 R6 \, R- E<lable>Element Upgrade Amount</lable><br/>$ R+ o. K7 Q. F* H: x. s
<input type='text' name='element_upgrade'/><br/>6 f/ d) Y: v. @! t
<lable>Pierced Amount</lable><br/>( B, B2 I: n+ I. M0 _. L
<input type='text' name='item_pierce'/><br/>
/ U5 C3 S5 U7 w  u3 C& B+ _# l; F<input type='submit'/>; [0 F% z5 c4 {- b3 E3 p
</form>";( B! x, ^1 @2 S$ f( F
}
" e: S( t2 `; S/ J' {. S5 a4 b$ u) i7 A8 o# J  x" `/ I
function PostListener (){3 a7 X; _- \- }9 V" c$ z/ ~
//Add more post variables if needed and add them to initform() function aswell
. q, q2 p+ |& h: U+ ]% Q: D' ]" ?% d( x8 X
################################
( M. h% C  K( L7 s4 K' K3 P0 p##### Connection and Post ######) I$ J! b. |' b( X* K9 P; C9 ]
################################
0 i+ S5 x$ g( d* R% F$ d$name = @$_POST['char'];% M1 [' n1 |! T% m) V' d
$ItemName = @$_POST['item_name'];
, \, o+ e* K7 N2 O) k- g3 f$ItemAmount = @$_POST['item_amount'];+ O& D+ [7 S1 N' q8 {4 f! n" w7 D
$ItemId = @$_POST['item_id'];
* v5 z5 T- ?: x! |$ItemUpgrade = @$_POST['item_upgrade'];
, C! o1 G2 o" Y  s4 B& o. K# b4 `$ItemElement = @$_POST['item_element'];. l& \  Z+ m+ U' d, U  y' k# d
$ElementUpgrade = @$_POST['element_upgrade'];0 o- Y7 `* ~! l+ n( ?! ~, o: G% Q* [
$ItemPierce = @$_POST['item_pierce'];
2 ?2 }$ e! T. ?+ o- v################################/ z, ?. |2 p; L* ^8 ]1 r
7 V" [2 @! X$ f: Y6 q+ [- A
//Check both variables for empty value' d4 B; ?6 x7 y
6 R1 w8 ^/ p9 l
if (!empty($_POST['char'])){, x, G0 Q' D: d& v( y
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
9 I3 x( {- f' n. `, ]# a
( Z- j1 N' f- r4 b" ym_szName = '{$name}'");/ j8 W3 w, [( b9 ]/ n
while ($row = mssql_fetch_object($find)){1 J$ G3 w# r) T/ B% z6 k+ B
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";6 p" J0 X( A' J. s
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
& ^9 K1 M, e, _4 j6 {8 h$ n- |/ @5 w% Q4 s3 \/ G# Q! E7 i& R
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], + ~) w# e) n! j4 {, R5 Y$ w
/ b# A; H3 L1 n5 S- G1 e
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 6 b5 t! ~2 V  f4 {

* U$ z' P( z" `% }  I( l9 `N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
0 T  v* q2 N# e' s, Z& F
9 q5 ?- A& X5 V' w# ~'{$ElementUpgrade}', '{$ItemPierce}');");2 d" q) c, v- z! _5 \2 Z( z# S
}% M( w. z1 ]  z+ v1 |. R( {" A" e! }
" f. W4 D) M* ?; B4 n5 j2 C
}" d5 D  u( |8 \
' w& T4 m( w$ D) |7 L
}% S- V% S; |0 s5 `+ o$ b
  e+ B  `; _5 P- l2 t
$InitForm = InitForm();# A. n6 V* G. w3 z
$Listener = PostListener();2 P% M# z4 {+ q. }( F+ A

( i) _4 B# u; t- G?>4 M* K2 ?8 `9 G1 Y% n2 g
1 r6 s/ w( z4 l5 J8 ?+ i, O" d: ~

2 N" B/ ?2 N6 Q1 O2 w, e" y: m. z. t: ~# F, |' C$ e
& Y( {7 K2 K. M. u5 w/ \  D
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-11 17:06 , Processed in 0.060640 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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