飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1088

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1088
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php5 Z! V. @0 e$ g8 h
function Connect () {
9 u# l( W0 h2 C% u2 x$ Q( K1 o$ jmssql_connect('Server','UserName','Password') or die('Error: Connection to DB 4 x+ R  ^4 f/ c: \9 C. N( l0 Q

7 K' S% b$ [. E. G9 x$ }$ xFailed.');1 ]1 X5 g! B0 e* P% g9 Q7 N
}
6 w( p4 b% H2 z7 L& a  ?9 }Connect();7 t* G9 f4 F3 W+ r8 R- E/ V% J
4 O5 Z" O8 \; b, ^  [: f+ m
function InitForm(){
) ~& F' a# ]8 N4 y//layout for the form* o. R% W4 n8 f2 m$ l
echo "<strong>Send Items.</strong>
  f# q$ \+ E( j<form name='select' method='post'>
0 O% V! L- p, q" N" \7 u<lable>Character Name</lable><br/>
6 e5 p" T# i4 e* j! e' w6 w) l: V<input type='text' name='char'/><br/>4 P7 |1 T3 n- B7 U" f9 p/ U1 h( t* v
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>  A+ a0 b1 c' c9 a: w
<input type='text' name='item_name'/><br/>7 E8 a; H3 A5 [: V/ D& m' a7 e# T
<lable>Item Amount</lable><br/>; p/ h5 M+ t3 `& m
<input type='text' name='item_amount'/><br/>& H% \' @* l2 |2 C. e. P! I
<lable>Item Upgrade Amount</lable><br/>3 C4 ~, n- Z: w% X( _% b1 c
<input type='text' name='item_upgrade'/><br/>7 c8 |0 g& H! {4 f
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
" ~9 H  b' u6 F, V/ r  `% [$ d
3 D& k& G7 c& h& T" ]* |: V0 B. \  j</lable><br/>5 R& J) C: R, W$ Q& i( \' d
<input type='text' name='item_element'/><br/>
7 r  |8 [8 {* Z7 x<lable>Element Upgrade Amount</lable><br/>
3 x: H/ r4 L  D* T8 e+ u" _<input type='text' name='element_upgrade'/><br/>
: u, w6 X3 ~8 v: P: R- Z4 o<lable>Pierced Amount</lable><br/>
5 u! N& `* E* ^! b9 P<input type='text' name='item_pierce'/><br/>
) Y) o% f5 l, ]: a6 h& q* @<input type='submit'/># t# M, J5 M! Y% r# f
</form>";; L' \% `3 \/ ~! @: y! a: U
}2 P! _1 I2 M$ G
  x0 ^8 p7 d3 R& ]- t
function PostListener (){% h# e/ c% T& D! A: h. Y, O7 k
//Add more post variables if needed and add them to initform() function aswell
0 W, y3 g' c/ f- m6 S7 F0 c
7 n+ q) J, O7 d################################
+ Y  l: z3 @1 }3 o) ?* `7 j5 E##### Connection and Post ######
# U$ z0 q- f- ~, _, L, q# A################################
& Q; q6 t2 \- h" S) H- x$name = @$_POST['char'];2 }8 [9 w! l9 X) {
$ItemName = @$_POST['item_name'];( a' [- `0 h. o/ z0 N& O, ^
$ItemAmount = @$_POST['item_amount'];, K. u: D, L8 v9 V
$ItemId = @$_POST['item_id'];# d3 ]9 |% x7 }& N5 |
$ItemUpgrade = @$_POST['item_upgrade'];! D: l5 K* i4 Y4 d2 j+ R% m
$ItemElement = @$_POST['item_element'];5 |+ Q4 ^+ [" h, a7 n
$ElementUpgrade = @$_POST['element_upgrade'];
' M+ m4 q3 ~$ }5 K# p$ItemPierce = @$_POST['item_pierce'];
- l6 I; S" J/ N# v8 ?8 g################################
0 B; C/ G: Q' I
$ G! z  c+ o5 B. e" Y- q, ~//Check both variables for empty value
3 G9 q2 y9 K( U% ]* z4 v5 n9 j" c; Q+ R7 e8 g  \& ~0 [" p
if (!empty($_POST['char'])){
3 y' N( t5 y: v$ B( `+ a- F$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
  K  G. \6 P$ u  J3 H2 W6 P: L7 I  r, C4 w7 i0 J
m_szName = '{$name}'");
% c: S+ C2 c6 K3 M, _1 J+ g  l: kwhile ($row = mssql_fetch_object($find)){" U! @7 Y) S- L& ?* S* E
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";1 X9 \) Y) n  i& z% s
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], , A' F; J. `4 D" j3 g  F) \
% q# x2 c$ D# _7 R. V
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
2 |4 ]# y% g  b% e8 ]/ C, X+ Z5 u$ o6 d4 y
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 8 Q4 T( _, u' u- y- C5 |

) f. j) Z2 I, g/ s3 D  d6 S' lN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', $ _; R& r/ N3 W6 |5 }
. x7 G- ]4 l% H
'{$ElementUpgrade}', '{$ItemPierce}');");
5 ~* q, M& ~; ]6 h0 I3 U}* Z5 Y' N  x/ K6 r8 Y2 }
6 b% A7 w  X. q' e
}$ L( F5 Z1 d% s' Y7 p4 L

. i, t' h  r8 S7 R5 B& n}. I& S) a6 v& L# ^0 I, `

% g7 D+ v2 V2 g" X8 w$InitForm = InitForm();$ {: X% }3 W1 J1 M; e* e6 b& h3 i/ j
$Listener = PostListener();
7 X2 L: G; x1 ~; J/ {& L& Q8 a- U& h: E3 P& Q: `& p
?>
( x. t- i) d" t6 E$ F- X, ^7 X
7 s9 Q9 o# `+ t7 w; Q! t5 g" K7 q
& W$ c- R& m3 \, D% k7 G  o  u4 Z- M" I  c# b3 L* A

: {8 a" g4 ~) h, P, e
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-24 12:28 , Processed in 0.063963 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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