飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
! F: C1 o( a& E! D! x- ^3 efunction Connect () {
' e) w$ R3 Y* x! F0 vmssql_connect('Server','UserName','Password') or die('Error: Connection to DB 3 J6 f3 \/ ?2 N( X0 x8 ~' w5 q

6 ^# q- x: g+ H. zFailed.');
! c6 ~: B5 [9 ~( w3 X& F}
$ m; v1 E% R1 U. S! B4 E' vConnect();) z& O) n+ w+ p% \  g
8 \9 v  i% N7 c  x  J" y! G
function InitForm(){
' U; @+ m# a6 _  [//layout for the form
" z4 S) }2 v) z- Necho "<strong>Send Items.</strong># ?/ ^9 q- M# X1 e: w  C1 v
<form name='select' method='post'>
' Q& l3 Q! k/ c* U<lable>Character Name</lable><br/>
; P# y0 ?% o# W! P$ b<input type='text' name='char'/><br/>
, U2 [" v7 C  I+ i! V/ b<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
: [! A; u2 `2 A<input type='text' name='item_name'/><br/>
: n6 ?. S% M3 Q1 s7 W' W: g, R: P<lable>Item Amount</lable><br/>1 W- z$ L+ B! ]1 A5 y0 E6 b
<input type='text' name='item_amount'/><br/>
1 `/ ~$ I. b. V5 `<lable>Item Upgrade Amount</lable><br/>
  C: ~/ m, f3 s, B3 D; i<input type='text' name='item_upgrade'/><br/>$ f' ?- N" p& X- S' \$ {
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)3 h; `! {' v, ?* q* T8 I% G& N

! J6 [% V, J# e  _: O  ?9 e</lable><br/>/ U$ {3 i5 H3 s+ N; c; h: D0 ~8 s
<input type='text' name='item_element'/><br/>* p7 L- b* X* E% |3 E
<lable>Element Upgrade Amount</lable><br/>. e0 f7 w; T8 Z# C. x' e$ G2 E
<input type='text' name='element_upgrade'/><br/>
  W3 U# P8 t  b& I3 n/ Y<lable>Pierced Amount</lable><br/>
4 {! ?/ X4 R0 |5 @" |% w<input type='text' name='item_pierce'/><br/>
& P" f4 C+ D" m<input type='submit'/>5 p, |% n) z" I' h8 u2 X
</form>";
/ ?  C# c' b1 C: b  ]8 |! _}' v: Y  E, C9 F3 ?  n

: F2 R& b2 D, B- L/ T$ Q  _/ ]function PostListener (){
- c2 c5 w" ^. U0 n1 S//Add more post variables if needed and add them to initform() function aswell! U* {1 Y+ d% `7 g! U

* f) @; O$ ]8 M$ E$ V################################
3 Q  c$ T) U% e* H9 B##### Connection and Post ######
6 A  [4 k* a5 \7 K################################
- l( v0 a- N$ M$name = @$_POST['char'];
" W3 q5 j) a  x3 v' V$ItemName = @$_POST['item_name'];" ?7 @5 M* ]. [8 ~- x$ z1 M
$ItemAmount = @$_POST['item_amount'];2 ~! _& v8 E  R' R* t% }
$ItemId = @$_POST['item_id'];
+ {3 J% q  |( ~. a2 ]' |$ItemUpgrade = @$_POST['item_upgrade'];
7 T- T3 I" K5 o+ \+ X" B. g$ItemElement = @$_POST['item_element'];  o, {6 d; Y4 ^; c0 z; a: [$ y  Y' N! ?
$ElementUpgrade = @$_POST['element_upgrade'];
* |; _4 ~' d0 ?4 E; V$ItemPierce = @$_POST['item_pierce'];
3 h5 A1 p& X3 f0 c6 O################################
, h+ o. d) g, {9 M- L4 F0 |( @% j9 |% ^6 q- p
//Check both variables for empty value
- D0 O' z: d7 D) H  I+ Z" v  _6 d$ S& w3 [5 h0 [
if (!empty($_POST['char'])){" q5 G1 l' d! v6 j, d" |+ ?: ^, V5 [' ^
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
7 e7 j( s  X, A3 n% M% G, i' F* @& }. S# }! G" z6 O
m_szName = '{$name}'");
! U# f- ]1 M/ e* S4 k) W( Z9 kwhile ($row = mssql_fetch_object($find)){& J8 {7 ]9 ~4 E: r% W) s4 f4 v
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";3 L# P4 w4 J, d
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], " \2 L; L% w$ k. H. w% p7 r3 v. Y6 C0 j0 n
  |- y4 _, R/ I  `# r
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
( s' c: z7 ~+ z8 f, T9 i* o# B6 x* {/ @; Y6 t
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', - c6 p9 ~" o& g4 B( q5 L
- t, l  K3 c) K; g% X, P
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
1 x! e& f6 ?5 u( s' }) D, ]7 }" t2 h" K4 A% r  D( W; G
'{$ElementUpgrade}', '{$ItemPierce}');");$ K0 P- ]3 R# K# t7 _; b
}
- S, U1 `4 X& W& [; s; `4 ^4 }2 v' j; R. Y/ N+ B
}
0 f: H8 N+ ]7 \6 F  M/ A  h$ s' l/ k. v! I- i4 ~
}, @% W& x9 Q# }& b5 E) b
  P" B9 W6 F7 Y! v$ O  L
$InitForm = InitForm();
0 i6 |5 G8 Q' Q, m$Listener = PostListener();
( }) G3 h. p$ M5 H; f" Y( g; a" l
/ U: Q5 m! f7 Z5 z$ V' l7 N* P?>& n# {0 Q/ R# o! a+ @
- R$ X5 i. \) J" q

9 C; L+ f0 H4 a1 V) b4 [4 w0 ?/ A- P: s! _
4 I4 B# j* W6 X1 [5 m  H3 A& I
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-17 06:37 , Processed in 0.059500 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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