飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php2 L/ i. Q$ I& q. D
function Connect () {( ?. {% F9 A- ]
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
) n# g+ N0 n4 t9 z- }
5 @; s* l' n" P, E6 W; ?$ z" W* TFailed.');
# Z3 q2 [# X" U}
/ P6 r& b3 c! F  ~& x& T! X2 u& _Connect();
" o" b# u' h! C( k
& h. c8 X* c& ^5 e% ~function InitForm(){
4 f. s3 q, X4 B- q% Z//layout for the form
4 E1 G! q  y4 P/ d- Z+ Z% v* ^; ]- kecho "<strong>Send Items.</strong>
! R6 \, y8 x& T<form name='select' method='post'>
/ r7 a3 W  f, f5 I<lable>Character Name</lable><br/>
! l5 [5 g7 V: z1 ^- c3 n<input type='text' name='char'/><br/>
0 G' O* F; ]4 o5 f9 b3 c<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
' U+ h" Q& C8 e# T4 A4 F( ^( Y0 Y! n<input type='text' name='item_name'/><br/>
( f/ |9 W, i+ O8 l<lable>Item Amount</lable><br/>
) u1 c0 i+ y2 D+ e<input type='text' name='item_amount'/><br/>' n; J5 d+ K/ u; @$ x, }; \
<lable>Item Upgrade Amount</lable><br/>
1 k: Y& s5 t% |4 A' F# q# m<input type='text' name='item_upgrade'/><br/>& h+ m1 h" V# {% H
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
; H" _" Z  b' o: z) _3 e2 m0 e- \% o
</lable><br/>! p" a/ V3 o1 m# s7 J% W
<input type='text' name='item_element'/><br/>( Z  j! W% |/ g# _+ Z* Q5 y
<lable>Element Upgrade Amount</lable><br/>3 ?* r7 g" X1 _+ l
<input type='text' name='element_upgrade'/><br/>! c% H/ h2 g/ d" ~/ ]
<lable>Pierced Amount</lable><br/>
' Z" w) p# Y# B1 |4 D  C<input type='text' name='item_pierce'/><br/>
) M5 y( Z& t$ U3 |; F! X$ y<input type='submit'/>; [! s; v2 H6 Y% v1 X, i4 ~
</form>";- J5 u0 x; o# ~' o9 A& l8 j  |* T
}( n* a* K1 o% W5 ]+ Z) I
, L# Z. n2 A. B& f; |6 [
function PostListener (){
# r0 r# B( p1 e0 l2 W//Add more post variables if needed and add them to initform() function aswell
/ f0 u( P6 r. ]8 h! \+ \
4 @; ?6 g7 ?9 C  L3 k' a################################) w& c( f  v* i$ r, T& F" j
##### Connection and Post ######9 F" q; g$ N) i3 \- P- N
################################
! \  g3 M2 q5 f: p, o6 b0 d5 o$name = @$_POST['char'];
2 v6 s) e: r* K* v; o* X7 N$ItemName = @$_POST['item_name'];
9 ~5 {0 P, f/ a$ItemAmount = @$_POST['item_amount'];/ s( k, {$ w& U- {: G: l
$ItemId = @$_POST['item_id'];; }! F+ a9 t" B1 N
$ItemUpgrade = @$_POST['item_upgrade'];( h! U, x9 B2 z$ g! p/ r1 Z( A% H
$ItemElement = @$_POST['item_element'];
$ v1 D# T. Y4 I$ElementUpgrade = @$_POST['element_upgrade'];
0 B$ ^1 Q' j) f" [+ b$ItemPierce = @$_POST['item_pierce'];8 U  Z5 x3 _0 f- Y7 e
################################! s6 h2 R* B; a+ [8 h8 v

/ u5 _+ B# K+ F, T3 ~//Check both variables for empty value- I% t0 M! w1 u

: I; J" `- N( r6 Dif (!empty($_POST['char'])){
$ i3 a- }5 b& Y! ?8 A$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where ( a. y. S% `4 P: Q! u

, Z7 S& J  q% g9 t( E# C% M0 Rm_szName = '{$name}'");2 i+ x/ s( p* r+ X3 l4 b
while ($row = mssql_fetch_object($find)){; \( u9 p1 a+ J; V
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";- a0 @% w( \9 T
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], ( U8 u+ T5 c2 x; h" f) k$ j; ^
5 M) A3 c: z0 B& @" n8 Y( d( S
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
& f% i1 N. {- W7 A# n% m' ~3 K0 V, ^6 a1 f$ f
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 3 j, b! }5 I% T/ m4 r

8 q/ j5 y- w% k2 d1 ^N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', 5 N2 c' c' J) }1 P: r. ~2 C

0 W0 q9 e( ?7 Q$ @'{$ElementUpgrade}', '{$ItemPierce}');");& C" Q/ X( Y# R2 P
}* n5 V# S! w1 `6 j2 j: @
$ P7 Y/ \& r" C; y! M9 g
}* d/ o, ^: Z5 a6 q1 _! {: z; w  w8 r

- `9 A6 M' N: \}( J6 b5 s: I/ w4 @
4 p6 e4 T3 V" A' C% c$ Z" H
$InitForm = InitForm();
; A/ d* d8 e8 X7 I- O! {! d$Listener = PostListener();
2 b0 c( F: o7 ~- Z# R1 f: [+ X. m3 o3 Q& c" G. j
?>
% T7 p+ i9 f3 K, I; C, O! k4 N. r7 u8 t4 @" S6 \5 {8 d, M0 v3 {. U
; w. J# g/ g8 r' }+ ]" O! ^
2 x5 d& Y: N  X6 N) F

$ ^5 |  `8 y% B7 X4 E, R
回复

使用道具 举报

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

本版积分规则

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

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

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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