飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php! s5 h3 K9 R+ s+ Y& x+ Z
function Connect () {  v$ h% |) l' f' o. x: `
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB   s* n- D1 Q( o0 o' |( S! s  x
3 M' @, s8 c' n  L: |
Failed.');
2 w2 }; y7 K) U6 g  J! \7 j}7 Q7 `0 f0 Q3 T/ l
Connect();
. h0 `& C) W. w' H' A9 T# l
- C. ^2 ^5 N2 N) A6 Cfunction InitForm(){
" j% [+ E; H0 a) D/ O; C//layout for the form
& W" t5 w/ o+ _( S7 ~echo "<strong>Send Items.</strong>
; a  V" P% f+ c" \! w* p# d! }* s<form name='select' method='post'>$ G$ ^- d. x1 r. s/ F# N
<lable>Character Name</lable><br/>( b& g, ]+ q! E" ?+ s% I& k
<input type='text' name='char'/><br/>
- ^( w6 {3 ~  G5 o; ~! v9 |6 a<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>& r, E6 h; Q. z( x
<input type='text' name='item_name'/><br/>
! j; \, u; u2 p- [/ v. \4 V<lable>Item Amount</lable><br/>% w. K  v1 |' a9 {8 Q  A; Q6 H( v5 g
<input type='text' name='item_amount'/><br/>0 k4 K$ {- E% t0 W4 h5 b
<lable>Item Upgrade Amount</lable><br/>3 ?+ v4 |  r6 N, X. j! z
<input type='text' name='item_upgrade'/><br/>! {3 J8 ~1 p' O9 p) z' P
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
! M: F) M1 {: Z
2 \7 l5 z6 u0 {1 H</lable><br/>
! |5 Y# i" u, l# X" c<input type='text' name='item_element'/><br/>, ~5 x! w! \# F. T# m$ ?3 o$ I
<lable>Element Upgrade Amount</lable><br/>
# O' s( E. c' ?5 T8 }7 h; Y<input type='text' name='element_upgrade'/><br/>
8 Y7 g- x6 |5 y<lable>Pierced Amount</lable><br/>
9 `& L- V/ B( l: E: ~<input type='text' name='item_pierce'/><br/>
8 N* H: D. c+ ]' }6 l$ b8 k: y<input type='submit'/>, S6 W5 T; N: W' g4 c& f/ I
</form>";& O/ V" {$ q2 V. [7 O7 b' L% d7 [9 p+ y
}
7 h( t$ f) n, A
- f, \& [, Z& u, N+ }- X0 O$ L' Pfunction PostListener (){
0 f7 L. A0 v0 z( X* H8 _//Add more post variables if needed and add them to initform() function aswell
/ \8 ^- r/ M( S1 t3 `( M) ^6 ?7 c0 K8 F, d
################################
' U: v( _8 b4 i0 `# o- K+ v/ m  r+ C##### Connection and Post ######
# |9 }8 |: G6 C################################0 w  a$ A9 ]+ B; |3 w
$name = @$_POST['char'];5 |1 d1 p( Z+ |' r4 z) A+ X; x. s
$ItemName = @$_POST['item_name'];) Q7 Y  v- }8 I& ?6 J" c
$ItemAmount = @$_POST['item_amount'];) ]: k5 C: B) a3 q" y5 B
$ItemId = @$_POST['item_id'];) @. ?& {* L% g( E
$ItemUpgrade = @$_POST['item_upgrade'];
) J0 s; X$ l9 O* B$ItemElement = @$_POST['item_element'];
9 j) ]( }4 h6 U3 T( g$ElementUpgrade = @$_POST['element_upgrade'];8 c, n9 J2 O* N0 b9 `2 B
$ItemPierce = @$_POST['item_pierce'];; z9 p6 t# {8 e# m3 ]
################################8 M% j, n- C1 e9 ]$ h2 c1 j

& v1 [4 X7 {3 H  j/ Z& o//Check both variables for empty value
; [; [# d2 b) M$ ~2 }8 x' u
' d5 k/ X7 K% N. M1 a- p- \if (!empty($_POST['char'])){! [; u& p/ ?8 Y
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where , J% t- ~; J2 j+ n/ S8 Q. E

7 N3 V- Q6 W( ~+ b2 k/ f6 Tm_szName = '{$name}'");
' Q. E3 i- Y) s, i1 dwhile ($row = mssql_fetch_object($find)){
/ u: \9 b6 l  L  }' Secho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";; u( h+ j  V( e2 v$ q6 M
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
7 M& S9 e. y1 L+ B# b+ x
* C" e& A6 u  {1 U, T5 z[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
$ m! E. y2 j. R& T! |5 u8 @% @& H$ U, c2 l/ s  Y
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
5 J* }& k+ D/ o3 I
- S# U3 B* H: L4 C6 GN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', 2 W# f+ |2 b1 C4 ^
, w- B2 f. l0 @8 J  W
'{$ElementUpgrade}', '{$ItemPierce}');");* R: V& W$ C, p, ~3 }) h. m
}4 c( a7 n4 w2 t3 o1 g
, A; D) b$ l* x( q
}
+ `( p2 I$ s5 x3 @& x# \1 r( h9 r. T
}* f4 e; ~& `0 z1 {& B2 c
% J1 z9 n8 X* L$ m% r
$InitForm = InitForm();7 I6 D: A( U3 H! ^- ]: h% r
$Listener = PostListener();/ r* c/ B1 v- f9 E
1 G4 o" n2 n1 e5 P" G  e; Z
?>
5 [2 ~2 v4 _1 }% T. P
! {( }8 I& Z/ ^6 U5 R, P& N" \0 s7 V1 p6 y4 P5 w' O( V
8 [. |' X* u2 d6 F% z
2 \3 T1 M* x" J- N7 R& d9 f
回复

使用道具 举报

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

本版积分规则

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

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

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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