飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
( ]; i, L, m! v) l0 @4 Hfunction Connect () {. g; Q6 |7 ?* R) e2 w% F; k
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
8 L" W% z% k2 H  p( O% a  F1 w
( G. Q( p8 t! h0 }Failed.');
! l% s+ M9 C+ ~& B, S! L}
7 K7 D; {* @3 {6 A; @0 V* _Connect();3 s6 q* l# A) l/ K2 }' E1 d/ W

0 d8 S' z' j- yfunction InitForm(){
$ @: Z, f/ A4 t5 g2 s//layout for the form
  B3 U2 h) B6 O) e6 necho "<strong>Send Items.</strong>9 r& j5 p% T8 z# Y
<form name='select' method='post'>
" {0 r6 ?$ x8 u6 X2 z" o7 l* w( O<lable>Character Name</lable><br/>
; X5 o4 H0 w$ _7 |- _<input type='text' name='char'/><br/>
; I: U: {$ ?- P) E" `<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
, j9 `* q5 p0 ]5 N3 ]: m<input type='text' name='item_name'/><br/>* }* _7 F, d" q( m  ^( T+ M# a
<lable>Item Amount</lable><br/>  q: P& A# q9 Z+ d  T1 y
<input type='text' name='item_amount'/><br/>$ A+ s1 v3 u! \0 V1 O" W' H
<lable>Item Upgrade Amount</lable><br/>
2 y2 t& l$ c0 D# J' ]$ J<input type='text' name='item_upgrade'/><br/>
5 y, [3 t% L8 C- D<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
3 x1 r6 t) W0 e* C/ @/ s; ^$ _0 N1 s' J8 A0 g
</lable><br/>
& v5 k' z6 h( h8 z% I5 o* S8 h<input type='text' name='item_element'/><br/>
, L1 ~; i' Y0 @# M# c( o, ]/ l% i<lable>Element Upgrade Amount</lable><br/>% I3 j) I1 q' F1 L
<input type='text' name='element_upgrade'/><br/>0 t9 z) t% S3 @+ E' p' g% [
<lable>Pierced Amount</lable><br/>
6 z8 O8 ?: Z( L7 B0 O  ~* ^<input type='text' name='item_pierce'/><br/>
& _  j( Q* w& X( \# p<input type='submit'/>
  E3 V3 N1 L3 x* }</form>";8 a7 E  v- c% O7 U$ j
}
8 D  j9 n# l' x/ P% }8 E& X0 p% Q/ A; k$ s
function PostListener (){
; M  \5 N2 D/ O; p# k) e//Add more post variables if needed and add them to initform() function aswell+ _. ]. u0 V1 k* N; ~# T" Q
# z: G! Z0 \% t2 K3 F# s6 |" q, C
################################
$ X4 |/ z4 _+ B& Y' E##### Connection and Post ######+ h) v' D* R9 w0 U3 R
################################
5 _8 \3 o! J4 b2 f$name = @$_POST['char'];
; h6 `% z: L; G& {$ItemName = @$_POST['item_name'];
, @0 P9 G) T9 b4 C+ }; S  O6 B+ ?$ItemAmount = @$_POST['item_amount'];
6 I5 h+ d0 x) H5 D$ItemId = @$_POST['item_id'];
% v$ l3 ]/ j0 c$ItemUpgrade = @$_POST['item_upgrade'];( A* P5 k0 C# F6 s6 R
$ItemElement = @$_POST['item_element'];
3 }3 r) S& k; e8 S1 p. k; X$ F2 h8 G) W$ElementUpgrade = @$_POST['element_upgrade'];1 O1 m6 m$ S+ ?$ V3 b
$ItemPierce = @$_POST['item_pierce'];
  t+ J$ B, J/ t7 I################################
, }7 a& v8 }3 U4 Z0 K
- z  j  x% K2 `# y& A& L8 Z0 d//Check both variables for empty value
; C7 J( n: o7 \" U+ L2 ^* d& o# q& e& C, Q) Y
if (!empty($_POST['char'])){2 r) a- F3 G3 z9 i1 [/ Y$ ^# ^, B
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where 1 B8 C: m7 S( `
4 n- x. F0 o+ K6 D! L, h
m_szName = '{$name}'");4 Y6 ?4 F8 B0 p
while ($row = mssql_fetch_object($find)){7 V* t# s1 z. d& Q
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
) Y; D& _6 O! {0 g8 h, U$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
" I- D( y% W7 y( W, w6 m3 O" e* a# ?) ~' V. E( m' I" Q+ M
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
( n3 R' o0 w3 Z& k/ U, [2 M2 S1 \
) @8 P& d! ^' W" ^% s[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
; k7 e9 p  ~# o5 z5 j) d+ N
; i8 l' ?7 t9 f. _& H% G; fN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
1 K3 n4 |3 Y! Q+ F
0 L. Q) R3 h+ t# t'{$ElementUpgrade}', '{$ItemPierce}');");
9 H0 f. z8 q7 q; E2 ]) D}
7 L# H" W7 ]' J# K0 E8 ]6 _2 D" e  n# j. m! [
}9 o. U  o7 V; j& s5 S$ m6 v
3 O! f, G6 s2 p. E/ Y% ~) e
}3 ^/ E3 _  r: I; {

! y1 M8 t" q2 q  d' L$InitForm = InitForm();
  L: X6 g" D0 `$Listener = PostListener();
9 C  @+ o, ?& R& t' u+ S& p
4 ?+ i  [/ }' R; c?>
2 M9 y$ W" W% {) |
9 B  J  d1 _/ U: a
% R- r& B7 l* W1 H, K# H) K8 k1 y: p! N; i! F7 |

0 @/ \% Z+ f' E3 R7 X
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-18 00:57 , Processed in 0.060086 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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