飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php+ @: S% T: M7 `6 C$ i8 R6 \
function Connect () {6 G% }& g3 V* a; _4 h0 w7 G
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
6 y+ q/ e7 ~& @  C7 ?! L0 G; z
7 G' C( S5 q, [9 o# h0 X8 VFailed.');
: A0 r2 E1 s2 g; K6 b, O# k8 J% X2 m}
# _; F% @$ L1 p1 L' Y! M" xConnect();. N% ]% M3 Y4 O: e+ R2 c

8 {1 j' Q. ?* ?" I8 Ofunction InitForm(){0 n/ H0 b" ^- B8 D
//layout for the form
2 y6 y2 Q% @' L, K+ Hecho "<strong>Send Items.</strong>. ~- h' M! P) S/ v; R
<form name='select' method='post'>- N6 C- Z! M6 L& _
<lable>Character Name</lable><br/>8 p% @! u; Y8 Z
<input type='text' name='char'/><br/>
5 k+ m. q5 d' D- c7 Z0 i! D<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
- b  \: r( j8 ~<input type='text' name='item_name'/><br/>1 c3 I  G: _! I4 ~: \
<lable>Item Amount</lable><br/>
& ~; H" N1 j$ T% l, x6 b<input type='text' name='item_amount'/><br/>2 l2 `, N! ~! ~0 O6 W
<lable>Item Upgrade Amount</lable><br/>
6 e) t% S" b. D3 X- x<input type='text' name='item_upgrade'/><br/>' a' Q+ t/ s3 c# a1 V" H" \3 o
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
3 C3 I- G( E% N, Q( `  E7 v( s. w5 r+ G  Z, ^
</lable><br/>8 A7 B$ r  X# Y- I% R; v
<input type='text' name='item_element'/><br/>
8 ?2 Y* V, z- g1 L& w9 p8 q& g  O<lable>Element Upgrade Amount</lable><br/>
4 t6 l& a1 `3 S9 e3 B<input type='text' name='element_upgrade'/><br/>
/ X0 L4 N( q/ [" \2 v<lable>Pierced Amount</lable><br/>0 _- ^* o  J  T- W& U/ g
<input type='text' name='item_pierce'/><br/>8 R5 j, l& P$ b1 z! F, u
<input type='submit'/>9 K) }! ?9 g" Y* T: @: s( z& S4 v2 a
</form>";+ z3 Y4 y+ i* _
}
) u6 p2 ~# H  W$ S6 g2 t' _; w% A2 @8 }* k5 V, `
function PostListener (){
5 r! C7 @# h' N# n* `" J2 A* r' A# ~9 M1 z//Add more post variables if needed and add them to initform() function aswell1 H1 I" `: q) j$ ?3 B
- y2 L& J6 i& p' B
################################* d& D9 H+ W% y3 U5 s" n
##### Connection and Post ######
$ c1 f0 R5 {8 X* A% _################################& ^+ f9 `3 k6 w5 B
$name = @$_POST['char'];
/ F" `6 ]& `9 ]8 b$ItemName = @$_POST['item_name'];
1 Y# U, s) _7 f7 T1 D$ItemAmount = @$_POST['item_amount'];1 T' M1 A3 X! t$ c& ~3 D
$ItemId = @$_POST['item_id'];" B9 S% b* K% C5 [
$ItemUpgrade = @$_POST['item_upgrade'];
( [% a% O' t' t- a3 S/ \$ItemElement = @$_POST['item_element'];
% {# `1 S3 d. L2 z  g( U$ElementUpgrade = @$_POST['element_upgrade'];; G/ B8 I" ]+ q- j! E% U
$ItemPierce = @$_POST['item_pierce'];
& ?2 Q; E* _  d2 O9 ^################################0 L& ~# w* h" r6 P

( P5 o2 S$ h. R: ~; F% s//Check both variables for empty value$ y  A1 N9 \+ g( Z* w+ k3 a. ?

! Q) s8 ?( J% I9 Yif (!empty($_POST['char'])){% L" `; |% z7 y1 `' x9 a: l9 n
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where : V9 v1 \5 n4 H; F7 o. e4 A

$ N9 W: m$ Z. m) A# G$ e) f! B. ]' Km_szName = '{$name}'");
. I) k. @3 L6 Q) }) Twhile ($row = mssql_fetch_object($find)){2 N$ U! n9 f3 s# @9 z$ F
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";6 q5 _1 ?$ h: ?
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], " A( _+ B& o  s: g+ I2 J
/ U; B  O+ ^& s( D; z
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], % W$ y& L4 S2 g

/ I1 F# P# p$ s* K[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', * ?5 Z$ y) `$ q" Q$ Y/ t0 V

, C) T5 y: Q: kN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', . C& S5 b% K2 Z3 j9 V& X& j9 c
7 @- E1 A6 d0 W+ o/ M
'{$ElementUpgrade}', '{$ItemPierce}');");
* ^9 t; D5 y# Y}( \/ _% `* ]. ^% e* j% P
  s5 P4 m+ W8 E6 A# q. H' c( w0 f
}0 I& }6 j- v4 f* F& v" |9 l
. Y9 Q/ E( F3 R6 G. D0 [0 M& D# ~
}4 R) a: `1 Q/ _4 T! @  L
; T5 i% [$ L; c/ d  m3 q! s2 b( G
$InitForm = InitForm();% K3 O9 N" a* Y& ~8 B: y
$Listener = PostListener();: q$ y$ Q5 T4 |! N

& I7 b# U) |! J# E- ^* ^?>" h0 U+ ~; M+ m1 U' ]8 ~
8 J! T. u1 i" ]7 g) M7 J4 C$ L

5 Q' |, T  H; k8 R5 v1 C4 V
! \1 |- w* K6 H1 w/ ?' \8 `' [: x' ?6 y8 c& J4 n. \7 q  @) _
回复

使用道具 举报

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

本版积分规则

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

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

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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