飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
<?php
$ b5 s3 A2 k* }  y$ Zfunction Connect () {
$ L& K% P7 Z& T! }. q! Fmssql_connect('Server','UserName','Password') or die('Error: Connection to DB ' z. O6 X9 D5 B( F* `' U

# p: l- V3 x8 [Failed.');
# V' x7 g9 G+ |! J% I}
9 q9 g; X8 \4 k) u3 `Connect();5 x' q9 d2 a& j! d* o
8 Y- D- c6 }/ i% U7 s9 F* a: W8 A
function InitForm(){
& M9 _! i: S7 q* @# z//layout for the form& m% R9 J  o$ N
echo "<strong>Send Items.</strong>" o1 d* K5 j6 Q' a: Z2 p
<form name='select' method='post'>
7 j. L, d4 C: D3 R% O5 L<lable>Character Name</lable><br/>
  V# j& i9 O7 F3 o& P7 }5 g<input type='text' name='char'/><br/>. S$ x' c; y) v2 j4 W
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
1 `7 C1 E  \7 h5 \, P! X: m9 V<input type='text' name='item_name'/><br/>' i" ^" Z6 v  H  C) I1 ~
<lable>Item Amount</lable><br/>
1 r2 V: y& X+ Z4 g7 D( w4 G3 J7 C<input type='text' name='item_amount'/><br/>
1 p' N$ Z% t" `" S! t2 B" G<lable>Item Upgrade Amount</lable><br/>, b& |  N1 h# t- q0 F" b/ L
<input type='text' name='item_upgrade'/><br/>
+ U4 M3 V$ U. Z+ \<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
! q8 S# G5 b! {0 M6 L
9 `) g* }( Z' r8 b7 Q</lable><br/>
0 W& `, x9 f0 Q% m6 y0 [3 q" ^, R9 Q<input type='text' name='item_element'/><br/>
, H1 G$ h; c* k/ }<lable>Element Upgrade Amount</lable><br/>1 p5 R4 ?7 W% x
<input type='text' name='element_upgrade'/><br/>9 P8 n2 V6 v6 e7 P5 [9 ]( c
<lable>Pierced Amount</lable><br/>* D1 q2 R; [9 c* d+ P4 I
<input type='text' name='item_pierce'/><br/>
4 ]4 a# V) j# A# p$ g<input type='submit'/>
* ~: ?" }; F+ J$ K! Z/ ?</form>";" K' T9 T: ^) m- _, U
}
6 t3 Y* |, d; B% {! l) l
' |" f, Q" s9 t, t7 afunction PostListener (){" H7 h- w3 r- r
//Add more post variables if needed and add them to initform() function aswell2 O2 n* ?, u8 U. x1 ~

5 W+ {2 T3 m/ S( }! h0 o' F################################
( @, z/ p/ h1 {0 u- E: U- H##### Connection and Post ######
& j) J  g% A6 O! E; h- ~- b################################6 f; x/ }; c6 g# I; l/ k5 j: `; Y
$name = @$_POST['char'];" p( Y, u& A6 z, @
$ItemName = @$_POST['item_name'];
* E% B9 K" k3 ]4 u; b( h$ItemAmount = @$_POST['item_amount'];
4 }( ^$ ^: J9 z0 H( {$ItemId = @$_POST['item_id'];
& I* n" V' Y3 g  U$ItemUpgrade = @$_POST['item_upgrade'];+ Y% I8 R+ o/ P- s* ^" m/ m
$ItemElement = @$_POST['item_element'];8 p1 q# t+ A! q6 g# e, [9 B
$ElementUpgrade = @$_POST['element_upgrade'];
) R5 D# F- d5 O# Y9 p5 e& s$ItemPierce = @$_POST['item_pierce'];
4 M+ h' |# N9 s5 P8 x################################( w& \8 h/ r3 W+ ?- x; Y1 S

# M$ O! r* p7 J' I) \//Check both variables for empty value/ b( z+ C" }) B# t: d
; K0 r! a( J8 O, S7 U4 ^- [) c
if (!empty($_POST['char'])){5 U. [4 v# O6 `0 K
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
( F0 c0 g- e( R3 Q" k1 V. s; R: H  b/ d
. E0 K/ C  y4 _1 z0 u- qm_szName = '{$name}'");: ?" d% T2 O2 M) k0 ?: C
while ($row = mssql_fetch_object($find)){7 t0 J( K- e. \0 ~% i# F- f5 L* w1 Q8 t
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
* j$ u1 z9 K) K: x  z$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], : m  v' w7 x' B5 L- n0 [
9 r2 Z8 }2 J  K- r% @/ I' e
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
3 W0 D+ `  d4 @4 e& J
. {) r. {2 P  ?0 y2 \# \8 v[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
1 i7 W  e+ J! Y; t/ C  W( v% c5 k4 k4 M) k4 N4 D, G* z, [
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
0 ~" u* n" I. f, |1 N% ^& N- U* T1 t
'{$ElementUpgrade}', '{$ItemPierce}');");
/ u  [' b1 i7 m* n7 {}) }/ g# N5 s. j% C" ], C# {
: J3 d" \8 V( l) a
}; g: [" M8 e4 M8 N" H
9 n  t; C9 {; f
}
& h2 t4 L8 [7 j4 \! l' B! t! [
4 x9 ~* j4 v2 l# G! y/ n; O* B$InitForm = InitForm();
1 @% h! i( n# G3 y7 p+ U/ n$Listener = PostListener();
; X: y: r3 ~) j$ @7 d" Q. u, v+ \% ^! ?+ V4 |7 |
?>
2 |4 M; h  T+ q8 a, l
& {. i: t; b: g2 H$ G: ?) U
* t# P7 g* U4 z: o. z# E* u: i) Y% T5 t
# d" g5 ^! Y7 A
回复

使用道具 举报

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

本版积分规则

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

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

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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