飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php, Q* i. ^& {; |/ L) P. E
function Connect () {1 }+ m6 s, C! Z0 {
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
' i" {0 [8 ~9 L5 t7 n2 s' \/ D+ ]: R: d( j0 \2 R5 f( w/ R
Failed.');0 \2 \0 \7 E9 h3 W
}
' \# @, e4 X. N( @: rConnect();
/ [6 q7 v, c% \8 i2 P2 H$ K& Z
9 G. x. ~& v$ Z& R& E# Tfunction InitForm(){- d2 c* b# T# v/ W
//layout for the form
0 ~6 k: P$ C% u9 b' wecho "<strong>Send Items.</strong>" c' V- h4 {" ^2 u8 a
<form name='select' method='post'>/ T$ |. P- j- @$ l* y: k" h
<lable>Character Name</lable><br/>
7 X; d3 ]  c6 x' ^( D/ l, ~<input type='text' name='char'/><br/>
% U( R7 Y5 d  h6 N$ [5 M* I<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
+ |4 ~; ?' C* l! v. r- {+ H' |; T<input type='text' name='item_name'/><br/>8 v' `# `2 i5 w7 j# F3 |
<lable>Item Amount</lable><br/>
! n: y& F. @; c8 T<input type='text' name='item_amount'/><br/>
9 m. ^5 @4 Z2 \4 u<lable>Item Upgrade Amount</lable><br/>& K* K  A2 e: z' y  }
<input type='text' name='item_upgrade'/><br/>
4 L' P' n# i4 p3 B4 r<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
2 Z7 W; a) z# h# U9 K( [3 N) ]  a$ o0 q- v: y  E: ]# ^
</lable><br/>+ g- K3 P) e  Y
<input type='text' name='item_element'/><br/>
3 E$ d4 V& d7 S9 u/ z* ~+ L* a4 V<lable>Element Upgrade Amount</lable><br/>0 E; Y5 Q9 S6 X* T8 ^* C" }
<input type='text' name='element_upgrade'/><br/>
2 H6 v/ D7 t5 o) q<lable>Pierced Amount</lable><br/>' k% r3 W  ?$ f" ], }
<input type='text' name='item_pierce'/><br/>
, t$ V  _2 P6 Y2 e, E2 S5 `<input type='submit'/>
( Z/ G* J& L% I+ V3 p</form>";0 q, _5 R/ T& |& p
}* m$ V# N0 U& @/ V( u3 c; q
! a1 o& ^+ D5 _. J" W
function PostListener (){
' [, {; R9 G  P//Add more post variables if needed and add them to initform() function aswell
, z$ [/ c  `% U& o; E/ Q' v: K/ U3 h6 m' L% o0 t+ N
################################' @% X) d! B* h: {" ]3 y# w
##### Connection and Post ######
/ G" ~- v: b6 u' m################################! h( A* v/ O  ~( @4 ~- Q6 N
$name = @$_POST['char'];
9 C! `5 ~8 Q$ R9 L0 E; @- p' l$ItemName = @$_POST['item_name'];% f4 d& k8 d, _- g4 t* h
$ItemAmount = @$_POST['item_amount'];
( D+ r. o5 T9 x: v' p$ItemId = @$_POST['item_id'];+ e4 @% c/ {' h+ L* M( J1 q
$ItemUpgrade = @$_POST['item_upgrade'];
* W1 A) Y# |; U' k, [. g$ItemElement = @$_POST['item_element'];
& f9 |2 t' R3 [. O7 \& P$ElementUpgrade = @$_POST['element_upgrade'];
0 Y* C/ L/ }% k! O, Z/ R$ItemPierce = @$_POST['item_pierce'];# T" j" x  ]& e. p% U, C3 E) Y4 {
################################
) h7 d# C* V% U6 u" [; v& H* ^
/ p# w0 w: s! z//Check both variables for empty value
3 i2 z8 q. ?% {, j
3 f; |3 |! z2 Jif (!empty($_POST['char'])){
# v+ T/ \* b# }( l" i; A$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
2 f4 `4 B0 u6 H* p9 S, x0 C" S! x1 Q; [# i( {  a8 p
m_szName = '{$name}'");
9 K4 f) |, P8 G3 \while ($row = mssql_fetch_object($find)){
$ _* J6 J0 M( Y" g* F3 f$ F  U% mecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";1 \$ c+ x: e, F9 m, I
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 7 F/ N6 A4 v: b

4 t* t2 \2 B5 Z& G% k3 d: j[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
  g( w% p% b0 T: }( {5 r! m# q3 k% @* L# ~( `8 @. B0 b
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', " N/ _! r# O1 ~, M- B2 D' K

! \# S$ o- \+ K4 @2 ^# MN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
" a  K( r! c/ Q
" O: y, J5 ^) }7 C3 ~0 ^' |'{$ElementUpgrade}', '{$ItemPierce}');");$ o) |% E( H' M# F% T3 G
}
  l: O: W/ Y' i
( v" `' p* }  v8 L% n+ w}
0 u1 G7 L7 S. Z# c3 V% j. `* n. A, j3 I: ^& d. S" I  k
}, Z* |5 [+ r2 L/ J" D# N* U* h/ C
- G$ O9 p: e' F7 n
$InitForm = InitForm();
7 J% P$ R# [0 Y$ _$Listener = PostListener();
; o' m  W" l* M6 z
  C# z8 R. Y& [! ~0 ??>) [. j  ~5 e& o* |9 p/ ~' g

0 i( s! @6 S( l9 ~
9 P; q0 E- y2 P7 G- j' e* `3 p# s6 C6 a% t
" m3 h+ |& I9 Q1 w1 {: v6 f
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-20 16:06 , Processed in 0.059523 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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