飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1090

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1090
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
<?php4 Z0 o1 H9 f( |& g  m1 M* a% I4 j
function Connect () {* n( E9 H1 t8 ?0 |( q
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB ! ^: @: _3 N1 i: A# x6 B* L( q
+ d: l+ u! P1 k" Y; ~7 R, o
Failed.');
+ Q; Y! n' R: b}/ {# e6 n$ l. I% K: k. g) K% i
Connect();- K4 z, Y' u8 ]+ J* R5 |' `9 k( f

2 F) M6 m- E0 _  f3 gfunction InitForm(){
) p1 h6 I9 H- i8 N//layout for the form
& y- T0 C4 ]: S/ A+ q9 techo "<strong>Send Items.</strong>" V: ?( h! D4 k5 x1 j: L$ I
<form name='select' method='post'>! I& f3 u) j2 [& h- H2 ?6 Q
<lable>Character Name</lable><br/>
6 K% i% r* |& \<input type='text' name='char'/><br/>
; D) G  l: u+ L<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
% i& X' t/ w) B7 p! _/ \<input type='text' name='item_name'/><br/>8 x6 T2 P% f; J6 E
<lable>Item Amount</lable><br/>
% z5 b. Z& j4 J* V! T  \% c- I<input type='text' name='item_amount'/><br/>. i+ q# }  i/ e" E: p5 ]
<lable>Item Upgrade Amount</lable><br/>
% c" h* J3 }: J% _<input type='text' name='item_upgrade'/><br/>
. N2 z7 s! |/ R3 u8 z; @2 a8 I5 s6 A<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
# u- o8 }- w3 K/ }# p7 }8 f% ~$ p" g
</lable><br/>7 n6 ?1 E2 p! @9 @6 V
<input type='text' name='item_element'/><br/>$ P# y: q0 c5 z4 s  A% a6 o1 y
<lable>Element Upgrade Amount</lable><br/>
+ C9 Z, r! J$ c1 }7 ?* s& B0 }& `0 q6 ?<input type='text' name='element_upgrade'/><br/>! L: u  u  ^7 u& x
<lable>Pierced Amount</lable><br/>
) W: X0 d- E1 z) A% S<input type='text' name='item_pierce'/><br/>
% U' B4 z  R: d8 E( r, M. T6 o<input type='submit'/>( I1 X  g( {0 i/ \: |
</form>";
4 z# |" `. B+ ~8 [/ ^}
+ B# Y! ^* e4 v3 s- G: j7 r$ K7 l% L! q+ T+ B% t( N) n
function PostListener (){
) I# e. p6 W# f/ [; ]//Add more post variables if needed and add them to initform() function aswell4 ?& k5 e2 G( C9 P* d3 N3 A  @$ q; l

0 z. N1 l; f5 Y) g################################
5 f& {" u" b/ I, a3 \##### Connection and Post ######
! {4 t- b) y$ g& i; t9 R, h8 ^################################4 @) e3 C, R7 [' b; G
$name = @$_POST['char'];/ H5 P; y% e0 \5 ^" g; X) C
$ItemName = @$_POST['item_name'];+ d' B, z' n0 @
$ItemAmount = @$_POST['item_amount'];
  w4 S; c4 _3 c' q' [9 @$ItemId = @$_POST['item_id'];8 w% ?; T9 |/ x% p. [" u  o
$ItemUpgrade = @$_POST['item_upgrade'];
  M/ C' j8 z. E) ^$ItemElement = @$_POST['item_element'];" K/ l  `- N: [& h
$ElementUpgrade = @$_POST['element_upgrade'];4 A" v! j4 ?+ |" |% W; \
$ItemPierce = @$_POST['item_pierce'];5 }2 d( M( J0 W) H# }; M
################################: ?- W* j0 W" E; t( D! w! \

8 R) v$ m) r* x# `1 H//Check both variables for empty value( y2 [8 R- y! W  U% m( u

- y, E  \* j3 [  m# B: ?0 pif (!empty($_POST['char'])){" X) k! n$ U4 n$ R, y" e: `; R
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where   Z/ E: m" b! b8 t9 T0 V7 k% V
: y5 Y, f) m/ n; `$ Z
m_szName = '{$name}'");
+ j9 W) \9 M0 j6 D8 y& I9 Uwhile ($row = mssql_fetch_object($find)){6 x5 D# d  H5 N/ W, M
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";$ A0 ?. M; V. e/ u1 \! |; h
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 7 N9 C3 C6 X5 K5 n+ z; x  ]
) X- g3 e6 q3 `( D. P: _; G! H
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], / D! n! z1 ~7 ]3 a  W7 a& I9 o5 }
5 B/ E* _% t/ B) q6 g0 W" B
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
) N& O; O$ r( I5 n$ j  ^7 U! E9 q* k. s0 J' ^% k# i0 B
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', 0 a2 G# Q2 E, U# C6 Z+ U

' U+ T# K! A* q'{$ElementUpgrade}', '{$ItemPierce}');");
0 H$ o3 b4 F8 ~" a) H: f6 h9 ]}
, @+ r) \' F5 N, ?+ I" r7 G( G8 o# r8 @, G, J
}
$ z. P: x3 {8 R4 F
5 q* d' @; ^6 P* S}
. q2 x1 }, ~+ ~0 x2 z! p
+ a3 i6 J4 q# ~. {$InitForm = InitForm();
8 d( j' B5 J2 a) N, h: u$Listener = PostListener();
7 S* P  T' a. Y* Z, u% R# C3 C% d+ Y& P5 k1 l0 X  a; o; _. ~% `
?>- Q  S; i7 H6 e

7 a) y* I: E; W$ I5 x
& F" n4 ^6 P2 M! i# m/ Q
7 q  k, e' V$ I# K  O3 w( a6 S: d2 q6 ^& ~6 d2 |
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-28 22:11 , Processed in 0.122010 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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