飞飞世界论坛

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

物品发送脚本

[复制链接]

200

主题

203

帖子

984

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
984
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php: V- R, m2 E$ m2 }
function Connect () {# C4 G; o7 R0 ]8 C5 D5 R
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB # P& X) P0 Y2 P
3 x, f. G" A8 L) \) a% O0 D0 D. ?7 v
Failed.');
0 t1 i: @. T, i/ D* @9 ^6 d/ j" r- o}
( y$ n7 _0 g2 H! k! I; m# R6 OConnect();6 h1 i5 {3 m% n. V4 {9 p
+ K6 q4 I: j2 y" z2 @( ^7 q
function InitForm(){3 e+ }- i8 v  ~. y+ b  N$ K+ o
//layout for the form$ y( _" |) Z: l
echo "<strong>Send Items.</strong>
1 }7 p2 O2 u/ c) r<form name='select' method='post'>. F0 E! J) F1 `" c2 [$ h
<lable>Character Name</lable><br/>
/ `" V. U8 R6 O, }: X3 g) O* S<input type='text' name='char'/><br/>
- E' G) U: X4 _  F<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
8 e6 C4 x$ N) t- |9 B  R" N3 {<input type='text' name='item_name'/><br/>
! H; X( N' L6 M6 [9 [" [<lable>Item Amount</lable><br/>
6 e0 D7 t' k4 ?. g! g- ~# H3 M* T<input type='text' name='item_amount'/><br/>
" ?+ i4 J$ ^+ H& h( H<lable>Item Upgrade Amount</lable><br/>( J1 [' W! e+ p% A
<input type='text' name='item_upgrade'/><br/>5 }8 _$ n! L& T- C! O6 ]
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
" _; x& `' _+ Z( o% G8 k0 r
+ c& r: n/ `: K0 t4 g9 x- s$ t</lable><br/>
( w5 R0 v# Y! y: S<input type='text' name='item_element'/><br/>
0 w3 a! w1 ^* N) |<lable>Element Upgrade Amount</lable><br/>) P/ c: x8 t# m: f
<input type='text' name='element_upgrade'/><br/>) E* A$ t- l  y$ i8 |& C
<lable>Pierced Amount</lable><br/>; f! K5 C2 f$ a+ r4 t
<input type='text' name='item_pierce'/><br/>
5 [$ e0 k# H$ _% i( P1 H<input type='submit'/>) P) g" B# Y5 s. z- a/ b
</form>";
4 y8 I+ @3 s& a# f+ a}7 }! U1 Z6 A( o$ s) f
6 g9 l; g& b, B" V/ @4 W
function PostListener (){8 H# E1 i/ M4 d* F1 R, P
//Add more post variables if needed and add them to initform() function aswell
' U$ j* @: S. ^/ z! C( Y3 Z+ C7 D+ R7 I5 [
################################
+ _" }0 H: U1 m0 S( _) p##### Connection and Post ######
, `( f  a! }' y. ~+ C################################
, @2 S! P: O4 C* T0 {$name = @$_POST['char'];
! c( S$ I- Q% i! W/ ^$ItemName = @$_POST['item_name'];
  Z3 P( d3 H) g& v* B$ItemAmount = @$_POST['item_amount'];6 j) q5 X0 Z3 |( ]
$ItemId = @$_POST['item_id'];2 C; G( ^% ^/ i1 [% Q
$ItemUpgrade = @$_POST['item_upgrade'];: U# M; Y. b, }$ x; y
$ItemElement = @$_POST['item_element'];
4 k( [3 y2 I/ S) b) \4 e( D$ElementUpgrade = @$_POST['element_upgrade'];
3 i  \( ]9 c! o1 X: u! k$ItemPierce = @$_POST['item_pierce'];
! g, e; q# e: V' A+ y+ |################################
* ~2 T7 _1 ^5 _1 b, a( z
2 C% G0 |8 d$ ]( b8 \0 O//Check both variables for empty value2 f5 s1 W; w! M( n) ~- t' p

: R& j1 h8 q. f; B7 d. Tif (!empty($_POST['char'])){; e7 Q( T- m: ~9 Y/ x6 Y
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
6 c: h5 i: O$ b3 T& J/ E6 R, ~" f
( \( f! H1 k& G/ ]/ _( lm_szName = '{$name}'");( D! p' S8 R4 x1 o% {7 N3 {
while ($row = mssql_fetch_object($find)){
( Y2 F1 H3 S( j" }6 F- D6 N' Fecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
/ b. X  U9 N* K$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
; r8 Q6 h8 i: Y- T$ C  D$ h
; C) U( b% f  i% j+ F# t* q[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 1 K6 H  W7 |+ D$ b+ u

. e" m" ?6 F5 q- w1 b- m# j2 `' S[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
8 G! Z6 {: |( C" l$ z$ C! H# Z
2 O4 I7 y7 M' j( E% `" vN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', , x0 S9 Q& r( p0 y; L% o( X

& B% j1 N: T( N1 R6 D7 C'{$ElementUpgrade}', '{$ItemPierce}');");
6 x, o/ F! R* O5 U9 p9 y! J}* z0 S. e* ?$ P1 {# b) i! y
) G7 r8 l! X# h0 D
}' o, r& X' c2 g) |
7 s* h7 e4 P  N: W
}* @- ]7 C0 G, {+ f1 j* B

. \3 V. B6 \7 Z! ], k' A7 g$InitForm = InitForm();
" F# r: o$ o- u0 }" H6 w$Listener = PostListener();' U$ I1 h* o0 d1 H) g7 |* I' O

4 U% ^" z# S* ?+ n# y1 K0 K?>8 T* s! b0 i! P. K4 z9 n2 b; t
7 J* o9 W/ H; i# n! T

# |+ R/ m& e  [4 L" c/ J) f# f3 Z3 C) G& i4 w" X; Z/ K* x( v1 v
# _9 T. r4 d6 R8 Y
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-19 08:01 , Processed in 0.097452 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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