飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php* v3 C% L0 f2 A
function Connect () {4 v; g) C. i# |9 W
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
7 [( u* X9 N( [- B/ L- a5 W3 D' a! U$ N9 U: A
Failed.');$ S1 c  c) b+ e4 C) w/ ~
}0 z5 |2 f/ [1 t$ l; [& ^6 i7 y
Connect();0 N6 @- u$ `* S) c- h% j1 D

+ ~. \) n0 i1 `/ Xfunction InitForm(){
- t( R9 i( E4 W$ W# V% L$ l) p//layout for the form
; Z! [0 Y+ o$ ~1 @echo "<strong>Send Items.</strong>
0 h5 v4 f5 w% G9 }0 T2 B2 Q" g& @<form name='select' method='post'>7 V+ j% i7 K6 m" O7 Z+ }! o* D- ^
<lable>Character Name</lable><br/>
7 h) z8 @! n9 z# X  Y<input type='text' name='char'/><br/>
' K. E4 t2 k* B; I+ L<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
: T' y/ Y; p/ `' Q% f# |<input type='text' name='item_name'/><br/>2 [  B6 \# b! N& a* c. K, [
<lable>Item Amount</lable><br/>
$ }4 E9 n3 |+ ]5 R0 r7 E<input type='text' name='item_amount'/><br/>3 `! E5 ~" d6 I6 H" T2 U4 ^& i
<lable>Item Upgrade Amount</lable><br/>
1 f( m1 z+ i( r0 p0 C0 F! Q6 \<input type='text' name='item_upgrade'/><br/>6 n! i9 l3 E9 [! S! c
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
, F" r% b( y$ V+ ?2 Q6 C7 V6 |# e' f8 g8 l2 R6 t1 i
</lable><br/>
1 y5 X9 S- s' K( |5 F<input type='text' name='item_element'/><br/>
* W+ o$ E- X( Q! x( j2 J<lable>Element Upgrade Amount</lable><br/>
- ?: O. e6 z9 F<input type='text' name='element_upgrade'/><br/>0 D+ V! n$ N( M" ?5 C+ r
<lable>Pierced Amount</lable><br/>
: z! F4 @! `. I4 X' C<input type='text' name='item_pierce'/><br/>0 H: }$ K% z; ]; ^  F
<input type='submit'/>
; e; F: T3 @3 S- \* a. a</form>";
6 o# N* V% w1 H' j}
% H8 x. N6 p7 t" M' t/ w
% s& N* E6 R, S$ J/ h- [function PostListener (){
& V0 O! ~9 j* ]) v: ]3 n$ U5 D6 N//Add more post variables if needed and add them to initform() function aswell. Z; J0 ~7 Z1 K$ ~) \- G/ l* L  h9 U
" h. ]" \, B' X$ a
################################
8 b0 M, M& n- n4 x##### Connection and Post ######' c) A. P% H2 l+ u9 r9 \! ~
################################
. t+ t( s; E. Y/ a4 C$name = @$_POST['char'];& g# Y) I* a7 G& O2 r+ O7 @
$ItemName = @$_POST['item_name'];4 `3 r" R3 b4 g8 V
$ItemAmount = @$_POST['item_amount'];7 c1 r7 q5 d* G4 d) Y9 }, G
$ItemId = @$_POST['item_id'];3 }# [0 Q7 y* w+ ]) ^# n/ ~: a# ^2 [
$ItemUpgrade = @$_POST['item_upgrade'];2 d* n5 b: A! Q
$ItemElement = @$_POST['item_element'];% C$ H4 j5 ^- Z" ?
$ElementUpgrade = @$_POST['element_upgrade'];4 c: N7 n: {( @9 B* A# _3 j: |
$ItemPierce = @$_POST['item_pierce'];
. r; S' i5 \! `( y( x################################+ [  K1 W7 F6 G3 k
; x1 K( v, h9 O, Q; R( Z. A
//Check both variables for empty value
& _2 H5 b- D8 X% [7 X9 P- k) s; m# B' {
if (!empty($_POST['char'])){
' g, |( z/ R8 @$ L$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
" f3 N# J% j! }! f) R" I' m( t/ g$ K; c; ]0 g. P
m_szName = '{$name}'");6 P5 d, ?4 k0 d/ |" q3 r
while ($row = mssql_fetch_object($find)){- V5 |$ I' p& A$ K( J
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";& V% A3 \& e2 I0 f0 `* Y* L" e
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 8 V: ]' _/ K9 f& h

, M0 X- T/ d. T[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], ! Y/ @3 z* \) p. M; b

5 ~& F0 w: z# s: Z$ M[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', ) L6 Z1 e  l2 ^, y
& u1 ^: ^1 t' v1 ~/ w
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
9 H) \# ]5 a1 v% S; N8 o: I: z7 `+ Z
'{$ElementUpgrade}', '{$ItemPierce}');");
/ ?+ ~1 a9 R4 U7 C* |1 d0 N7 a}
! @+ b, C% ?1 o0 f4 s0 e2 v) {8 B0 e5 ?
}. J' ~' d  d- N6 _* x; N7 z
, {8 R- D7 J# B; w" l
}: L/ O: w4 {( ]: B2 U& c9 e9 g

0 k& z6 R  v( m8 }) R  H  h* b$InitForm = InitForm();
4 x6 M: n4 S# z$ a) K/ a$Listener = PostListener();
3 e" ~' X8 }. r& _' {. [% _! J1 {( h0 w# c' o0 n, w7 B9 O1 n
?>$ P5 V  M6 H4 T. S; s" y* L" P* x
* X+ d0 T& Z% r4 n- a" ?0 S

4 y4 j; I; s& ~3 P5 L" L5 h$ g6 e5 {# q1 W' L% L0 p. z, \
% y% b4 G7 ?) t
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-22 02:51 , Processed in 0.058638 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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