飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php4 p. E  S) H1 o' N$ P! ]
function Connect () {) z: N& W  Q6 Z' Y# ^' i" f
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB ; O! r3 d- s2 P$ i
, n, G2 S, _: g
Failed.');5 [& P2 Q1 Y: V" u( p- v8 e
}
/ G) T. U8 @. j; o: YConnect();* e) G9 Y* j: ^  {2 ]

- b" M  {. a4 _) l5 @) D, J0 e# Nfunction InitForm(){9 t1 }, e9 o+ l( z/ k
//layout for the form
7 p! K' M" J- Z. Z0 X; Q( _echo "<strong>Send Items.</strong>7 C6 x; b/ d0 _) G4 M# {
<form name='select' method='post'>
: Y5 `: E: W& @/ k& E8 w<lable>Character Name</lable><br/>
2 R& f; b, Z5 r<input type='text' name='char'/><br/>4 l  `* R. }2 E8 Z$ |. R
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
: {( v6 Z  C7 Z<input type='text' name='item_name'/><br/>4 o+ d4 _; ~0 D& S8 m( K% X* C
<lable>Item Amount</lable><br/>9 S7 @( W1 B4 M  V$ B
<input type='text' name='item_amount'/><br/>
- i/ X6 b; c2 n9 o* W3 @<lable>Item Upgrade Amount</lable><br/>
& h* {5 q9 v) g' L# ]! `<input type='text' name='item_upgrade'/><br/>
0 M  _: r- @1 [" o3 C9 y% _<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.). @, d# }! v. L& e
7 q, F$ o( t$ m1 T! u, n
</lable><br/>
# D8 R3 `3 D9 W5 n<input type='text' name='item_element'/><br/>
* E4 P$ u" f  I6 i$ _% D<lable>Element Upgrade Amount</lable><br/>& g0 t  f5 f. C! ]* }
<input type='text' name='element_upgrade'/><br/>
( ^- M! K# @" }3 p<lable>Pierced Amount</lable><br/>- ]8 |# u; x6 H
<input type='text' name='item_pierce'/><br/>& k* m$ O4 R) j& H) o7 l. e
<input type='submit'/>
5 I1 r6 ^( s4 X' o: P  j</form>";' p, W, ?0 @8 N" ~2 E
}
5 F/ f: C8 _6 G5 x; d& m1 _! Z3 j7 P
function PostListener (){- O; V+ e" X- M' @, z
//Add more post variables if needed and add them to initform() function aswell. ]) k) w" L+ d& `9 S# b

2 W3 W0 ^4 F; ?  C$ Q" ^# N################################
" x$ T, E: H/ y8 k0 u" V##### Connection and Post ######
" V- h, @0 G' ?- N& w% f################################
3 U; ?( N$ x* v* c6 v. ?$name = @$_POST['char'];: E9 a/ R+ q$ h- F$ {
$ItemName = @$_POST['item_name'];
7 @5 B8 m. Y9 q: A$ \$ItemAmount = @$_POST['item_amount'];- x1 W  A; {2 s  T* ^$ @0 j5 z: w$ D: f$ G
$ItemId = @$_POST['item_id'];+ @& G+ ]9 J; v2 t. P
$ItemUpgrade = @$_POST['item_upgrade'];# V3 n* p- w+ Y( C+ ^0 U* y5 _9 W
$ItemElement = @$_POST['item_element'];7 {& C! Z1 {7 d* V0 l
$ElementUpgrade = @$_POST['element_upgrade'];
6 S* E# \) G3 E3 ~' y$ItemPierce = @$_POST['item_pierce'];
3 h& K$ i# k9 I" g7 }################################4 Z# U% Z& f) M3 |

3 G  r: X8 y6 O, j( G/ _//Check both variables for empty value
+ Y2 ~; E" T# {1 h0 _2 r( M2 _6 ]- o9 G. J& f/ M
if (!empty($_POST['char'])){: C9 n2 |) \$ w2 t5 p2 G; W
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where " s0 H/ D2 U8 r! {

+ M- o$ U) ?$ _4 ym_szName = '{$name}'");8 h: I, C2 e4 E7 y3 @% V* `4 {
while ($row = mssql_fetch_object($find)){
- f" ?- V1 O9 I1 J; Becho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";* q% y1 I0 N8 `
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], # A* P8 {2 c( M2 b' x5 Q

+ y: G6 C$ P2 y, z8 J: J[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 4 `/ Q+ F7 H+ I) Z% U! e
# o$ G( f3 `. S
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', % T$ D4 v" N/ P

) t5 F2 q3 b& L6 L+ E! ^N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
8 h3 p& z$ J5 X5 n8 u" S! W. {- n+ c0 h" S  h. G
'{$ElementUpgrade}', '{$ItemPierce}');");; {/ o  E( [% b' [: R
}
3 W( `+ v( s4 l( H( T2 U; h+ g, u# _+ d9 a
}: D) M: S# R# c. o. w, N: P) P" T4 n0 r

4 q4 c+ X5 B5 R  ~. D}
# q" t0 c0 c+ B& D
' Y/ t4 [3 ]4 B1 V9 S' I$InitForm = InitForm();7 A, q" A1 \: H/ T9 b1 m
$Listener = PostListener();
$ }. v2 j- ?1 y8 @6 |: y+ L! B% ~4 r: H9 h
?>  M; b+ U9 }( ]( E+ @

8 G8 ^# W2 C- k/ p/ m
9 E0 `+ A% c- Q  L. e- W; O, N# b1 `2 Y
% f. T, J# O8 Y; \  N
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-5 04:55 , Processed in 0.058169 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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