飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
<?php) y* R- [& h: P7 w& J, v1 U
function Connect () {" @; B7 [2 Q* ^) M& t+ I
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
' z$ N/ K/ Z6 J1 o
6 q+ V, G; i( a' d; c& QFailed.');4 \8 C- A. B$ e0 a; r1 N
}
1 U$ `# S* R: HConnect();
& n/ @6 Y3 ]+ k( S# s& B8 L4 u! B# z) F8 f
function InitForm(){
' ~' v3 C1 W) ~4 y, Q+ F//layout for the form. R* G' J; h/ \
echo "<strong>Send Items.</strong>
9 a$ o2 g( _' x6 c1 P( H<form name='select' method='post'>
" W: w- i& v7 Y/ G$ _- n<lable>Character Name</lable><br/>
+ E% i* D  t/ C9 Y1 w( y<input type='text' name='char'/><br/>: l$ s5 n7 `. S, @" R
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
0 D! W; S; E, {/ N) a<input type='text' name='item_name'/><br/>
  f- A0 i* g0 ~, q& |9 p<lable>Item Amount</lable><br/>
6 Q+ d: W3 @7 k3 P( O9 Y<input type='text' name='item_amount'/><br/>
" s- M1 A. ?5 G6 o  |% h! K  `<lable>Item Upgrade Amount</lable><br/>5 P( d3 ^/ e' p. t. C
<input type='text' name='item_upgrade'/><br/>
8 R7 L& I9 f2 ~; X2 ^# l1 p3 h$ J8 V<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
; ^+ u+ E0 S# n! n
9 Z, K1 o! A% S</lable><br/>; N% k+ R2 _" k
<input type='text' name='item_element'/><br/>
" u0 T$ v4 B1 W+ O( @. M<lable>Element Upgrade Amount</lable><br/>
" G; z8 E/ A+ L+ D- ?' Y! R, p( X5 X<input type='text' name='element_upgrade'/><br/>! S% U: Y2 y6 d  [
<lable>Pierced Amount</lable><br/>5 u2 v& u0 F4 u& g% p7 Q
<input type='text' name='item_pierce'/><br/># ]% ?! T+ P* J2 F: p) E7 k2 W
<input type='submit'/>
& O; R) v5 _# ]4 R' I</form>";
0 C- m7 g0 k. b% |. y# s}% _, ]! F+ k( l! O2 H
2 g; F  g, S: t
function PostListener (){/ z1 Y5 e# w% `8 B
//Add more post variables if needed and add them to initform() function aswell& P' k2 f+ P7 [2 G. p8 s! \7 O

8 @7 s* l. i) g3 |0 s9 z################################( ?; [# X+ ^/ W! F# q3 V9 M
##### Connection and Post ######
# F9 T2 Y- S" I6 t################################
$ F! g9 N" _2 Y1 R8 k/ d$name = @$_POST['char'];
4 ^  u# u/ s( _/ P1 L- P, f* @2 A$ItemName = @$_POST['item_name'];
$ |) @6 k$ C: x' n4 m$ItemAmount = @$_POST['item_amount'];$ F8 w' o( P3 L
$ItemId = @$_POST['item_id'];+ T7 W7 W, o( U5 j: p
$ItemUpgrade = @$_POST['item_upgrade'];+ f* t  b, S! @- R. C5 @4 ?! b' y
$ItemElement = @$_POST['item_element'];" k2 Z. x/ j8 l' d4 ~0 g) A
$ElementUpgrade = @$_POST['element_upgrade'];4 D9 @6 E; t7 w) b7 L# A% ?; \
$ItemPierce = @$_POST['item_pierce'];
' }. M2 q( w. T0 v& S. u4 ~+ ^1 o; d################################/ K, X$ f# {) P, U* Y
9 \6 `( M" ]1 y8 L2 A1 j, v
//Check both variables for empty value
1 n& w6 x. v+ [# {- I* P$ q. ]7 p7 ?1 n9 t5 R' r5 W9 Q& E6 K  S* u$ B
if (!empty($_POST['char'])){
0 w; \4 l* M1 |$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
! w1 J$ Z" n( x" b, k! u, D* Q$ Y- w" o
m_szName = '{$name}'");
, J" J1 n1 W" J6 Z) t) e- s- kwhile ($row = mssql_fetch_object($find)){
/ {1 X4 t9 {$ pecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
, {9 s; Y- A' `. }$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 9 p0 |" N% X7 R% ?$ c: ]4 {" N' w
  c& A- l& q" K: a
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
3 `! m. d, M, s. m
6 Y6 o- W& N) W$ x3 B  O' i[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', * b8 m9 e" C3 `" D5 K6 o  q# Y. B

# X/ |2 F' d  a% k4 |% LN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
6 b& B. g9 G; V, J; z0 o$ y8 ]- G
'{$ElementUpgrade}', '{$ItemPierce}');");9 {6 l7 U, p5 c
}
3 q, ~( L/ h+ z, {! c5 J. w( z) Q0 X) v+ O. N
}/ f0 p, p' v; u: v

3 Z: \8 L  q* Z7 f4 b}6 E- T5 @+ b% K6 O0 N2 V* o- [
$ A1 N  t. t7 P+ j9 {! S
$InitForm = InitForm();
, \1 O$ {$ ^: @: v& p. U2 m$Listener = PostListener();; ~3 _' _, D7 n+ e
& K4 F* s1 x: {2 [# Y
?>
/ A2 M, s5 Y; J4 [2 e! G" Y+ h
  B. O9 B8 C6 C! h' _; i
5 A0 t- e. }$ e. f/ X5 C/ i5 v" h; R

$ z  x- ^6 z! I0 Q0 @3 V$ T
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-6 13:07 , Processed in 0.069935 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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