飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
9 P; l6 X* R* x2 c, j$ D1 x9 lfunction Connect () {
% H! H7 }, u" F/ V% [+ Pmssql_connect('Server','UserName','Password') or die('Error: Connection to DB 7 o# Y- B' e% q

$ m% N' u& t5 ^Failed.');4 f7 E* u; A; f( Y! B
}9 N4 w/ y& I5 D- p- b1 G% W
Connect();
2 t, W( H; w; P0 w) M% a5 W$ l  X; |9 R4 _  s; o0 o0 h
function InitForm(){# k- F" S9 e! x; }& ?, T$ N- @
//layout for the form; e3 Q. s$ O4 t
echo "<strong>Send Items.</strong>1 K+ K9 B9 T7 B3 {$ _- {
<form name='select' method='post'># ]) a2 y" @" @4 }1 s# r
<lable>Character Name</lable><br/>
/ B2 X2 J3 l6 d9 B$ d2 X<input type='text' name='char'/><br/>
7 K& l# o& D. ^6 i<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>0 w$ b# ?( K: a% c& ?3 Z
<input type='text' name='item_name'/><br/>
4 z1 q, J$ l! @6 ?9 y. H7 O" T<lable>Item Amount</lable><br/>
1 c; w/ D7 F4 d) }; u0 m2 v<input type='text' name='item_amount'/><br/>. q6 r9 X: o6 H* H
<lable>Item Upgrade Amount</lable><br/>
- J( D, s/ s% v  n  Y& {<input type='text' name='item_upgrade'/><br/># t7 g. K7 `+ r( Z1 v  _; ?6 h" u
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)% K1 a  _7 l7 n7 n( Z% Y# z
! R5 P' y, E+ W
</lable><br/>! U2 B* y! o7 U2 W, J+ X( V
<input type='text' name='item_element'/><br/>
' x  G. O: L5 S0 H: S- R. |<lable>Element Upgrade Amount</lable><br/>
+ q/ m3 M; ?. r+ r$ V6 d<input type='text' name='element_upgrade'/><br/>/ g* V* b% x" L6 I/ w
<lable>Pierced Amount</lable><br/>
8 k# R! n& G; `<input type='text' name='item_pierce'/><br/>2 ?) L+ c9 f  b7 J" v* L, z  ?7 {, }
<input type='submit'/>2 Y+ z/ Z0 Y* `# r' ~6 l
</form>";
5 h) @$ H# S7 u4 B}" z( x7 |0 M; ~

0 `+ {% S# A2 E: Ffunction PostListener (){
0 c5 a6 q" p5 N//Add more post variables if needed and add them to initform() function aswell
# w% f7 f9 H+ ]7 x( b+ {/ R
" A( k4 I4 Q3 ^( m  j; \################################. A& C; Q! i! x4 E6 Z. ^/ y
##### Connection and Post ######0 m$ a/ S0 X; S3 M1 h* N: F" a
################################5 Z7 E7 x5 z' R; \: t: K! \* q  w( {
$name = @$_POST['char'];1 B8 ^' k$ i7 }) g' l
$ItemName = @$_POST['item_name'];
5 r7 D" V5 t4 o" {' r3 m$ItemAmount = @$_POST['item_amount'];
. d  @  I  M3 L# ~( ~- Y0 m$ItemId = @$_POST['item_id'];
( F6 s3 R9 K; \' u! x$ItemUpgrade = @$_POST['item_upgrade'];
& s- c4 j. l0 j" n; E$ItemElement = @$_POST['item_element'];
) X5 L8 o( E4 [8 j6 p0 q$ElementUpgrade = @$_POST['element_upgrade'];
, b9 C3 L9 Y2 u$ x$ItemPierce = @$_POST['item_pierce'];
6 D2 B& {9 T! C  z1 p- a2 q& |+ K################################
* g1 C* L. g$ y; [: m( D8 I9 A
* `2 G% R; }# t1 H' [# J0 f//Check both variables for empty value
0 ?( S% _0 _; U# ~7 Z. W! C2 H# J$ H9 M. Z! E( x
if (!empty($_POST['char'])){7 r, X% a! B' y( |: y# K
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where 1 F) U* k& y- S' g) b$ s5 u# F4 W

" Y& R) e- [0 ~8 ~& m0 x8 s/ u( Pm_szName = '{$name}'");( G0 I, f! V8 q1 D0 H2 Z
while ($row = mssql_fetch_object($find)){/ r; G1 ?' x6 M' Y8 y
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
( s' q& ~) ?+ z$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
8 r9 N! c. t% m, E- }4 _5 ]' a7 K; Q: r: t8 j
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], $ P# z- j1 M" z) L

/ s% h8 G' Q. q3 S* r4 ?[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 9 U7 I' d7 `% l3 X

- I5 P, }0 [( r: yN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
8 r& Q" f0 ~# @. A# M! O9 O* @( p
'{$ElementUpgrade}', '{$ItemPierce}');");; J2 c+ O) ]0 _% f/ S9 I- A# A  M7 Q
}
" k9 O6 h9 N' r. n, f$ m  Z3 U4 p& i) R# \4 l& P) q6 ]! J
}' h- E" Q* H% @9 S5 B( [
: t/ c% e7 R& t2 ~: [7 R; V
}
, Q& _& D- D% Y& j
- x8 N. v  h3 W4 N) L/ ]- j1 J$InitForm = InitForm();9 x5 d2 T7 t" ?; B. l5 H' O
$Listener = PostListener();
$ l3 f8 K0 Z& a* F5 `/ j/ l- ?3 ^5 S  z% b1 i  P6 l; u
?>
8 Q/ Z$ U4 a& ]8 P( ~, B9 M# m/ K  v' ^+ }9 ]+ ]& T$ B
3 V# @9 s+ |% G$ U# ^9 w( w; f' g
+ W& s& {2 u6 j9 M1 [& t

# w2 O' K+ C* h
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-13 10:25 , Processed in 0.077640 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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