飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1090

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1090
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php% ^! V* D8 d1 r0 u  K) q7 C
function Connect () {% p2 j2 [; X) Z5 W' L9 N
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB % K2 }, L% j9 A! z& T% q- T5 l

. {1 g0 d% n4 @" dFailed.');
- u6 u( |5 O, m$ s}
7 j9 K% q% G, O/ D* d+ Z! UConnect();
4 W. w! j; T6 a3 B9 f% K1 P- i/ s* j) l
function InitForm(){7 t, ?1 @2 d/ M9 F3 @" d, _% y
//layout for the form- c- ^. ?& q+ ~) j
echo "<strong>Send Items.</strong>
# R7 L9 B) _* M<form name='select' method='post'>$ g4 X0 a* n6 W( \6 ]) l3 S$ S5 L
<lable>Character Name</lable><br/>
' k' W! F9 l2 k4 z  X<input type='text' name='char'/><br/>; K$ M! t" n& M' H2 ]' c, b/ z
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>8 E5 _3 ]! @9 h' x
<input type='text' name='item_name'/><br/>' g5 N, |* P5 M" C4 S6 X% y
<lable>Item Amount</lable><br/>
0 {) a6 F2 o6 X8 _. I/ s; |<input type='text' name='item_amount'/><br/># r$ k( f* E0 W; p+ E% D$ h
<lable>Item Upgrade Amount</lable><br/>
* {8 c- D4 D7 r: ^6 d& |; V<input type='text' name='item_upgrade'/><br/>
9 _  r; q) i2 ?$ K7 f# ^<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)5 M/ ]# i7 q6 ]2 W% z

; Q4 M: J" Z4 ^2 `* b8 Z, Z</lable><br/>0 Y$ k$ I% Z8 X& f) z
<input type='text' name='item_element'/><br/>
- }) \2 J" D* O$ M; t& d<lable>Element Upgrade Amount</lable><br/>7 r3 a* _+ R. b# [: x# @
<input type='text' name='element_upgrade'/><br/>- g& K, \. {* H
<lable>Pierced Amount</lable><br/>
; k1 l2 W2 U) [/ O<input type='text' name='item_pierce'/><br/>6 u: H1 q0 ~. G
<input type='submit'/>$ \, i4 K3 Q2 g0 q) v  C6 s3 s
</form>";, _8 W% Y+ U  G, N8 h' G$ s
}
2 ]8 i+ B5 ^- ~' u. s5 h4 w& |! K/ I6 O0 W# H! z
function PostListener (){3 J! f9 D5 Q. p- E/ r
//Add more post variables if needed and add them to initform() function aswell
0 f) z; G7 \! v$ v; s  e! J! F6 F" C7 U
################################
+ b  B$ J  s9 k  N8 d6 L" Q! u##### Connection and Post ######
* D) C% y3 s* x################################' {$ J2 X' z- l5 h6 m- Q+ g
$name = @$_POST['char'];+ X0 g- f( g6 q! U4 z) [" w( T
$ItemName = @$_POST['item_name'];# z6 W. B/ Y( V: A$ f3 p# n
$ItemAmount = @$_POST['item_amount'];
* c/ v- U' V$ q9 p! v4 e" V$ItemId = @$_POST['item_id'];9 [" `1 S( _4 K$ d- P1 A* n* W
$ItemUpgrade = @$_POST['item_upgrade'];
; L& a; X& f4 q7 X6 Z7 [$ItemElement = @$_POST['item_element'];
, b4 ~. Z) D  c$ElementUpgrade = @$_POST['element_upgrade'];- B  Q$ ]! N( f! D
$ItemPierce = @$_POST['item_pierce'];& Z$ K+ g% d- S. T$ l
################################
2 }$ |8 k6 k% i# F. q) }
9 p+ A- v, R+ q2 d. A8 d$ c//Check both variables for empty value* o7 p" K+ d. p. p( U9 f
. @. l2 `  t1 M3 g: O/ @
if (!empty($_POST['char'])){8 q5 f5 e* t! l
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
( x8 u* m7 r4 X7 D  p
& }) {0 P3 \, i: O3 ?m_szName = '{$name}'");
' Z# S9 H3 L2 |: _while ($row = mssql_fetch_object($find)){% g# f( U7 W( z; ~, K
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
4 J. |: S5 V. e( _% D3 _. A$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
* m4 l4 {2 A( d' x7 I$ n4 U0 L/ v) _+ G1 F) ~2 n# P
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], $ g+ u9 {" U) R9 b5 O: I
, K  w. s/ M0 `* b! ~4 D/ c
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
8 Y6 m+ C8 Y: R" H- A" i1 a- _
& ^5 K+ c" _0 V. z7 MN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
7 C' }9 J) o/ S7 V- z" e1 r# k" l1 r2 C- f2 ^! [! m
'{$ElementUpgrade}', '{$ItemPierce}');");
& k) I( }% B+ L$ l- F}
! q# a( j# }9 P1 c( H/ A8 i! j" F' w! e( k! h" h+ m
}; v# x' l, Y% C

9 _9 L/ O) y% I9 y4 T2 x}
8 E7 Y+ Q; q: \/ p2 u6 Z- g  S! r
' t" ]$ X) Z% ]1 [, W$InitForm = InitForm();4 r4 B0 h& o- R  |3 z
$Listener = PostListener();
' ?4 H$ {6 {, l9 c' w* W. b# ^2 f6 o
?>7 p: _2 ?7 l1 X) `3 W. u" V

( v! T: j) y( S! o- A" e- \5 Y# ^- m9 @* M9 ^8 K. T7 i

( _$ T9 D+ y8 \) e( x9 X- y! h  h
回复

使用道具 举报

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

本版积分规则

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

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

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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