飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1094

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1094
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php. S& N5 |" o1 ?9 i3 s  y
function Connect () {, o) t* ^4 Y+ g/ g/ I9 E0 s
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB 9 v7 v8 [1 x# g. |+ h( R
. e( a, V% _% }  y( m/ @
Failed.');3 s. ~7 d4 g" a/ ^" [5 a
}
2 ]3 N9 j$ u2 ?+ n1 IConnect();
4 l; Z& F& z! _7 Q) `8 ?; n3 c' T: F2 S' Z0 ^) V0 K
function InitForm(){( f9 E- y, n2 v& q' k& ?: z
//layout for the form% X) ?: L4 _( J! [
echo "<strong>Send Items.</strong>
; \0 u" ~" w% |% ]3 ~<form name='select' method='post'>* Q3 c/ L" P0 x0 q3 O9 }8 @
<lable>Character Name</lable><br/>
8 D0 g( P6 n" ?. k( a<input type='text' name='char'/><br/>' c  L8 m* y, K& m) {  B- U
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>. n2 |( H" m9 U* _. J# l0 q/ \8 {
<input type='text' name='item_name'/><br/>
) v3 D* G! L/ E. E2 m8 _<lable>Item Amount</lable><br/>) K, ^- W% k- F7 l4 v& t9 u6 a5 j
<input type='text' name='item_amount'/><br/>
9 n% \: q: x' Y! r7 v$ o<lable>Item Upgrade Amount</lable><br/>9 i* \3 {  ]. R! _4 S" i+ e0 ~
<input type='text' name='item_upgrade'/><br/>2 K+ e( u% I4 q2 g7 b
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
% N4 F. m0 t" }4 ]) `) N. \' v$ D) U9 ~/ ]$ [4 w, l
</lable><br/>
* `/ m% {  a' @4 K+ R3 n( ^7 D<input type='text' name='item_element'/><br/>
4 Y7 C! [: V5 r5 M6 w<lable>Element Upgrade Amount</lable><br/>! K. |8 U& s6 ^+ Q8 b% k' u) Y
<input type='text' name='element_upgrade'/><br/>
0 y  p2 j, s' E" b& U<lable>Pierced Amount</lable><br/>; V* u" J) F1 |  M$ h
<input type='text' name='item_pierce'/><br/>
3 W9 W/ o: }! R% ?3 B7 W8 l( ~5 U<input type='submit'/>
: E8 k9 l( u) H/ W0 t</form>";. l; N+ f2 n4 w* W7 _% ~6 f+ a
}
* Q, V0 L: _. U$ y) i4 g# D  g! w; `/ `
function PostListener (){
+ @. m1 q$ E1 e- x, X//Add more post variables if needed and add them to initform() function aswell) I. t- J: H! T8 B& b
1 @  h7 {# T1 _7 m: H( c
################################
) J! M/ ]1 T5 C##### Connection and Post ######0 D% c% S; D, N) r+ g
################################+ {0 f! G. T* b; ?
$name = @$_POST['char'];
, Z! h2 W4 O* B# f& ^$ItemName = @$_POST['item_name'];
1 }0 \+ S; i- d) ^! j- F0 H/ Y; _$ItemAmount = @$_POST['item_amount'];+ p% l# J6 F/ |8 b8 K
$ItemId = @$_POST['item_id'];
! W$ Y) k4 _- c7 E" R' ]+ @$ItemUpgrade = @$_POST['item_upgrade'];$ e, w5 X8 S! p4 O) W
$ItemElement = @$_POST['item_element'];" N1 J2 J; s% E/ s* f! v8 g0 R
$ElementUpgrade = @$_POST['element_upgrade'];, q) ]. n$ w/ g4 K% G. W, Q& m
$ItemPierce = @$_POST['item_pierce'];0 ]- J0 a6 S8 j# c# N6 c# ^3 f3 }
################################
/ Y- M/ r" X$ H/ \9 |; k- k, |8 `7 T; l* H6 x) k$ K# H+ J) c- L
//Check both variables for empty value
# z. ?' p' K+ g/ U) F3 y, [( q; B0 S! n* T( F- H6 Z9 l, s
if (!empty($_POST['char'])){7 B1 I7 x7 J' W" j1 n# G
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where ! M7 @8 I0 E# S: y; l
( H7 p2 a* T4 V% ]" s7 [
m_szName = '{$name}'");
) |0 \% M0 w5 i1 D4 E9 s( \while ($row = mssql_fetch_object($find)){2 J- |. _* f6 x9 H+ ]: N2 n
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
/ D( _' v# e- b8 s$ P# N$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 1 ]; O( [2 [1 q/ c( _" j
4 x- v9 ^6 V( }3 @( v" V9 `
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 3 @: y" W1 \9 i  E

! U" Y) s, b/ x3 o6 F# J[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', % |! w3 w  ?' ?$ s  x

; V6 \* \7 R! zN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
$ M5 R, f9 e6 i. K3 K( m2 p# f) r* {  b9 u7 o& F+ \8 }) h
'{$ElementUpgrade}', '{$ItemPierce}');");. J3 A# X9 x6 d$ v: C( \# ~
}7 S4 N  Q5 V$ R* f
$ f  I4 V; X) L+ H1 _* e% d
}; }3 m; Q& f" s# x
5 P# m8 o% G' j# J# X$ Z# t7 z
}$ ?; p- c5 [+ ]) K, Q  B& g
0 }/ G, @5 @/ t# ]5 \
$InitForm = InitForm();
" h- c+ X  d) A8 x, F# [0 [- K$Listener = PostListener();) s6 W2 I7 x8 _+ s. q+ k- c

+ A" f7 A* t/ M4 |?>
: q3 B+ L) u" x9 g5 D
' n4 L, U9 u& d5 k0 Y0 S& E- u" I

6 G9 g5 H5 N* c5 K6 V8 R& t: s2 Q  S8 m% _% q' C& ~
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-31 14:40 , Processed in 0.072949 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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