飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1090

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1090
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
1 G6 J: P! u/ g  b) i0 Tfunction Connect () {* [8 E4 Z0 v9 }6 `% d4 t! l0 w
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB 5 R- E% j% f; `3 a  E' ^
6 b. `9 |7 [1 W5 \9 J# T
Failed.');! R$ q9 R% n. w& ]8 Z1 K0 K/ ~
}
* I* x' d( |: i* VConnect();
; @! c# H( j: Y) H
1 [/ [7 g4 f1 K# s6 Rfunction InitForm(){! s* I9 H% r! Q, c! `3 r' ?
//layout for the form
5 i0 A0 z- M7 V# O4 y6 [echo "<strong>Send Items.</strong>3 g: V' C0 K% d$ U: @& ~5 [# G
<form name='select' method='post'># [) A' b$ _' w1 c
<lable>Character Name</lable><br/>/ B0 e* P6 K! _/ r: E, Z0 H, w
<input type='text' name='char'/><br/>
: D# l: b# Y% N# r. ]3 L<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>- |% I9 _! x6 M
<input type='text' name='item_name'/><br/>, d8 t( x  y9 a& f) [& D- ]
<lable>Item Amount</lable><br/>0 N/ ?0 u+ E) r: q& t8 Q4 m; k( o5 _
<input type='text' name='item_amount'/><br/>
, i6 g; E0 i: ^) c! k4 X  \& L<lable>Item Upgrade Amount</lable><br/>
. d* V% r. t$ q' I" i# X# y5 Z<input type='text' name='item_upgrade'/><br/>
& i2 d/ A. e$ Y) X* ?+ j2 i* d3 {8 O5 E<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
' D# I% m4 x  T% M, T6 b4 A# k. J+ a, c- `
</lable><br/>
- m) u0 L! z* O5 o  E<input type='text' name='item_element'/><br/># x# j# B+ i' d( Z# V
<lable>Element Upgrade Amount</lable><br/>
; c/ |. [6 _8 s4 t. L% s<input type='text' name='element_upgrade'/><br/>9 [" v+ t$ d1 c7 U+ C8 I: N- X
<lable>Pierced Amount</lable><br/>
. }2 y7 K$ d8 o: }: Q' l# K<input type='text' name='item_pierce'/><br/>. }- a+ Z/ w" c; c2 ~
<input type='submit'/>
* |: M$ R/ r; B0 l+ @; `1 L</form>";. K  E1 f6 Y8 k: I; R8 z: s% n
}. d6 s( ^4 M: z+ J7 S3 t- Q. D, Q

$ Z7 d# M: r8 J7 c( q! U1 Pfunction PostListener (){( _, S5 q) [# y2 }* \) ^) J( A
//Add more post variables if needed and add them to initform() function aswell
  V4 g! C9 \3 O( d  T/ M- _% \1 Y8 c  j3 a& {, C
################################/ b  _4 f+ b% j0 ]
##### Connection and Post ######
9 v# Q$ j6 K# {3 e. |3 F. P; g################################1 @  N3 Z0 y0 C9 {# k
$name = @$_POST['char'];
$ K/ m6 Y. D9 W! ?$ M9 E5 o* L, n$ItemName = @$_POST['item_name'];( x: V+ L% U0 e: @' `9 c! L
$ItemAmount = @$_POST['item_amount'];
3 O7 w8 y! l) H5 J" |) s$ItemId = @$_POST['item_id'];
& X% S2 R& z! ?1 D$ItemUpgrade = @$_POST['item_upgrade'];9 T+ ?* N( {2 k( O/ i0 W# H9 q
$ItemElement = @$_POST['item_element'];  S8 c4 n- }# T  p  D  r: A, n
$ElementUpgrade = @$_POST['element_upgrade'];9 C# e$ {) @) a4 {! j
$ItemPierce = @$_POST['item_pierce'];
4 @- R) Y. l* D* H2 W" m- R################################" ?# b- I# B0 s9 o+ ~
) Z2 K. r$ X6 c
//Check both variables for empty value
# o8 n& ]  P9 K* w8 W4 Y8 F) M+ X; G
if (!empty($_POST['char'])){
* ?9 D8 h4 S; s( s1 N% o$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
, ^' H8 |) W; b' k% ^# I4 S: Y; s" P$ Y: [; p5 S
m_szName = '{$name}'");' u$ u6 l4 G& q1 E
while ($row = mssql_fetch_object($find)){
5 I  y" e# S% G' C! D; }echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
# [7 @: }% M5 S( R8 y4 |7 E6 @' \$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
; k) f4 W) ?: p3 {" L/ m. @
4 ]5 F: U& T, }  g- f* M8 b% u[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
6 V( q- ]2 J( P# T- \: I3 _" y  d8 v0 ]+ b$ `
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
1 F4 ?- [  Q$ ]+ _' o/ ?& N2 K" X% a- s7 d5 f% E1 b7 y6 O1 E. R
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', # [) s7 M% @7 v5 c2 s* y
1 e; G$ U. L8 |% h9 V
'{$ElementUpgrade}', '{$ItemPierce}');");
0 [( ^# r  D2 E3 F$ L% w, z9 d3 u}3 D0 k( K  H% _: {1 }

5 _6 k' A$ `% B( W}0 F- r2 C* @) v" B6 \3 q. o# q

( `$ M" x+ G" I6 w: t; L! N- Y- j* x2 m}
! S, T# h) Z8 {$ Z- R7 e5 h$ x) H. g$ p& m) z
$InitForm = InitForm();
8 n! v; ^- r& c+ d$Listener = PostListener();  J2 \; e: {( @/ o# i
1 V% u% T; O* ]- l. \
?>
; d) `$ P" f' J( r
/ B/ O) [3 z9 c% v+ J) _' Z4 b' v2 x& n  Z' p

! c) e( W+ b- \+ Y) X" y! R, _% V& D5 d' y
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-27 21:53 , Processed in 0.063632 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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