飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1064

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1064
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
( X0 _9 B  C; q, e& vfunction Connect () {
" r2 O4 A+ j/ q2 c3 e) jmssql_connect('Server','UserName','Password') or die('Error: Connection to DB
* H, `0 O' [. c, z' J$ O( G. q1 M+ W% n
" Z: B1 p2 V% m) `* QFailed.');1 z% U3 b) S- F) M" _! c' i6 x
}/ Y5 U8 a4 ~1 N6 j5 l
Connect();
! g# H9 L4 T8 N, K- c7 u% r$ q; i( B+ A4 e, E8 j7 h
function InitForm(){2 }6 o3 c6 y! C$ q2 g
//layout for the form( J4 Q! R$ O. O% M
echo "<strong>Send Items.</strong>
3 S" v( c3 N7 F& d! S: `<form name='select' method='post'>
" t7 w- ]" ?& g8 P3 B<lable>Character Name</lable><br/>( U" W0 I( @, |  u' m2 r
<input type='text' name='char'/><br/>
% k8 j5 u1 t& b+ {. `$ I2 l  K<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
4 l  B) q; r1 K6 V<input type='text' name='item_name'/><br/>9 w1 ]& t/ M- ]0 M9 H3 s9 U- [! |
<lable>Item Amount</lable><br/>" C6 `9 T& K) Q* s- B, Q7 O* ~
<input type='text' name='item_amount'/><br/>
7 F7 k' ~/ N, ^7 z<lable>Item Upgrade Amount</lable><br/>
& [* y/ L0 ]  `' N<input type='text' name='item_upgrade'/><br/>
4 @! _" |+ a7 K% }4 Z9 C2 X# \<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
6 Z4 f% S) D! A8 k* T
$ ^& S; `2 A4 B' n1 g</lable><br/>
. U3 y) q' h* B4 b6 W% H* V<input type='text' name='item_element'/><br/>
, j2 d' }. N1 Y<lable>Element Upgrade Amount</lable><br/>( |* j4 r1 k! v$ u
<input type='text' name='element_upgrade'/><br/># R9 K. S' m, w
<lable>Pierced Amount</lable><br/>4 v* G" O/ v3 K
<input type='text' name='item_pierce'/><br/>
. I$ q* v$ U+ z0 T* x& D<input type='submit'/>
- C+ T0 L' z3 M( ]8 W</form>";8 C' _& J2 C4 n; r; a( [0 b
}
/ h5 R# q7 H  _3 ^. E4 A
" O8 _6 [& d3 \4 N' z9 A* kfunction PostListener (){
/ {6 n8 Z0 a# L//Add more post variables if needed and add them to initform() function aswell$ g  \+ A7 [# C% V7 O- _( M
) ]1 A4 Y+ m- P) R+ }1 ~: s
################################7 D2 Y( f: e/ R3 z- y
##### Connection and Post ######
0 H* k6 q0 R  o2 J4 r# P################################; o' ^6 q- w! l1 j
$name = @$_POST['char'];% T2 \3 k. p" X1 s" Z" i- d: t" I
$ItemName = @$_POST['item_name'];
1 }# F! \+ `! `+ |# K- r$ u4 ]$ y" d5 v9 s$ItemAmount = @$_POST['item_amount'];4 J# q6 x1 u3 G/ @. l0 {( h/ k
$ItemId = @$_POST['item_id'];
+ f5 b; \2 r& r- Q+ d$ItemUpgrade = @$_POST['item_upgrade'];1 G0 T2 C& K6 j, E5 g  p
$ItemElement = @$_POST['item_element'];, ?6 T% b  e  k( \( e/ W/ u3 j
$ElementUpgrade = @$_POST['element_upgrade'];
, P/ |) w$ X+ h9 P2 B$ItemPierce = @$_POST['item_pierce'];
$ S; N: N$ [) ?( F( b' R################################3 L3 _4 s0 B7 U+ h. ]

+ |  `0 ~7 @5 ?; L. Z' W, a//Check both variables for empty value
! f1 w9 ?1 k, ^% H' i/ f5 O6 l4 }0 R; Y- U* f1 N  O' Z# n
if (!empty($_POST['char'])){# N8 x4 m# `0 l) F. a- O
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
0 I6 W; ?- H8 t- g  g- ^+ M5 n3 Z0 R- K7 {
m_szName = '{$name}'");
0 f( k- l1 q& N% D8 {) e3 m4 {) ewhile ($row = mssql_fetch_object($find)){
& V7 p' m$ O9 D0 zecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
) j" ?6 p2 C& F- v$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], ) `9 Z+ f5 V  M. e

+ w+ A/ q2 L' W) L$ Z[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], ; k0 e- e( a, B& e
2 [8 U& G/ w. ~' P
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
5 G; v$ u- A$ |* E" G
, @! G4 z, ?, m! TN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', 4 R3 U8 o! p+ U$ p1 ~' z

" ?1 E/ N1 D4 s% W5 Y'{$ElementUpgrade}', '{$ItemPierce}');");
" U* g# t: o& ~. s1 Q, u: b}" g: R6 j: V2 u7 C* Z( S: [+ B8 x

# P3 _/ `# I1 K$ \% C" E}  }8 s$ Z5 J8 @+ t
3 a  O- A- [3 R9 O; R& u. \8 n( n
}5 \0 r/ a: u5 L  r* t& b, b
& X0 z- R- q! |$ q4 q! r! Z
$InitForm = InitForm();
& S! H6 J$ ]1 A/ A  v$Listener = PostListener();; K7 U1 o1 N) L. D0 J# B

$ t1 f' B1 T; p?>7 O6 \/ o& h! m, \3 W

; \) x& M& \' O, ~  |; x. {7 Z" G+ G3 @, t) H& [+ b

& h; M! G4 W3 K2 s" v* x" H
( p6 C& v: P! d1 N
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-6-16 20:34 , Processed in 0.062921 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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