飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
4 E) E. L8 g2 U: @function Connect () {
% ], u) a5 }  L, dmssql_connect('Server','UserName','Password') or die('Error: Connection to DB 7 a+ g  t$ a1 ?" Y& h

, w; H+ I1 U! w/ }! p# t7 uFailed.');
" `& i( p9 y4 X! ?}
& g- ]3 g7 L8 x5 I, R& X* SConnect();! i! B, O  T; M$ _9 n
- ~. D) B' `) B1 S' c3 v* e6 Q
function InitForm(){! f$ p. C9 |) x6 F8 C6 \1 f
//layout for the form
& V9 y* m" u5 N% D. Y( ~6 u; Wecho "<strong>Send Items.</strong>
1 ~1 S; v" T7 r; ]<form name='select' method='post'>' F0 R# u# s. {/ T
<lable>Character Name</lable><br/>+ C, `' j( r: C$ l! d7 ?
<input type='text' name='char'/><br/>+ e2 u# ]7 }3 _
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>% x, [/ u6 Y% S& i% D
<input type='text' name='item_name'/><br/>% t0 y8 o, v( E: t9 M
<lable>Item Amount</lable><br/>& i3 C6 `# E" c1 F$ e# i
<input type='text' name='item_amount'/><br/>: z' n) n* m; V4 F& d
<lable>Item Upgrade Amount</lable><br/>/ V  Q+ {/ g2 W$ A# W4 @
<input type='text' name='item_upgrade'/><br/>
4 v1 P$ O0 A+ m( B2 a<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)8 x! E9 t' ?2 ?! j; g

+ R3 U, s/ `2 D</lable><br/>
4 z& a0 W/ o- G. M9 ^1 K<input type='text' name='item_element'/><br/>% l/ ]* K% w2 _1 p" ~9 J( O, r" A3 t
<lable>Element Upgrade Amount</lable><br/>
* T! i3 J0 K0 Q& M* s; O7 k: q<input type='text' name='element_upgrade'/><br/>1 B/ j; Y7 |! F5 }: q. q( Z, r
<lable>Pierced Amount</lable><br/>- s: N& a" }$ b% _9 ~1 I( k1 S1 q
<input type='text' name='item_pierce'/><br/>8 t4 B9 a- g- m9 h
<input type='submit'/>  M5 {+ Z; C& A0 I
</form>";! B! K3 m5 a' f, N4 Z. |6 I
}
# c7 l+ {% k4 }9 @6 f4 d2 i
  p4 u* x$ P  v5 _3 T5 Zfunction PostListener (){# D1 C  r4 l: z4 D5 l) r2 @2 i
//Add more post variables if needed and add them to initform() function aswell) r  f5 ^+ G: {& L2 k

9 ~3 K6 X9 P. \9 d6 m! \- T$ L################################' ]5 j$ {1 H$ {* b3 f, [
##### Connection and Post ######
" Z# g; P- w# u2 M4 r################################
/ f$ x4 R+ g2 I9 j1 z4 f* {  J$name = @$_POST['char'];
! x- m* [) d2 ~5 U! q1 z% K$ItemName = @$_POST['item_name'];
1 ^6 `5 q" k3 _+ D& {$ItemAmount = @$_POST['item_amount'];
: ^2 i4 S! _5 {8 f: s$ H; X$ItemId = @$_POST['item_id'];
% @# E% ~6 d8 W/ W- a$ItemUpgrade = @$_POST['item_upgrade'];6 B/ Y4 W, R: Z, |/ C: S
$ItemElement = @$_POST['item_element'];+ V: T% S) N: `; w: V* k
$ElementUpgrade = @$_POST['element_upgrade'];4 C- G. \9 Y! n3 A# d. m
$ItemPierce = @$_POST['item_pierce'];5 i& J/ V* X4 G2 u: L# I) f
################################
) P2 D8 [- e) @3 J* j$ P. }+ E
6 ]) a- b9 k" P, d0 f//Check both variables for empty value, y; H$ l  c! X/ X# @5 W/ N

* D& J) S) z* ^3 P8 O/ K) Lif (!empty($_POST['char'])){
! F% l( C; U, x( S& O# Q) j1 g$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where . J- V. Z  \9 _% c0 k* t

. R% P% O$ u' A6 w; Xm_szName = '{$name}'");# c8 r  _" h4 Z$ B
while ($row = mssql_fetch_object($find)){1 X6 O2 E0 q% s9 P; {
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";2 B3 d. M+ p7 I5 u6 ?6 `
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
/ v  J& Z. m4 t: c
' ~8 v9 T# s; g! N8 L2 c, Z* a[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], . U7 m: Q3 h( U$ F

* m# A' i# Y( }& G( u2 k[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
6 K: c* I2 h6 E2 G, c9 f1 L
: T: R& C. `; ]6 y* T9 `2 J: xN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', ! g) H! j& _1 H  \! I# I8 s
* H) e% Z  n+ K: j- @8 H7 G
'{$ElementUpgrade}', '{$ItemPierce}');");1 l" `' P8 k1 M: a1 M0 z3 ?1 \
}
  D/ W+ c0 Y( b7 ^0 Y5 ]: }8 \1 T* f1 m1 V% }( d; _4 R  \
}
) V+ {9 X& y; F; e7 H: f0 q/ O* D
}
9 B6 l4 e. U2 n% J1 y' Z+ L$ \1 K+ ]5 i1 c' S
$InitForm = InitForm();
% `1 ]/ T" g. E5 Q3 l2 t: d; y$ P$Listener = PostListener();
! E, R2 b: }5 Z  A# _* S9 k1 W- }$ e
?>
: n7 k9 G  h! e
) o; t3 D" j8 f+ l; T4 w6 K; z& D3 s+ i+ O7 \8 e3 Q4 ^; ?& F. `

  D- `+ n! U1 M
* L- H4 H  Y; U5 P
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-10 07:23 , Processed in 0.063993 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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