飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1092

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1092
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php) Z' J6 {/ Q7 z% q- R
function Connect () {. v1 z: D7 m4 @* C7 }
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
  |) X0 s1 [& a  g/ w2 E, `: Z+ P/ X
8 Q" [, z  i' N6 a9 h1 K% f6 m8 u% oFailed.');, {+ d! T, p* Q' s
}, ]. F7 Q. g1 ?6 d) H+ k$ f
Connect();
9 Q6 i) y0 {3 W  U' A. R+ R  e1 S3 k2 ?6 I( }/ z
function InitForm(){' t8 Y2 ^% d! l2 m9 J
//layout for the form* F% [2 c  h& J$ F5 X+ H
echo "<strong>Send Items.</strong>& i, ?+ }+ G9 n) {# l
<form name='select' method='post'>8 q0 D" U, M( I  e  K" x3 ]
<lable>Character Name</lable><br/>
' o0 l: [% l$ B3 @, o; o: `5 ^<input type='text' name='char'/><br/>
: C; y* N& J. u% Q8 {9 T<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>" a) s9 L; b8 X" w9 S
<input type='text' name='item_name'/><br/>
, R. b5 W1 z6 V1 y$ r) z- X! K<lable>Item Amount</lable><br/>
6 d9 x8 r% q% K' }! T/ ?0 V1 P+ a<input type='text' name='item_amount'/><br/>$ @  Y2 H  v" i& r! B2 s/ I
<lable>Item Upgrade Amount</lable><br/>" Z  p' a5 z) _7 r: O
<input type='text' name='item_upgrade'/><br/>
- E" s, @% z7 m<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)9 Z+ q  _0 a' n+ B" Y' m) U$ R

8 }& S8 O* U9 S& W0 m! Z" F</lable><br/>
' a- t4 \8 T8 D5 V* S4 o<input type='text' name='item_element'/><br/>
  h: L! U2 E# e% B# Z3 i<lable>Element Upgrade Amount</lable><br/>
. E( P  a/ Y3 E0 T& M# w* S# i<input type='text' name='element_upgrade'/><br/>8 k0 m& b4 V) Z
<lable>Pierced Amount</lable><br/>5 N# F+ t% H+ [$ i8 `
<input type='text' name='item_pierce'/><br/>) w# h) c( G- K" g( l
<input type='submit'/>/ c( F7 O; s2 n2 b2 W3 ^, J% `
</form>";
! l7 v  s* P9 ~7 d}
$ u  m. z- w# H; [, S/ Z0 [# q# c- e
function PostListener (){
7 f! w/ g7 @7 `  L- T& }//Add more post variables if needed and add them to initform() function aswell) V% \7 E3 D( m4 j+ i

" L5 l9 k$ H- G7 \################################* E' `! t3 u& \4 q
##### Connection and Post ######6 D% j! c* ?4 M7 b1 ?  {: g3 z
################################
# {1 J3 |: I" h4 R/ b$name = @$_POST['char'];* Z# s, C' Q- {, A
$ItemName = @$_POST['item_name'];
) Y* J: c( F$ O/ I' Y% D1 c$ItemAmount = @$_POST['item_amount'];( I1 J0 e- t; @4 x& \
$ItemId = @$_POST['item_id'];% H% J% w: q" w! k1 n
$ItemUpgrade = @$_POST['item_upgrade'];
; {" z2 Y' c. S7 v$ItemElement = @$_POST['item_element'];* L5 |2 s- |- G* f! t
$ElementUpgrade = @$_POST['element_upgrade'];5 O! c0 @2 l" |( X7 s5 G
$ItemPierce = @$_POST['item_pierce'];
2 L: f: b8 l( T# k( ~3 e3 C4 z& x2 d################################$ z9 `5 [+ {- W
- t% o9 _  S" {. Q7 C; S) D
//Check both variables for empty value, B0 }5 s0 i( a) o/ i9 k1 p

( P* P4 y" n4 T+ s# u4 gif (!empty($_POST['char'])){
) K" m5 p& B" m- O4 A% U3 Y. k$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where & i( l8 {& N- I) B3 k# F& m& K
! o7 j# M- P* b8 O0 d
m_szName = '{$name}'");
: q( y8 W0 j1 Bwhile ($row = mssql_fetch_object($find)){  }. D" V' }) _8 U
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";* o- P# d% U7 j" x
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], ' i3 V7 a; c. E

3 K6 G9 f* B1 Y. G7 _6 T[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
- l3 ~) x( C9 ~& {" v
+ O# C9 b$ f! v4 I* O7 ][m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', ( o9 g2 s* j" L
! v- t' k) X* H' s$ h9 E8 G! s% e0 P
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
) d1 S7 o! I5 S1 B
+ [+ ]" m* G5 Y1 C( l; l'{$ElementUpgrade}', '{$ItemPierce}');");
5 w  |' U( s! p: t% [2 C- ]}2 }% ^( {$ {/ w

" t7 F( K0 v% L2 [8 i}
$ K4 B. D1 E5 ?/ P# p
8 s8 Z4 F# T) Z5 Q3 E}+ i7 Q& ]. J/ s8 y$ Q6 `; L

5 O, r; L7 Q1 B% D( K$InitForm = InitForm();& O2 s1 t9 @* @/ [
$Listener = PostListener();  Z3 t6 J. z, Y/ y) ~9 P
4 M3 |. T# N* o, P8 ?* |
?>
. S% U! o3 ]  Y# k- y* J/ u- j
7 g& w4 n8 r) c3 E9 E4 J
( I, [4 V7 o, j& ?( b; c7 c* y. o
% J1 R' `6 i. t* H' Z' Q/ X0 T
. N) h$ b! R( J  G- C, S- y
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-29 18:07 , Processed in 0.063524 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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