飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1088

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1088
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
<?php9 t7 o! I1 s' u2 x
function Connect () {$ c) h! k7 I* o$ O3 r; ^  S
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB ; O4 t& y* C) b2 a" ]/ B

5 S3 V  t9 p6 X& R: K$ z0 ~Failed.');
1 @4 Q+ _: k0 H1 |  `3 p, I: K1 k}
  U: `# o; Y" vConnect();9 }/ E3 X$ T" y& t! ~

+ b- H' ?3 Q% f& G1 V0 z/ s5 xfunction InitForm(){
) l. P' ^' P+ O' Z* A- H& N- m0 t//layout for the form
( Y, W8 ?) ~3 techo "<strong>Send Items.</strong>- Y% Y: U' M7 C8 ~; q, |; v
<form name='select' method='post'>: t6 ]7 m7 _9 y' p1 X; |2 M) Q
<lable>Character Name</lable><br/>
/ Q, y# u& N  h1 s* a$ ^  s& g<input type='text' name='char'/><br/>8 A9 I/ Y# b6 p
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
# O2 o3 ?$ E" x+ g. k# u( G6 p<input type='text' name='item_name'/><br/>
, u& U* K; d  g  H# w<lable>Item Amount</lable><br/>8 k8 L$ L  X& ]& X: V, p: a
<input type='text' name='item_amount'/><br/>/ V7 _5 E' \1 C4 Y/ [  e, f( D( t
<lable>Item Upgrade Amount</lable><br/>
& ?4 v# x$ i" k* ~<input type='text' name='item_upgrade'/><br/>- U/ J: ?6 [* s- `" x! Q, L
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
+ r. b: Z% U- l$ _1 Z. @) U' X' _8 x# Q
</lable><br/>
# X" ~$ Y, M6 S<input type='text' name='item_element'/><br/>% p3 l$ G. m2 W3 c; J
<lable>Element Upgrade Amount</lable><br/>- s9 {/ q3 A/ s: a$ P  }
<input type='text' name='element_upgrade'/><br/>
; U2 v* n) g+ H% x- s& o! C$ c<lable>Pierced Amount</lable><br/>
# t) o1 O& v& J+ H6 h5 A2 H<input type='text' name='item_pierce'/><br/>
3 C0 G$ ^4 i: y: w( a/ ]# f- {<input type='submit'/>; p* |! A! d* A
</form>";6 W# H2 x! _" p' J) c: t
}) Y  V& Y1 @5 Z7 [8 L
- G6 P: k7 f9 k$ ^8 V
function PostListener (){
. p5 |4 U8 A& y. W8 X, a3 S9 V//Add more post variables if needed and add them to initform() function aswell+ M' Q' w" z! D
$ {& n, O1 E+ J3 K# M
################################2 W# x0 e+ [6 s1 o
##### Connection and Post ######
6 ]! u9 S1 N9 n$ O' I  ]/ |################################) a. |9 `  o& B' g) E7 G1 c
$name = @$_POST['char'];
6 N  k+ p+ J% V  q' s$ B5 ^$ItemName = @$_POST['item_name'];
* j8 R! w0 t& v$ X$ItemAmount = @$_POST['item_amount'];7 {1 X; ^, R# }) p. y
$ItemId = @$_POST['item_id'];
& ?. K& K: e/ S, `* _$ItemUpgrade = @$_POST['item_upgrade'];! h7 ]( }+ [& u# d  {& r! ^) i
$ItemElement = @$_POST['item_element'];8 ~2 S, y1 R' H) X* [
$ElementUpgrade = @$_POST['element_upgrade'];: b( }9 k% c* m, k/ H+ O
$ItemPierce = @$_POST['item_pierce'];7 P0 ^) |* ~7 Z. ^# R
################################5 W3 x: G" q4 C: P
3 P) j: l" r: L0 @$ K/ K$ o
//Check both variables for empty value
/ c: Q9 Z/ O# w, [* d
  e! b6 Q# z: F& x: s7 m( K5 kif (!empty($_POST['char'])){
6 L( ?& t/ G& ^+ e# a$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where 6 r, X. E5 i5 E3 y9 H9 _1 N; k7 G( {
3 q# Z) z; w2 {4 H
m_szName = '{$name}'");' P+ h4 m- k6 Z
while ($row = mssql_fetch_object($find)){
/ U3 [8 E3 o* {% b* o6 @" _echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
! V, B' U% M' d8 t$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
. S/ R# W# [* g) X* O
6 [6 Q& \: A' _' G[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
* ~$ V# f8 e( K2 @+ D; r
9 A1 v3 f# a8 \" ~0 ?[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
: x3 _2 e1 F: u, v
& r1 C+ _& F. F! L2 n6 GN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
8 s0 `$ s, |" t9 A# j0 ~, s" h
'{$ElementUpgrade}', '{$ItemPierce}');");3 U6 _- e4 y/ m0 ]. f9 R/ T2 I
}, z8 X1 |- Q. g

( p% C: a7 {; d) z" J}) t0 k" M. C% Y, z

7 }' y+ l+ j) c1 v* {# }& f3 ~}, A& {' G' s# z9 n- C8 T# O- H
7 P: _( Q- A: f2 ?
$InitForm = InitForm();
# G+ j; }/ C, N. O; ~0 e+ Y$Listener = PostListener();- \( x. \- C9 X1 t: t+ t& I

4 q7 _% ~& W9 U% ~9 w5 G7 w. r  n?>
( d+ w% k2 B% r% I' G+ B
2 J- `5 i7 g2 l* G+ _1 ~9 P: Q

+ V- h0 T" ?% J# |/ Y$ C& f
' @7 M- z* Z' y
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-23 05:29 , Processed in 0.062069 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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