飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
3 n8 R5 \3 U8 Rfunction Connect () {
9 o! N$ _* d' T4 Mmssql_connect('Server','UserName','Password') or die('Error: Connection to DB ( P: ?- u5 W& n$ L+ _( `
5 D9 _0 H: {% _8 U. Q' ]0 A+ o
Failed.');2 r: t5 f# g5 U" i
}6 I$ V& }1 L8 C& O% i: B
Connect();) S& K7 Q; r" H7 c: a2 L0 H: L% p2 L2 q

) @! X, g% x5 D8 v# M5 j3 a& v/ kfunction InitForm(){/ L" c3 }9 d( U+ ^0 B$ {& Z
//layout for the form, E' |8 h4 b4 C8 u! _$ A# K
echo "<strong>Send Items.</strong>
6 d3 l# u* ?' {( F<form name='select' method='post'>5 S7 t6 B6 j& x9 P/ L
<lable>Character Name</lable><br/>! {( K$ ?$ g, p& V1 o
<input type='text' name='char'/><br/>
* a0 v" y* R- Y' B: o+ Q) q+ N<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
1 A* ~: D) F; m9 H$ V: y<input type='text' name='item_name'/><br/>
/ L/ Q$ u6 t* Q; X# E4 _- e<lable>Item Amount</lable><br/>+ p: }0 w" d% C& `, g- x# A) e4 Q
<input type='text' name='item_amount'/><br/>
  T$ ?# x& c* m, G7 k" G<lable>Item Upgrade Amount</lable><br/># r: v, s1 s+ z& ^( ]5 o
<input type='text' name='item_upgrade'/><br/>) V7 z: Z! C3 M. j5 T- h: f
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
1 \9 V6 w* b0 ~' h2 w, }
" u7 R- ]& l  i+ R, i</lable><br/>* l7 @5 ^; k1 N. c( c3 |8 h8 ]
<input type='text' name='item_element'/><br/>
: P$ J! X% i6 n$ d<lable>Element Upgrade Amount</lable><br/>" y' b" e! ^1 G5 L+ t. i! O
<input type='text' name='element_upgrade'/><br/>
! k# V/ \6 b# d) m; H7 d<lable>Pierced Amount</lable><br/>6 E3 B/ H( V$ H# k8 F  q  t9 t
<input type='text' name='item_pierce'/><br/>8 B7 d. b% _! w
<input type='submit'/>1 S7 _1 a1 F& {0 M& N, q
</form>";. e2 s- n+ T3 y; |' k4 H' ~9 ?
}4 \" e* I4 Y6 v4 B5 |6 O9 B

; }/ f2 m; V0 X6 D+ u1 A5 nfunction PostListener (){
7 w& y/ `- q, z//Add more post variables if needed and add them to initform() function aswell5 u" [; T. a2 |- s

% f* j+ V9 F+ ~/ j4 K################################
% q( ]7 k1 ^7 ~6 y; k##### Connection and Post ######4 I7 v2 n/ B; C* j
################################, V9 I) ?9 L/ V; t
$name = @$_POST['char'];
2 N' e/ E" `  ?% F$ItemName = @$_POST['item_name'];& r1 J0 E- |8 {5 q0 j0 a
$ItemAmount = @$_POST['item_amount'];. l( R0 z: `- m' x4 ], X9 w& k% U
$ItemId = @$_POST['item_id'];  n2 D6 [; h" U- W( Q* `$ j
$ItemUpgrade = @$_POST['item_upgrade'];6 u" Q8 f7 h6 r4 L3 X
$ItemElement = @$_POST['item_element'];
0 h2 x6 h% K1 z0 U3 R- @! k* n$ElementUpgrade = @$_POST['element_upgrade'];
' a2 K0 M2 r5 P, g5 P# d$ItemPierce = @$_POST['item_pierce'];1 t& T( ~: k4 [0 Q* Q! J2 v
################################  E# A7 p$ R" z4 W7 y6 I& B7 G

$ H3 z/ t8 N: e8 v//Check both variables for empty value
/ ^; Z. o0 V4 H5 d* X( i. m% q# F. J% X
if (!empty($_POST['char'])){5 O5 T7 J9 x" W- A( z3 e* E
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where * @' D( l4 X! D7 G& n! i' k" a
, y; r" V! o+ j* p$ @( w/ p5 z
m_szName = '{$name}'");* ?7 F; J) E# S+ t0 X9 ]
while ($row = mssql_fetch_object($find)){
$ @9 I0 ?0 u7 H' z3 [" W0 jecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
; J  A( @0 ?/ X' l* v( H$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], , C+ Z# z! J+ t) a" a0 A/ I! s

/ M0 ^7 a7 R( m2 I7 j" z" `" P, d[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], + F1 }9 u% V+ Z  |

- w- W8 N& P, O[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 4 B8 T$ @  f/ k* `* I

( {$ w4 p: O' x2 e8 BN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', 1 _6 K' T# n7 L& w" k5 V
# V. P, T- m* y4 u( K
'{$ElementUpgrade}', '{$ItemPierce}');");5 L+ k, \3 i# D+ w! T
}: I2 p: @8 B6 T" E  f- s
+ w% d( g6 Q. Q/ v$ @4 l
}& w3 l/ }: Y0 \! P! S* n) {

( Q$ z% w4 _/ e8 h}) ^5 c! M# M3 j2 _& Z* ^

3 B: ~) h# Y, c+ L% B$InitForm = InitForm();
$ K$ c& X! N1 A% g9 Y$Listener = PostListener();2 E9 G$ |) t/ }$ v4 Q) m' `# ]
  ]  n% D+ V) t
?>
( R$ X1 a4 j) g+ m- \6 I1 r4 @
0 P; d* H0 m* F/ `* E+ a. i; M8 _/ E. O# D2 U% z

" c: B. n" t; ^3 g3 n2 g2 G
: E; t! }+ v/ G- ^, @
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-13 21:11 , Processed in 0.060703 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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