飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
" X7 S) r0 i( [( \function Connect () {- i) F/ k; q6 w6 s8 d" j5 v* w  E1 H
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
! ~( x7 _& H3 @# m3 a" |) s. {* @  t/ \) P0 P! e7 w; Z$ c
Failed.');1 C' k) W$ X7 ?& c/ g
}
# A. j8 k. a. M3 f( q! x( \Connect();
* S3 ~0 B, G& O- |! h
$ X9 p1 [& P0 w( z( f0 Wfunction InitForm(){
; T# f$ U' D% Q' b) a/ i3 `1 `: |//layout for the form
/ J- j% }) U) B# b; oecho "<strong>Send Items.</strong>
8 C1 r( a. [; t1 p- y- _2 m6 Q<form name='select' method='post'>
( |& O: x' I0 ^<lable>Character Name</lable><br/>2 p. Z; c) C. M  `! ]
<input type='text' name='char'/><br/>
/ c8 F( i! J2 g4 `  C<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>/ o$ |$ Z% G/ D. B! g9 J3 D) x
<input type='text' name='item_name'/><br/>! x% Q. H1 w% f5 q
<lable>Item Amount</lable><br/>: B5 p1 C9 G7 j8 t2 p- y7 a, W  r
<input type='text' name='item_amount'/><br/>
% m& k" }6 z9 ^4 T/ l<lable>Item Upgrade Amount</lable><br/>
6 T8 c. x- ~2 `& g  Q<input type='text' name='item_upgrade'/><br/>
2 n/ }! d0 I$ I<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)7 [/ n/ r5 J- ~; J: V

4 L7 }( g) I) L  h( c</lable><br/>
" P" c& y9 q* J( E4 s; S<input type='text' name='item_element'/><br/>% `5 F2 c9 l, M- k$ u: Z
<lable>Element Upgrade Amount</lable><br/>
' b* R" B/ c- L) A<input type='text' name='element_upgrade'/><br/>
* c. D: C5 e# B* G' e2 ?1 u<lable>Pierced Amount</lable><br/>  Q7 t* b3 b; @; N. ?: X, O+ p# N
<input type='text' name='item_pierce'/><br/>* H& s% s8 N4 v. X% K' D$ J7 v" X
<input type='submit'/>) w+ g7 M& \% ?2 U" X: f9 }0 I
</form>";. t5 S& v; N' Q' M. c* ~
}2 `9 z" b' Y( n

9 a, x/ [. R* x, Y- Pfunction PostListener (){  j- n: V3 F( \. o. I& A$ n
//Add more post variables if needed and add them to initform() function aswell+ k; v% \$ R% R+ w

  C3 u/ i: O# V' q% O1 y9 b+ u9 y################################* |3 f# S, o+ l3 [
##### Connection and Post ######) x4 B& G, s8 q
################################
/ y$ k0 ~8 D/ q# D3 W$name = @$_POST['char'];, c8 G, c0 l2 R( Y  R6 n- F
$ItemName = @$_POST['item_name'];
3 a  `7 _) ^* N5 s5 W3 O. }$ItemAmount = @$_POST['item_amount'];
' U3 C* a' `/ P* U: U1 b* M$ItemId = @$_POST['item_id'];
. [" `! ~: y: v  {/ Q3 U( i( N$ItemUpgrade = @$_POST['item_upgrade'];
0 O/ R' K! `! M0 Q0 W$ItemElement = @$_POST['item_element'];+ p& f) y7 W& |6 \, N( `( H6 z9 x
$ElementUpgrade = @$_POST['element_upgrade'];4 p. J: h7 }8 i, m8 ^8 c8 B+ }
$ItemPierce = @$_POST['item_pierce'];
: k- m9 j  l% e) _6 p4 j################################
2 n) `# {1 V. ]* Q2 G% k
  V, f* |  \7 I$ E4 |//Check both variables for empty value9 U' E2 e! N: P* {3 b& Y) U

# }' h' ]# b5 g8 ~8 X# Zif (!empty($_POST['char'])){* W% i9 i7 Q3 |/ d6 M3 n
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
: i0 ^9 D) i# `+ c: J, G. S( B8 [2 z" \+ ^
m_szName = '{$name}'");- }# o4 ~; w& h$ F  ~7 }$ a
while ($row = mssql_fetch_object($find)){
2 m+ x) u8 w3 [! B. z" `echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";1 q( _) n5 Q! g1 V# Y# ]; s3 ~, a
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], ( Q- |9 }7 O  S: E1 }# G

3 a  @0 R3 Q* w1 t* w[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
. t$ |* Q4 k) y* Q$ i$ f  Z1 B+ X. y6 k4 ?" Y5 |
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
5 U  F; T1 L: N
! _* o3 r" ~) J' l4 _$ _6 h  ON'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', 1 T* s* x1 q! r6 O0 @( W

9 T) l. M5 f( ]1 K7 Q'{$ElementUpgrade}', '{$ItemPierce}');");
% w2 D0 G7 s& M- Q}
8 r/ G  B7 c" a  N% G! U
( i& [2 y5 ?! Q5 c}
' p# \2 T4 K" T2 M6 ^6 |. ~
. X' I' T, \$ [' [' y" J6 T, ~}7 ]) S+ y8 x! J3 r& I# @

4 {: R* q: O! ]' k3 {. _5 v$InitForm = InitForm();. @% c5 Q2 F2 ~% \' u1 N1 i- y- k/ t3 X
$Listener = PostListener();6 [1 V/ j3 l1 ^. J' _5 T5 b

9 h. k" J& f5 r5 L0 x  ]5 V! _4 y9 P& R9 s?>
7 O  ?: R) u2 G: i  w! y
* \! c/ I* f- T- K- G! @( w0 b, l- t; R8 u2 P  R

+ A& }4 Z. {* [) j) |9 S
  J" t; \( o- r0 a7 y. Q
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-27 06:32 , Processed in 0.068028 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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