飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php; ~$ J  C1 x/ P) n
function Connect () {
- b8 B3 g, N7 i/ G' S9 j- Umssql_connect('Server','UserName','Password') or die('Error: Connection to DB
- p7 h+ G/ |* U& {  B$ g, V# B! e2 Q$ ]0 H, o$ z. h
Failed.');$ o$ h" [3 W5 `, }* y. ?. e; w3 ]
}
, H* c) I$ d4 d2 \* L6 {4 XConnect();
0 Q+ N2 `# T& V2 m6 X* B; s/ @: z% `- I9 B/ }
function InitForm(){
8 X- b; e) H4 f//layout for the form
3 {3 j/ q) p* ~: N7 F# Z, lecho "<strong>Send Items.</strong>6 e; z" N" }( P5 M, Y: M+ K$ w
<form name='select' method='post'>' i& A5 X8 d% n  B# L  ^$ H8 n
<lable>Character Name</lable><br/>
2 t2 Q3 |& U" }9 j, x$ G; F+ M! c<input type='text' name='char'/><br/>2 Y8 j# v1 e5 t! L, e7 j
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>2 U0 n9 W! b! [! q* {) L7 N5 o
<input type='text' name='item_name'/><br/>5 \; K* v! U1 L
<lable>Item Amount</lable><br/>& L  P1 y3 Q2 K
<input type='text' name='item_amount'/><br/>
9 l9 ?- v- O7 l; @' X5 [# _* h<lable>Item Upgrade Amount</lable><br/>. O9 ^6 ^8 V* j& j
<input type='text' name='item_upgrade'/><br/>, ?  k; c2 m5 W/ n% T
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
* v5 {- j2 D, ?/ ]. z; H
' x8 D; i6 q( O. n3 R; n) Q) k</lable><br/>
. f/ T/ V8 |  @8 s1 X9 Y. K6 d9 I<input type='text' name='item_element'/><br/>4 [( ^; M. C* L8 Q* K
<lable>Element Upgrade Amount</lable><br/>; o) A& Z) @+ v6 R3 m+ O/ N2 ]
<input type='text' name='element_upgrade'/><br/>7 X  s) B1 v0 q5 f) L' `
<lable>Pierced Amount</lable><br/>
( v% M0 a* J7 X; i. f  ]* x3 T$ u: y<input type='text' name='item_pierce'/><br/>
' j: o$ s: _0 w+ m2 U( Z) G<input type='submit'/>
" Z4 J6 m3 l( m( s& K& _# _</form>";
, G) l$ \( v' S}: c  r* y+ j! o7 A' e" D
7 _5 a  P& F5 a. q! e# a
function PostListener (){3 T; H: i7 s- Q, `0 [  d8 g
//Add more post variables if needed and add them to initform() function aswell' V! Q( Y6 |, k# w/ k* K! o
6 X* S* b) C  Q
################################* k1 e6 l* W) d; m/ O- v
##### Connection and Post ######
6 k/ ]; i) p. _9 E: `################################: M; b& G$ z/ [; f3 E  O/ t/ Y
$name = @$_POST['char'];* @% r9 m7 |( r1 S& a
$ItemName = @$_POST['item_name'];, K, Z7 n& `8 {
$ItemAmount = @$_POST['item_amount'];' y  Z3 k7 E; B. ?
$ItemId = @$_POST['item_id'];# F% M4 u; K' I; `( ^
$ItemUpgrade = @$_POST['item_upgrade'];5 q* l* c' C3 Q; Y% P' M
$ItemElement = @$_POST['item_element'];
  u/ G0 o9 j& M. E' s' e$ElementUpgrade = @$_POST['element_upgrade'];/ k2 f1 o; n0 g) }+ q
$ItemPierce = @$_POST['item_pierce'];  R. V7 x. |* W8 w2 `7 H9 R: U! h
################################$ _' c) u: a1 p" w
5 V8 `+ J) ?: ]0 g
//Check both variables for empty value* w% K' r2 d% N3 k

' e+ H/ G. ~2 h$ pif (!empty($_POST['char'])){; T1 _8 j* N% [
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where " f1 l9 i1 C5 N" ]; y/ b
/ x! B$ L4 L( B5 p% |) C* N
m_szName = '{$name}'");6 _9 \1 D- r5 ]- r
while ($row = mssql_fetch_object($find)){) F1 C8 a6 O2 Q6 ~% y* a
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";6 E) l* ~: N3 g% ~  q
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
* A0 y3 w& B/ b& ~; J: o
0 S1 K. q; \- C3 l% V6 O; n' V% x[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 7 u/ b, K" R  G. |+ R9 Q) E

, X6 L* k9 C& V. ~[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 3 H9 V8 g, t9 [  I

  \8 \' d& \3 _. A- i4 PN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
  y! Q1 o' ~. Y- u- o8 F; T" t( Y/ O7 Y$ D( w
'{$ElementUpgrade}', '{$ItemPierce}');");6 Y5 G! j4 \6 Q& x7 d8 n
}
" O4 A1 m4 b! Q7 n
( |1 A! O1 R( j4 z7 k0 q0 A}( M3 n: t' k: G3 O+ s
4 h' B( e1 T5 g/ j
}6 o7 i2 X! A  i1 G/ V. u

' B/ X7 S* v1 J3 a8 Y$InitForm = InitForm();
+ u7 Q; o6 z' E$ z1 M9 j$Listener = PostListener();
8 d* c8 @7 ~, B* |2 L7 I3 f: r/ E7 }
?>
! S4 K4 z# r3 a! ]% T4 b* B7 P, Z0 i/ z8 t

" ?% |) [5 i. t$ e$ n1 h9 t. f) M* L3 P; H9 D; f  f+ t, f
) ^: ], z9 f& k3 }4 {4 A
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-22 20:15 , Processed in 0.072450 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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