飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
$ S3 Y) M: U7 n% L# |5 Nfunction Connect () {
) ~1 }& J+ r' Y  I, Fmssql_connect('Server','UserName','Password') or die('Error: Connection to DB 2 r( N! J* s9 |5 ]
6 M( b* C- ~' s5 G! E& c
Failed.');  J0 m1 _% |$ Y2 n: a
}+ u+ v0 Q+ m7 f' ?, i' M
Connect();, j: s6 H7 P2 c& @9 T! D" `1 i6 m3 a
7 N7 }5 q% x* G& G
function InitForm(){: _3 c  j: ^  N# V
//layout for the form
! f* q' S8 H) J+ [6 v+ Vecho "<strong>Send Items.</strong>
# G+ M# U- h5 z2 z" C<form name='select' method='post'>
$ ~6 b$ L7 |8 t/ H, M; o* l<lable>Character Name</lable><br/>9 Q# Z( ~* r5 o8 E: w
<input type='text' name='char'/><br/>! B( ?5 I, z7 A1 P) }) j3 N
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
( H, e3 Z6 S+ b) p" T<input type='text' name='item_name'/><br/>
7 t; j3 q) ]# b# z& U/ B<lable>Item Amount</lable><br/>5 `3 U  L& @- F# f4 O
<input type='text' name='item_amount'/><br/>- A/ Y% q8 u6 j/ a
<lable>Item Upgrade Amount</lable><br/>
7 ~( ~, ^6 k, D/ @* z! S( e, {  f<input type='text' name='item_upgrade'/><br/>
% t6 {2 ^5 q, t: s<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)+ X- b) y5 r/ p
# e2 v' c  l$ @
</lable><br/>
+ d& C9 Z& i+ A# T" ]* _<input type='text' name='item_element'/><br/>
  F* s. F3 o1 ?) r<lable>Element Upgrade Amount</lable><br/>7 X4 ~- M( U% `1 Q2 h
<input type='text' name='element_upgrade'/><br/>
- i' O$ v* c; G8 b<lable>Pierced Amount</lable><br/>
3 C! R; f* `/ G<input type='text' name='item_pierce'/><br/>/ Q% @" b9 H1 c$ k1 b! H
<input type='submit'/>
  g$ y% Z7 \+ Y' }</form>";
5 R6 u! n7 M5 n/ P( i1 m}
) ^7 P% R7 i0 d9 D  n' i+ j8 l9 E
8 ?/ C. }4 l& H5 b- s2 pfunction PostListener (){
7 v/ ?6 C1 q: q* T" V' |- r4 c//Add more post variables if needed and add them to initform() function aswell
* E" t2 ?: @# {: Q1 G
" O" |: l! e+ d################################3 W& n/ P& s: e$ |3 g% H2 |1 s! C0 b
##### Connection and Post ######7 q5 h" N( x8 a9 W# k5 q
################################
* e8 B. A0 V: H# ^8 @. F$name = @$_POST['char'];
! q, Y6 x# j' e3 I  T$ItemName = @$_POST['item_name'];& P6 _+ C, P- C' l, {( z* G
$ItemAmount = @$_POST['item_amount'];
; n4 x+ G: H8 H1 k5 m+ z! V5 r$ItemId = @$_POST['item_id'];; O( e+ w1 M& y0 K; {+ R( w
$ItemUpgrade = @$_POST['item_upgrade'];
3 |6 p. X8 S, A8 ]$ItemElement = @$_POST['item_element'];7 C  y" b5 r- a
$ElementUpgrade = @$_POST['element_upgrade'];" N& s7 L& \1 w5 e3 `4 D/ T
$ItemPierce = @$_POST['item_pierce'];
( {7 W" j- Z- \################################
( d3 r, f6 l  e! V3 A
6 |) p! u3 x1 I% P# j1 n//Check both variables for empty value, r) @8 @) D' x) s5 h( j: e8 I+ ^3 K3 q
0 o$ q, l5 k: U( C5 k9 d& V
if (!empty($_POST['char'])){1 Q7 {. U- l$ Y; \! s/ r
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where " N3 ~8 `. _2 L2 Z

/ O; E: |/ G7 A! m5 P; s5 A: C6 {: Qm_szName = '{$name}'");
8 s3 a' R) s. v: U+ s/ kwhile ($row = mssql_fetch_object($find)){4 F3 t5 q0 L8 F4 t8 v% @
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";) W. z' i2 G3 u5 S2 K
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
& L; P; z6 W4 b1 L* T9 H9 \1 @6 X& t, k4 A
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
. d( e/ N) @) Z
3 n7 m3 T" K! M3 b[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', * h  k5 e7 ^+ i3 i
' [" z7 i4 N3 z9 v" W' ?. }" I; R
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', ! |# p6 e) x. V/ W$ [. V

; ^) o) a7 w8 }( p  L'{$ElementUpgrade}', '{$ItemPierce}');");, ~) p8 z3 {: F0 w' D& F
}
6 {2 G+ [. ], o+ Y, q' q
: J' ~/ L+ q- i9 U+ G, w}
( h# n& g! h" Z" ^
9 c$ _' U( D8 y% Z}
0 Z2 N2 r! @; F: H& u0 q; j- {: {$ o+ S2 A) n8 v/ F: ~
$InitForm = InitForm();
2 P/ P3 u9 k! }. }5 ], w$Listener = PostListener();
% H' e' c; U4 c; Y2 y/ `
$ v" Q$ X* p- q$ ^" |?>0 U6 O4 p# N6 E
" h  ~5 _; K& I3 f
6 W8 Z. K7 X$ U& ?9 k

2 f5 E, K5 |& C+ }' \+ B0 f, r5 r! \
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-8 12:41 , Processed in 0.066265 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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