飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1088

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1088
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php& `9 x3 z' P: \; N
function Connect () {
, {2 c2 d; @2 L  @mssql_connect('Server','UserName','Password') or die('Error: Connection to DB % f" z: L# [: J
% I* B  v3 }* E' Z2 A* a$ F0 c
Failed.');
. `$ `( e) S' k, m* ^4 b}
* O& ^5 }4 i" A4 u' l( s1 O7 C- B; S! A: |Connect();
$ U" F! H- Q& H& ^% c9 c6 ~# W2 G  S# Q  C1 @
function InitForm(){3 E4 w2 k; K3 L% V
//layout for the form: S( B# A7 l5 q  h1 W
echo "<strong>Send Items.</strong>+ e- ~& Q6 B( m% \1 y
<form name='select' method='post'>4 p9 \5 Z7 X1 x% l9 r, q3 x/ P
<lable>Character Name</lable><br/>
  ]) E8 w; a- n! p8 l1 h/ u' ~<input type='text' name='char'/><br/>. Q. B9 N& ~, R2 h9 c
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>. q& ?( h3 D, ]! \
<input type='text' name='item_name'/><br/>
9 [' R- X9 L4 c$ h+ l: P2 Z<lable>Item Amount</lable><br/>) K* q) p" U% n7 S' ?& P8 ^
<input type='text' name='item_amount'/><br/>
0 ]  M  i7 K! [6 C! B% O<lable>Item Upgrade Amount</lable><br/>; U5 c' z, e4 h6 o! `
<input type='text' name='item_upgrade'/><br/>2 D+ T, }' i  g# S4 H! n# Q
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)/ V# }1 }, \7 G! b7 j
, C; {; D& F2 n6 H. ~
</lable><br/>" F! T6 H9 i% F9 _
<input type='text' name='item_element'/><br/>
& L# `& y' e. E. {: w<lable>Element Upgrade Amount</lable><br/>
1 S1 H5 l1 d7 ^' o4 t<input type='text' name='element_upgrade'/><br/>2 @5 c& S/ R- V+ d3 o7 p1 |
<lable>Pierced Amount</lable><br/>
7 O0 U: m+ m: }4 J<input type='text' name='item_pierce'/><br/>
* L1 h, Q# e0 ~7 ^/ |* L% e4 d3 R<input type='submit'/>1 N( x: l- z3 h  W
</form>";
9 R- F$ U/ |- g2 ~" T}
5 x' A" m9 |1 f* E& P& l: ]) q( R+ ]1 D; m
function PostListener (){: O2 q1 J0 E! b4 N* X2 M& r3 T( W4 _
//Add more post variables if needed and add them to initform() function aswell
) w; N# m4 P. F8 {
: a8 o. ~2 ~7 |################################
' I6 l; ]* a/ T" V' j+ H3 j& ]##### Connection and Post ######: H. m6 t1 x9 P2 h, Y
################################- @3 }, _# i  j' Z* T
$name = @$_POST['char'];
( g9 v5 C. w0 v$ L: T$ItemName = @$_POST['item_name'];
/ e; N1 s1 t& P5 q6 M0 x5 v& S$ItemAmount = @$_POST['item_amount'];$ V  l. O- a& G
$ItemId = @$_POST['item_id'];
1 [0 U( O: `$ e6 u* Q; c$ItemUpgrade = @$_POST['item_upgrade'];
5 O+ l2 ]  d" O' Z% q6 ?( v8 N$ItemElement = @$_POST['item_element'];- J% g! S) U. U
$ElementUpgrade = @$_POST['element_upgrade'];0 R* ^4 n8 A6 j! ^# ?- ^
$ItemPierce = @$_POST['item_pierce'];3 q. x5 y* t& C0 i2 ^' F
################################
+ o/ K* B0 J% a, F
9 b8 P9 o7 Q. ]0 u! p, U//Check both variables for empty value
- Y) `0 |) h! y
' |3 T8 P3 s5 o3 I" lif (!empty($_POST['char'])){
2 a- k3 ~, N* q' w6 I3 m- Z+ H$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where 3 s4 N% g6 \0 ^

, {' N! G* n: w7 L# Qm_szName = '{$name}'");
8 j: `- }5 b0 W' o* B  K5 l( ywhile ($row = mssql_fetch_object($find)){
" Z. D2 N5 a( _; yecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";3 R/ m' G# `1 y  F. F1 V8 `: T
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 1 s7 f& a) r* T/ y4 H. S

+ D* Y9 D0 x9 d0 Y[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
: Y3 a% M3 B! M5 n% i6 k! X& n( F1 d4 ~  k3 l& G6 c1 C$ H
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
2 ?, i" e2 |8 g% R7 k$ Y* R& [9 z8 L" C4 [0 V, E
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
" f6 {" P2 }1 v( @
1 n, A) M7 }; d( _2 ~$ _- W'{$ElementUpgrade}', '{$ItemPierce}');");+ J+ ]7 a2 @7 L) |
}  f' ^0 F- v& X/ n  K. n/ [5 C

- f9 h; S' B5 q4 b$ f}
' U, A: v4 e% i( j2 _# r0 O. F( y4 v0 i
}
! H/ ]/ H5 ~4 o- @1 s. R. C) G# `, T" Z6 t
$InitForm = InitForm();' J; s! x. B/ j
$Listener = PostListener();7 K( g6 }3 Y, x* R/ K5 S& o
4 Y9 f& g/ f6 L( M+ t! T" _: k
?>
- P6 @. L# `4 v0 W: x7 x
8 }0 \7 i; `! C, P" D
. i" ]( s7 C- `8 X- n% U. R
: e2 U! x, A1 p5 }- f; |% e- E/ x5 l6 X4 f! K/ x/ B
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-25 04:43 , Processed in 0.060195 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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