飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1064

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1064
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
; M( |! P6 U2 e0 m% ?8 A' s3 ~function Connect () {2 n' |3 a: u( E5 X6 h( V. X
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
$ ^) ~4 S/ [! R: i
2 [( m% S& u& TFailed.');  H& I  R5 ]* B7 x
}: X9 W! |8 G  i5 H
Connect();+ ~' ^7 y! \. M* a: j9 V
" W8 P2 ]7 O( \: b0 x. T( g
function InitForm(){
) T1 ?, h8 i( p* ~* |7 w: t//layout for the form
* B6 J& B! z5 u# p4 ]4 t/ Techo "<strong>Send Items.</strong>
5 Z) ~3 `4 |' {4 j<form name='select' method='post'>) J' a* b. K# e6 _, a; E$ _* R
<lable>Character Name</lable><br/>, n% i3 U& O* D, A5 n
<input type='text' name='char'/><br/>- F- R4 D" n3 \  M3 F
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>6 d0 a3 ]2 c' N
<input type='text' name='item_name'/><br/>: U8 q& {2 E4 T
<lable>Item Amount</lable><br/>* P5 U) P+ ^2 c% j
<input type='text' name='item_amount'/><br/>% O  V  G8 k+ a4 O/ c
<lable>Item Upgrade Amount</lable><br/>
  R: L* c% _" ?" z+ U7 J7 ?<input type='text' name='item_upgrade'/><br/>
/ J. u1 l* y4 I$ B! `<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)& l0 r1 P! K/ `. q; T0 w$ l
4 r* l$ ]. b8 J* ?4 K- Y$ ^. U& ?  m
</lable><br/>
% A/ {  m; h9 @' S! ^<input type='text' name='item_element'/><br/>- @' X) x) Z/ y" m6 |: W# D
<lable>Element Upgrade Amount</lable><br/>
' @( w1 B6 {9 I6 P<input type='text' name='element_upgrade'/><br/>2 @3 j, s& j4 S* ]8 y3 \
<lable>Pierced Amount</lable><br/>
9 M, e+ t- U! x<input type='text' name='item_pierce'/><br/>, d. ~8 P% E& ^$ F* m( V4 h
<input type='submit'/>
2 d+ n! t+ v  F7 c</form>";8 i# Y" l3 j8 A/ o7 w* r5 H5 ^
}2 U1 u$ c( r) _; p6 k( v( {
0 Y+ x+ L6 q) y% d
function PostListener (){
2 ^& V9 F4 _* f0 t//Add more post variables if needed and add them to initform() function aswell9 l' m4 z2 U& t; @

( s) n% S! H1 o################################. b3 T9 [) L/ S+ I2 [0 Q/ t
##### Connection and Post ######5 R+ I3 w$ z2 V' Y$ d3 F
################################
+ X$ _  }, d( S1 S$name = @$_POST['char'];
1 h9 u$ M, z, i$ItemName = @$_POST['item_name'];
' E5 `. J) C8 Q3 w5 g6 N$ItemAmount = @$_POST['item_amount'];3 N9 G- d% F; b
$ItemId = @$_POST['item_id'];: N9 L; w6 ^) r6 d5 m
$ItemUpgrade = @$_POST['item_upgrade'];
* N  E- p/ F$ I# D* u4 U$ItemElement = @$_POST['item_element'];, k/ Q/ g6 z$ b4 ~. y
$ElementUpgrade = @$_POST['element_upgrade'];# R; x/ E& Y2 K# I
$ItemPierce = @$_POST['item_pierce'];
# m& E1 Z7 o5 N9 u################################. v% c6 q. s3 O  r" E

+ J7 [3 R5 f2 t//Check both variables for empty value
3 j  ^! D; O3 u, B& U( S& E
8 s7 ~+ o# I) _2 R& s+ p$ p7 vif (!empty($_POST['char'])){+ Q; K' E* {/ p6 m) Y
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where 4 ?6 |, c& K8 J+ k. @. Z4 y8 I, k

3 h. m/ Z! O, S! d. em_szName = '{$name}'");; l; I6 J4 s5 P+ X
while ($row = mssql_fetch_object($find)){& N" Q1 K; c- k/ X
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";& ]! e% i5 y4 K. H4 W5 v4 y, l
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], ' d6 l1 P- v1 Z2 A

- R. L) a, N4 l[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
+ X* W# o6 S7 F8 V' N9 b% F$ s- `
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 5 l( o4 w' l* Z% w" M  B; I9 }. j" }

. L  x3 y' `- Y( i3 c; |N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', ! F8 [. e$ q' d- H, P$ X- m3 v  T
, |& r5 x' i; n) U, i
'{$ElementUpgrade}', '{$ItemPierce}');");& `) {; S. R0 P4 `; X
}! m" b- ^- z7 H; r

5 K9 N8 O# ^. J0 T: o( x}
& A' W+ t$ T, X2 ]3 d6 ]3 z" x1 T2 a: e- S+ s
}  ~# ?7 H# ?+ c$ H
# Y6 z' C2 W# K0 c, d
$InitForm = InitForm();
! Y5 A" [9 F  J- H' l. Q" j$Listener = PostListener();
* c- T0 ], ~+ C+ S2 d
- S5 ~0 N% k  F- ??>
6 @& Y; a4 x# @. v  u; o
/ n" D5 n" E6 N4 S) A3 V9 L, U# Y$ D4 `. c" }/ F( Y1 Y
1 d! P: l( k! H. u  I3 F

0 q" T+ W4 ~7 {9 w# B2 r/ U" C
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-7-2 09:50 , Processed in 0.066255 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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