飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php4 s3 O, Z# H' d9 ^$ k3 G
function Connect () {
2 N+ j8 b' s8 {7 f( ~( emssql_connect('Server','UserName','Password') or die('Error: Connection to DB ! x! N. `$ T7 d$ U' Q: y1 `+ }
4 u; c3 V0 ^3 @4 U/ p
Failed.');! Z1 S" ]' e: L" ~4 P2 c
}5 t& |' w2 K  T. Y3 A
Connect();1 P- Y- P0 W, Q& M

) w# e% M7 h1 M- P8 N+ qfunction InitForm(){  m4 _" a4 @. d8 w: Q. R
//layout for the form) w7 v0 J2 p2 v: K# A
echo "<strong>Send Items.</strong>
+ T6 b; D7 J. z- X$ e<form name='select' method='post'>& T! h1 ^; \" K% x  N9 X
<lable>Character Name</lable><br/>
9 K/ V' i% r: x; m+ h2 b& H<input type='text' name='char'/><br/>/ w7 T. a% u; h  Z3 S: E: n6 r
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>0 p$ @! t3 L& Q8 y0 W
<input type='text' name='item_name'/><br/>
& r0 X8 H' ?) [8 Z3 f9 E<lable>Item Amount</lable><br/>
: x9 v  |5 ]) O5 d<input type='text' name='item_amount'/><br/>
! R  \; J* i0 P) Z<lable>Item Upgrade Amount</lable><br/>
5 @$ P' A$ q+ {0 i2 `( ?& i/ p+ J<input type='text' name='item_upgrade'/><br/>( W! D" `1 Y; [# X! k+ b! H
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)$ x; I# F0 j( U* {
9 _3 r5 `* c! |
</lable><br/>( I8 I" E; X" \2 @2 v1 b- D7 C
<input type='text' name='item_element'/><br/>
* v* i; H8 V4 {& x, |9 m<lable>Element Upgrade Amount</lable><br/>
  \8 r! q* U/ g% I' Q<input type='text' name='element_upgrade'/><br/>0 R  W8 O! y8 H; y2 `' T6 n
<lable>Pierced Amount</lable><br/>; Z' M0 v+ a; q$ ^3 P
<input type='text' name='item_pierce'/><br/>
+ ]! C- B) S' h# c3 Q1 l. E% U. b<input type='submit'/>. t: {6 p8 V# M6 X, N  h: k
</form>";
; V' F9 B! i/ j: `" e}( A  F) h- ?/ Y) j& |! W8 ]3 ?1 K
3 ^2 O+ H/ D/ Z' d9 q
function PostListener (){
" s$ B# U: v; G6 N. G5 T5 y8 Z3 Z. l//Add more post variables if needed and add them to initform() function aswell6 w% T8 L/ @; X- g9 ~
: @' N7 w, Q, n1 u- P" Z
################################" O/ A) o& o3 l) q
##### Connection and Post ######
/ `/ S7 u( ]$ R# z$ ]################################
9 E' S. X9 F+ Z5 E, L$name = @$_POST['char'];0 P6 A& `  u- i5 k7 t
$ItemName = @$_POST['item_name'];
# h% `& y4 ?' m. x( p0 F/ j, E0 C( C$ItemAmount = @$_POST['item_amount'];9 Q  {1 G! h0 l6 O% Y9 I
$ItemId = @$_POST['item_id'];( A% r; |9 f7 G8 K
$ItemUpgrade = @$_POST['item_upgrade'];
* _9 H! s9 z& |+ W8 f* N8 ]$ItemElement = @$_POST['item_element'];# F5 \. v7 G1 n2 O. c! j
$ElementUpgrade = @$_POST['element_upgrade'];& E8 N/ s8 o' b
$ItemPierce = @$_POST['item_pierce'];
+ }/ ~- M& H( d. @, {( f- I8 y! d################################
2 G9 f, z) M# K# c4 N6 ]5 j! t$ j3 @# P0 V
//Check both variables for empty value5 H7 A" X$ d1 a( k
- b/ p2 d, I/ ]$ n' ]
if (!empty($_POST['char'])){- e* m% j3 v' _
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where 8 {7 g) m0 d. H- T9 y

# y$ W) J/ u5 w$ H% O! Ym_szName = '{$name}'");8 |2 V) \4 r  I, e* ]1 K
while ($row = mssql_fetch_object($find)){
- b4 l. C- |& \( P% H8 G3 jecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
; k' Q0 F, @( ?( I$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], ; {. [6 F4 y* E0 t" |- Z

, u! F% U; U2 @& B- j! m/ q[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
1 u) p7 C. R( f' w) H* B5 C% L, g8 m4 s4 P8 p* a
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 0 w  ~! u1 J& y- ]# a

9 |+ K) D5 Q+ a0 R) L' J% U; BN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
* b" |2 w% @  L- j- D
' ?( c4 y% F4 l+ Y9 P* L% Y'{$ElementUpgrade}', '{$ItemPierce}');");
  `* ^& U% Q) j: J* E}
* H# {9 N7 ?5 M9 B% h6 w7 H
) j1 `2 l$ o! S! X" @}5 O; x" \2 J* Z( h
; f# `/ J5 w. v9 B$ J- b4 o, d
}/ F) J$ W, b( v0 s. z7 g+ K
* `5 h3 L# x6 B- m
$InitForm = InitForm();  w$ P% m( q1 Z, b+ g! n# A
$Listener = PostListener();' G8 |" m8 e' F3 \
$ O# w  I* }9 U* u/ C
?>  c% \0 `) m' c& L# Z

$ Y. W0 @) O* y3 r
# i% ?$ x" I" T$ o6 H  N# _
# o6 Q+ C  z9 b3 I, L: {) S+ i$ a7 O8 ~! Z
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-8 00:34 , Processed in 0.070174 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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