飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php  T) m0 E6 t/ K1 P' e
function Connect () {8 T1 i8 P) l: n
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB 6 a2 s9 l+ G8 u, L; h- \9 ]
' [! v: H4 Y4 u( B) F+ U  e
Failed.');+ y  o# N/ o" `$ @
}5 R) e2 c& H2 K! R
Connect();
2 B$ b- }+ ~$ ]3 j, H7 a: V: k* ^1 L9 t$ A( t
function InitForm(){
  e- D# N" a2 Q8 G. H+ G) ^//layout for the form
5 P7 \* x* H- B( ~echo "<strong>Send Items.</strong>
1 P3 t' @- E  h0 k<form name='select' method='post'>1 y9 g4 ^" K3 {- I
<lable>Character Name</lable><br/>
* v% U  k% J7 |5 S<input type='text' name='char'/><br/>
7 b+ ]/ E: j3 Q- ^5 j# M<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>- G3 L9 _" y$ W7 R$ L. S
<input type='text' name='item_name'/><br/>
+ R! l& {* ]) g5 ^, w6 d<lable>Item Amount</lable><br/>6 P( u, I/ s7 x3 |8 B3 i6 C8 x
<input type='text' name='item_amount'/><br/>
- L+ |! z& Q0 {* [$ n<lable>Item Upgrade Amount</lable><br/>0 B% O$ s% K1 ^
<input type='text' name='item_upgrade'/><br/>0 ?  i8 |' B2 M3 D$ F
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)* R+ [6 T' Z" r5 W* I
' Q4 P; m, ~' J+ ]% g- ?
</lable><br/>
7 M. r( q7 Z/ p: e7 s( i1 E# ~<input type='text' name='item_element'/><br/>& W0 ]5 f- i" M/ T6 v8 |
<lable>Element Upgrade Amount</lable><br/>
; {$ t% l7 M/ b& J& U! B# b  d0 D<input type='text' name='element_upgrade'/><br/>
- V$ q/ f9 Q+ p2 V<lable>Pierced Amount</lable><br/>
0 {4 j: ^6 y! f% P. F# C& j1 J<input type='text' name='item_pierce'/><br/>
7 s  j2 ~1 O. e. l% q, H<input type='submit'/>, C: X# I4 [* a$ N5 U* X* E
</form>";
9 s# L: ]# G; g: Y}9 B$ L; L8 ~( S" Z; z+ M
4 u$ h1 l: G+ ^/ O
function PostListener (){# B7 W9 d# f. h: ~) ]
//Add more post variables if needed and add them to initform() function aswell
/ f2 }0 \0 Y; N1 U# }  X. \: g$ ?
: Y3 m" V, I. c9 h8 h& f( Q################################4 U9 m3 T; c& b/ z/ |
##### Connection and Post ######5 g% c1 M6 A: e2 g" O6 R- ^
################################! f9 Z% k) }; t% Z8 u
$name = @$_POST['char'];
# R7 }, @7 k/ Z* B" r2 j9 C( Y$ItemName = @$_POST['item_name'];
* t) W* S: N+ V; l! W; X# R$ItemAmount = @$_POST['item_amount'];
  u" b+ O: G/ N% Y$ItemId = @$_POST['item_id'];) k2 [" P8 E, @, Z( s3 a0 [
$ItemUpgrade = @$_POST['item_upgrade'];' C+ _% f* p1 k# p
$ItemElement = @$_POST['item_element'];
1 ^$ ^. `4 N) J& J$ElementUpgrade = @$_POST['element_upgrade'];
0 m( f/ G. u8 v3 \. {$ Z$ItemPierce = @$_POST['item_pierce'];, I- X7 _* O6 c; Y8 C
################################1 [9 Y4 T+ B5 t' P2 W& m6 j# ^
4 m+ d2 M0 q, x/ M9 d
//Check both variables for empty value
) M" z8 n6 O, `' F1 T* O& N' `( l9 M' R1 n# d
if (!empty($_POST['char'])){
) V3 J, C: c+ F) ~8 w4 i  W$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
4 i8 N' G6 E; c# x$ t. y1 T* n7 S5 w6 q' z7 @
m_szName = '{$name}'");+ V! N+ n" H0 _6 V3 X( J, E
while ($row = mssql_fetch_object($find)){9 Y% @$ G7 F8 G, d6 Q% t
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";# v& v( x9 S' R/ K. f9 f
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
) r/ n* p+ @$ z: s% _6 E
2 \. A/ ?: B- }, @2 g[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
! ~- j0 `# W  c( T4 ]; S0 H( }, J' H' J* p$ I" b/ a9 j
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 7 U3 c3 ?- q" l- c4 Y6 i) f

% V: T5 }. j! eN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', / O: A! ?3 E, ]9 H6 h0 t
1 k+ j  z7 V9 d* L9 @
'{$ElementUpgrade}', '{$ItemPierce}');");
6 @7 I2 Y6 v1 `& F! Y9 v}/ b# D2 t, ?7 ^; G, z+ r% t
# p+ z3 Q6 H/ c9 W
}! X! o' Q) r7 G7 l/ h  h  x5 Q$ d  C

1 p8 F0 P8 ]2 K% e' _* w}
$ e! ]" k* y7 S- [
* {( k, Y. N/ ]1 l$InitForm = InitForm();
1 @9 E/ U! K, H/ B$Listener = PostListener();
0 }7 R2 X# J/ }! Y5 f! }7 y. _7 t% f5 m4 ^7 Z% e
?>
6 U6 R( P  [/ J; _" y' {
( x/ V, M0 Y) W3 ~, {5 u4 t6 Z/ V/ ~! ?8 q
$ d$ I2 m! s( \5 K0 u

9 A5 I6 ?! R- g3 B  e5 Y  ?; R
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-23 03:40 , Processed in 0.095332 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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