飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php: s! L7 ~7 c  L" L  Q3 \
function Connect () {
: I# s. p" r2 |; Amssql_connect('Server','UserName','Password') or die('Error: Connection to DB ; h* z4 _  O$ e" H" v# N

+ M" F; [8 L, a6 {3 e, qFailed.');
5 t/ h7 z7 t" K}
3 ~2 ?; H, C5 I3 M+ v8 JConnect();
( b9 y1 C; R8 [2 |$ X2 [( k* b: L" f( K, }& S; [
function InitForm(){
7 Y' j# O1 t( E3 l" I& T1 \! T& ]6 h//layout for the form
  T# w" L7 V0 f1 ]/ g2 iecho "<strong>Send Items.</strong>
6 Z  Z9 y. U, y. }<form name='select' method='post'>% N. Q" f2 K$ G& d$ j9 c! v) X5 w
<lable>Character Name</lable><br/>
% A5 Q* R4 C7 \- O* i5 P<input type='text' name='char'/><br/>- [/ q+ K! a. Z9 m4 `
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>$ ^  W/ B1 B2 t3 n2 m# j
<input type='text' name='item_name'/><br/>
/ J7 l- Y5 }0 F<lable>Item Amount</lable><br/>
& K8 u. c+ a" t% d: a5 F<input type='text' name='item_amount'/><br/>
" T3 z5 W/ D3 H<lable>Item Upgrade Amount</lable><br/>
8 o7 `, Y- K! `: H<input type='text' name='item_upgrade'/><br/>$ ?; [4 u! o+ r0 j; S1 i
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)9 E6 s) d: d: G: J: }& L& R6 ^

+ @3 ?) D( G, [* [1 B! o; v$ K</lable><br/>
" q( x; T( u$ S6 `* D- s<input type='text' name='item_element'/><br/>
+ s- Y2 [& N8 B8 g- ^4 z<lable>Element Upgrade Amount</lable><br/>/ X  H9 r/ j, Z- b7 t
<input type='text' name='element_upgrade'/><br/>9 ^, b7 }% q6 ?% h% N+ p
<lable>Pierced Amount</lable><br/>( u; {- l. O6 J; D6 ~# z
<input type='text' name='item_pierce'/><br/>! s" d; w/ {; [- h
<input type='submit'/>
0 ~$ y) `  i9 h' D7 p: `</form>";
. n! d6 b% x! u  m}4 x7 I4 ^$ }7 Q4 U0 |$ D

4 B/ M2 ^& B  W( ]2 ^5 V1 yfunction PostListener (){0 X* `/ s8 n4 j' x# M0 N9 v; {
//Add more post variables if needed and add them to initform() function aswell
9 o0 X' h* ^0 s+ B
, Y3 Y4 W2 W' Y% t; @1 u################################
$ Q: E9 U' d* m: x1 p3 n$ U##### Connection and Post ######
" \- x2 q' {$ S3 A+ l! n1 w3 A################################: u# j7 I0 g; r& Z, D7 R
$name = @$_POST['char'];" C2 e6 E9 b2 Q5 S& w
$ItemName = @$_POST['item_name'];, z6 M! P" W5 E$ O" q1 p( x6 n# s
$ItemAmount = @$_POST['item_amount'];
6 C/ m3 l% ]! l: O$ j$ItemId = @$_POST['item_id'];
" e) C( O6 u# P4 Y8 m' O% e  S1 I; U$ItemUpgrade = @$_POST['item_upgrade'];
; G9 [0 [1 t1 X! n3 c$ItemElement = @$_POST['item_element'];
& k' ~, r% l( P9 b( L$ElementUpgrade = @$_POST['element_upgrade'];
$ u  g5 R. g) |1 w1 R! S! n$ItemPierce = @$_POST['item_pierce'];
4 |  X, A' r" \% b$ m: O################################
( |4 P4 \1 ^1 h' x% P& `; U" E! F" [' U- `/ U1 f( B1 ~* R
//Check both variables for empty value6 J; d* J+ U, A: i& R
3 t! O9 S4 I8 z" q
if (!empty($_POST['char'])){) z( T# f) t- J% y% u' Q2 N
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
2 Z7 A2 Y. @: d9 ^, E7 M5 H& |
7 k! _2 ^% i) B# C5 F0 j' Q1 sm_szName = '{$name}'");+ y" I0 s2 P* G( r2 l5 p! K) z
while ($row = mssql_fetch_object($find)){3 w: y# I) z% `
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";* t$ E) F, Z0 ]
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
" V* K3 v2 {: O" ]. i+ o5 x( H, T7 ]! o; k5 g5 d
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
3 z/ ^4 i' y9 X, @0 Q7 G
: w0 k; u; G1 G) C$ \2 R* r[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', # K# f3 U$ M- i* F3 ~
: e2 F, g# w9 ]+ N. {
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
( T! k+ U2 P1 [' T" d% L, p: k" `4 E6 O" S5 A3 U" x$ D9 q
'{$ElementUpgrade}', '{$ItemPierce}');");
( Y; ]! k1 U" ~% t. E}' ^- F( y; ~4 ~6 S% ~: ?6 p3 R

) z# O1 Z1 X2 E+ u) w; B; o}& K, C0 f% R3 H# N4 T7 E

& ^& \! ]$ W, }6 G}/ x) ?8 Y' x2 H) V8 ~. a

& |$ D7 {! ~& k6 x6 E9 E! G4 k  J$InitForm = InitForm();
3 X9 H/ R! ?2 }  c3 ]8 w% o, F$Listener = PostListener();
7 A( k2 W( n: i
; N$ _, F5 B' Z0 U9 g5 J) I?>
# K; m" b# _) n5 z! g
7 X/ G0 A# E! g% k8 j5 }% ]' C6 B0 ]9 x' T, t; j+ D. S' C+ f

( R) x+ ?8 s3 m5 W' r$ x8 B
; `: ?$ s& _7 B" Z- u
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-31 12:19 , Processed in 0.068772 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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