飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
<?php
' p: p3 f, W8 a$ [function Connect () {
3 N" f" z7 q' r7 E. omssql_connect('Server','UserName','Password') or die('Error: Connection to DB
/ l; M8 I4 q+ d  A/ c$ p5 ^: b; S! ^3 i9 M. K6 ^
Failed.');
. q, H8 H) c& r2 l& S& y}  {4 V) P& _+ Q8 |
Connect();* L9 l$ Y0 J: g+ h0 J
. S5 S* X" |4 ?
function InitForm(){& m5 V, s0 x" a+ b' w) e
//layout for the form7 K9 A9 c# p9 j
echo "<strong>Send Items.</strong>' o3 Y; M2 I6 k! _" z9 n" c8 t
<form name='select' method='post'>
) a, z5 z, Y) N4 Y& c<lable>Character Name</lable><br/>
# d6 y* g' ^! g+ v<input type='text' name='char'/><br/>
  u6 f  n9 [- D, x& A0 b; b% C0 C: r& }<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
$ g6 H, z; r0 Z  c7 u3 A7 C( w<input type='text' name='item_name'/><br/>8 i- T3 u3 W. C1 p: j2 G
<lable>Item Amount</lable><br/>6 S1 {8 l& [( Q
<input type='text' name='item_amount'/><br/>$ N: D7 I& e* w% {. B
<lable>Item Upgrade Amount</lable><br/>
! Y( r% z0 q- l' W<input type='text' name='item_upgrade'/><br/>  T2 I- }. D' q
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)" x) A$ `' C! M+ @9 ?3 R

6 Y3 s# c* h( c4 }% u9 T; P</lable><br/>
. T' n9 v4 C% Y! e0 A5 T) l& ~<input type='text' name='item_element'/><br/>
0 D' `0 c( \& o) d) x) R  `<lable>Element Upgrade Amount</lable><br/>
2 g% D  x# P) |$ e. b/ q<input type='text' name='element_upgrade'/><br/># A' X6 O6 q4 Q; D
<lable>Pierced Amount</lable><br/>4 b2 s, t2 ~2 h
<input type='text' name='item_pierce'/><br/>) Y3 P% J, M6 Y1 D- ?
<input type='submit'/>
6 J5 n2 Z7 [  w1 L# e, Q+ l</form>";7 p$ L- f6 @4 `: E
}
! U" ?) q; Q) w- {4 W* \
; U: g1 [  f& g' D6 Z# ~# [function PostListener (){
3 `7 i; T9 I% E6 C+ ^3 m1 w//Add more post variables if needed and add them to initform() function aswell# `- k8 l- O5 t# V
$ D9 d  B- [  j( N; Q2 |# ?1 p
################################
3 r6 x" i9 f  _- p##### Connection and Post ######
% S7 T0 Q! \! o) h4 `! o/ l################################6 M8 e+ T$ t+ E7 {, H0 Z" b
$name = @$_POST['char'];
7 ~% o. _. z8 |$ItemName = @$_POST['item_name'];3 ]4 y2 P% M& \
$ItemAmount = @$_POST['item_amount'];6 p' O) V* f$ N
$ItemId = @$_POST['item_id'];
' x/ @  [$ G& |$ItemUpgrade = @$_POST['item_upgrade'];
, t/ L" K. r; G3 r, P" u$ItemElement = @$_POST['item_element'];! t9 N; @2 A( F. v, z5 h
$ElementUpgrade = @$_POST['element_upgrade'];
8 s) D  m' O& ?6 A1 [' x$ItemPierce = @$_POST['item_pierce'];
1 e$ f. m, W5 U( L" g################################% D- A  z5 S% t; G

* I* l1 L: ]4 I9 p//Check both variables for empty value5 S* d, t, [) q1 B0 I0 y
: g. F2 @# P% Q
if (!empty($_POST['char'])){! i" \/ L2 \& j( |9 P" Y/ }
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
4 Q4 \- @1 d$ W; x
8 i! L2 w! q' i, S9 N; r0 Ym_szName = '{$name}'");
* P( K/ }8 ]; V2 ?& k! gwhile ($row = mssql_fetch_object($find)){7 v( c9 a3 E& G% Z
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";4 v+ P) B3 M: z) r/ z
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
; s, S/ M' O# h4 s
; N( O1 ?7 @2 r: q$ i0 {8 c[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], : W  K3 k9 T" g

8 P/ C# j! K# I3 w# P. B3 t* V[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
% X) g. L% @0 P) J. n" S- \( V- ]) S9 l6 `; ]6 T
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
' U2 t5 N4 q" N2 S+ z+ k
6 h, n( K5 f( ?* D'{$ElementUpgrade}', '{$ItemPierce}');");
6 z8 @$ E* C3 X4 h}
0 H0 D4 c+ r- Z( x( M6 p
1 Z5 R0 e: T. G& b  E  l# P}5 ?& q6 W; q, B' a
6 X5 p& l5 D0 [
}
0 m9 O% J2 F4 \2 Z+ K% G  G! F. D' A$ l: }" H4 P. G4 x
$InitForm = InitForm();- O) q3 s2 g) e3 _6 S% P, n# Q0 {* z3 w
$Listener = PostListener();
: q! b2 D+ I) w3 y! @& X7 G9 E; K, y1 X
?>
& g* d: p/ I( F" |$ T+ x5 N5 X8 C+ F$ c% C
* W, b1 h" p: A# I# A# B
- s9 B4 `, \8 ~9 _! v, ~! c

; b/ v' L* o7 J7 M% v) L
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-10 19:56 , Processed in 0.060993 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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