飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
. h- J; g+ X( D0 D- Afunction Connect () {
9 M9 S' i2 u9 j5 lmssql_connect('Server','UserName','Password') or die('Error: Connection to DB % I5 C. |2 c8 L% I* d6 m' x
, q0 R* U6 p% S; \# x- `  I; v
Failed.');
1 X4 T4 n6 L4 B, a# i}1 o$ N4 v1 ~5 k; z' g1 d- C
Connect();( o5 j. g8 \' b7 E. F9 x
5 m5 z: [0 k* z! x; S( V- g2 N+ ^
function InitForm(){& [$ m2 t& q4 ?
//layout for the form8 M! z7 n& x3 V$ _
echo "<strong>Send Items.</strong>% P5 C) c2 N+ \/ s9 [+ S% W8 o
<form name='select' method='post'>
; J+ m+ J# _- F! n<lable>Character Name</lable><br/>
" u" E3 G) l# I<input type='text' name='char'/><br/>/ E' M8 Z3 }: W4 Y  \
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>  \- {' ^" Q6 M" l+ H
<input type='text' name='item_name'/><br/>5 D4 j5 J6 C! I3 z
<lable>Item Amount</lable><br/>
/ J2 c6 Z4 y+ e1 U8 i<input type='text' name='item_amount'/><br/>
- y+ N  H1 g5 n2 q5 t8 y' ~! @( J. c<lable>Item Upgrade Amount</lable><br/>* Q3 N9 `2 r& j7 {( c5 H, F
<input type='text' name='item_upgrade'/><br/>% k6 J4 L$ [: `5 ^7 f' G6 X' H+ H
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.). H+ M, u. X$ j& }$ p, _
4 X  b+ r4 w6 X
</lable><br/>
7 {: N& h0 m7 w, D<input type='text' name='item_element'/><br/>
" X. F- n: z+ F# a2 d. V5 m& O<lable>Element Upgrade Amount</lable><br/>5 [6 a9 d3 ]( D1 A( Q! L" X. `
<input type='text' name='element_upgrade'/><br/>
! x8 N+ E0 J* S4 D& k, d2 C<lable>Pierced Amount</lable><br/>
* X- t: {1 V2 H; i. q7 E& Q<input type='text' name='item_pierce'/><br/>) k4 U' H" e' P# w8 h) N0 O, H
<input type='submit'/>
1 g: l! F% ?% I: y( T. u</form>";
- U. h2 V, I3 H6 z3 N}: G& K& H7 G9 N3 }& l# ]
# n. i; E8 Z3 w4 ^! `
function PostListener (){# x/ I6 f* G% ?& Y8 ^, Z
//Add more post variables if needed and add them to initform() function aswell
) E% L' d/ Z0 b2 N$ _. G* z! S1 v! w
################################# V- t" d  C; t, c3 p5 E
##### Connection and Post ######2 q6 a$ T9 F  q  ?
################################
1 Z5 ^$ k) q; j  M- n$name = @$_POST['char'];& `7 I' l, ?( @
$ItemName = @$_POST['item_name'];6 ]/ w/ l# |0 B' U+ [5 i
$ItemAmount = @$_POST['item_amount'];
9 V% }+ k5 [7 f% A7 c$ItemId = @$_POST['item_id'];
2 ^5 D9 G; b# D! |' g$ItemUpgrade = @$_POST['item_upgrade'];# a5 k3 m9 b9 ]) j! l
$ItemElement = @$_POST['item_element'];; C. c0 W! ~% M6 Z* o, L. g4 ~4 s9 N
$ElementUpgrade = @$_POST['element_upgrade'];0 K1 h* q/ A$ Z, T6 t% m2 ]% O
$ItemPierce = @$_POST['item_pierce'];1 A( h8 D) ~! T% T8 v1 J8 x
################################$ f$ Y' E9 {6 B( W

* a8 ], B' k  A+ {7 Q" @//Check both variables for empty value
+ c" j' C6 c/ M- i: O6 S/ i: Z8 p2 q
4 }2 g8 U& m5 I& x9 h( wif (!empty($_POST['char'])){- X) q$ T# k% N# E" j. U
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
/ B8 K3 Q& i: Y* |/ s+ _
: r4 e" J3 u* V  T8 \m_szName = '{$name}'");! H% v+ C- h( ^. U/ d7 I4 K4 ~
while ($row = mssql_fetch_object($find)){( X* s4 h3 R, V2 t2 U1 p7 w
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
, K" ~  [+ F$ d+ g( D& Y: H. B9 Q/ d$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
7 G: C9 b+ T' d! _/ o3 O: U  b+ e, \+ z3 I1 G
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 1 w5 o3 y  W! U% I5 }/ Q7 e

* w7 E3 w! d) C; m3 u" k( w[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
- ]4 z9 {) Z, _) p& Q: R) j  n) Q4 I; u" d5 _* y
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', ( M) h. h9 S: Y+ \( V9 {$ j" M

: J: Q$ E0 ~1 k# A'{$ElementUpgrade}', '{$ItemPierce}');");
$ ?8 {1 L' w. P8 r}
' A- [( i0 B5 e1 U- Q) ~0 ?( u7 N. r- \" f: g" t3 W
}& U2 C4 @7 @8 h$ \+ o# k2 H) c% H
1 |  N  H' a$ J! D
}
/ g; Z2 i3 o3 ]9 H' D" I' k! o- |  |7 U* V9 u. G% ?- G6 c
$InitForm = InitForm();2 R- @; r* ?- p8 L  L3 i' L+ V4 O' r
$Listener = PostListener();; s. b! T. @$ o, K

7 [  d% A; k) C3 ], ]?>$ a' g! S; o( s7 S( W
+ |0 `9 w# u6 g& s: A

) J+ ]& V/ G4 I$ e0 |. v- n9 ?, s9 i- N: U# t4 s' P3 f( \
. r! j1 ~8 D1 c4 H( @
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-20 14:11 , Processed in 0.058500 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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