飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1088

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1088
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php* z9 X/ \6 m: G* h
function Connect () {% }- G% w* ?+ P1 Y! m
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
8 N8 ?5 h! _+ f1 U6 T1 U0 f# t- s# e
Failed.');" W# X% P5 {/ U. H, F( k
}" W* d, y+ x# Y, V$ _
Connect();
1 n" E( e" }% N4 \/ ?- i
$ j7 L, j* H  C  o4 M: I1 }function InitForm(){1 O/ P/ r! j% H
//layout for the form
. g8 a" D2 Y$ f) L9 r2 A8 Lecho "<strong>Send Items.</strong>. {" P; H1 D- _, Y6 }$ L
<form name='select' method='post'>: @" S0 n; ~( c3 t
<lable>Character Name</lable><br/>; i; x5 }$ m- Y2 n
<input type='text' name='char'/><br/>' [# g1 Q8 N$ G$ A- ]+ \* ^
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>1 i4 p7 h, o2 U" G
<input type='text' name='item_name'/><br/>
0 p4 i" D) p9 f! p- W<lable>Item Amount</lable><br/>
' ^# _1 B2 b! D1 [+ S+ n' \" M1 L<input type='text' name='item_amount'/><br/>
+ F; ~3 G# d/ G. m<lable>Item Upgrade Amount</lable><br/>
5 R* ~+ U: }3 J# g" n- P- C<input type='text' name='item_upgrade'/><br/>! A5 P& d2 |* z8 i' j
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
' D8 P( g1 w' P; R2 C8 e: f5 o. d+ b; M
</lable><br/>
( I$ V* V# q( G+ \<input type='text' name='item_element'/><br/>: K" w5 E0 a$ N) J
<lable>Element Upgrade Amount</lable><br/>
7 Y  \3 }# U" H% n<input type='text' name='element_upgrade'/><br/>
+ j* w' u9 U3 v3 q' `<lable>Pierced Amount</lable><br/>% m( L0 N/ P) r/ M
<input type='text' name='item_pierce'/><br/>
  C0 c( }: B- {: b<input type='submit'/>
9 i( f- A5 @2 `0 h</form>";
3 ?9 a9 n0 _6 G- A0 H7 L# t}" g1 a9 F; a- B( r

+ q! O" _. X6 e7 Mfunction PostListener (){
. N5 D% f, H1 g4 t2 ?//Add more post variables if needed and add them to initform() function aswell
  j, ^7 d8 i' a0 j
  Z* z( W* C, L2 s1 E$ U################################4 k4 ~+ z) _" R
##### Connection and Post ####### ^3 y. j& W$ {; Q0 K+ D# L
################################3 u% ~3 B* c- y0 r* s
$name = @$_POST['char'];- M+ Z) l: |  T
$ItemName = @$_POST['item_name'];
- k) j- N3 i! e: W, ^$ItemAmount = @$_POST['item_amount'];
" d) G0 ]1 Q6 d, c) `4 b- T$ItemId = @$_POST['item_id'];
/ m+ w: _9 E$ J$ItemUpgrade = @$_POST['item_upgrade'];: r. k& E, B6 X
$ItemElement = @$_POST['item_element'];1 L0 t  R# b2 {, m: f9 I$ Q# ^
$ElementUpgrade = @$_POST['element_upgrade'];, R  d2 G5 h7 E7 f8 n
$ItemPierce = @$_POST['item_pierce'];( v. d1 M" _2 J  _
################################& Y# i6 |9 y! w1 `5 u
% K: P  P4 Y8 p8 U& J3 t3 ~' Y
//Check both variables for empty value
, e9 x( f, {4 E7 K7 Y) ?+ ~* n5 \; s+ d( H. J
if (!empty($_POST['char'])){
3 O& O0 y, J3 g$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
, y2 ]$ Q) B: S- d- t. ]
7 Q, r7 o6 B. Vm_szName = '{$name}'");' |7 @: n( s5 M2 N5 R
while ($row = mssql_fetch_object($find)){4 T  d6 W' [* t  W5 ?( g5 z. G: G
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";- r9 W! t1 o, G9 D3 p
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], % L0 V" n+ ^- K2 U1 u* F, [
7 {1 O0 a7 D* H8 P7 A
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], ! h7 c, Y( ?1 @
; G% s3 S4 x7 b) r/ I
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', % a0 ^" y; O6 |  _
) W& ?4 J7 q; f0 a/ x
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
: b+ E# a& S5 q6 H. B; Y8 F
5 l# k+ W& G" h& b. R2 E7 I'{$ElementUpgrade}', '{$ItemPierce}');");+ }: C) V3 x" F2 D% ~9 r3 U
}
! Y% \! H/ ^! I5 w+ o  v0 J- Y! S' C/ E3 Q
}* l- A+ {+ S4 n+ d/ z' C6 r
) M, ?. g* w, t; H
}
+ e6 V9 c) J, ?- W, y1 |2 V( h  _+ Z0 ?; O9 H
$InitForm = InitForm();
  B0 T2 S% A+ g+ Q6 v' i$Listener = PostListener();
+ r( C  q7 I) g2 ~, P3 ?6 l- c, Z! F
, H% H: o- C' B1 ?) l?>* N1 p% k/ }* q) W6 O8 {* J
' H1 u0 Q% Y. d6 ^% r3 @+ D0 Q
* |$ s$ w7 J* T4 o
% O: D, Z/ O9 \5 q. C  N

' ^4 d4 c' Y3 `. t9 ]/ c
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-23 15:35 , Processed in 0.104763 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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