飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1090

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1090
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php8 p8 i8 G" g: ]% {6 t
function Connect () {
) t- @' g! u" u0 d/ M; r+ rmssql_connect('Server','UserName','Password') or die('Error: Connection to DB ; \- k& u5 d3 k2 z) S# N/ ~2 Z5 C
* \$ r4 V' I, b: d
Failed.');6 k$ J: {4 C; Y/ J" i
}/ [5 F2 [0 {& f3 ]
Connect();
# w% Q1 R) _  [2 E% h/ n' ]8 i( N5 F4 \
function InitForm(){' ^7 T/ X" I/ n" b2 c" D% L
//layout for the form
. j- ^" v7 N7 m: Hecho "<strong>Send Items.</strong>
/ o  I2 z" C7 ?9 j/ S+ l( [; ]<form name='select' method='post'>
+ z! a- K, ?6 I! ~" x' b! a8 f<lable>Character Name</lable><br/>
; N' P: Q2 A3 g* l) T/ L0 F$ _( `<input type='text' name='char'/><br/>
9 r) t2 e0 `# W6 s9 X5 M& t<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>) O/ s$ A4 w! h; A  \
<input type='text' name='item_name'/><br/>
- @3 l5 z. C: k* b# d. K& t<lable>Item Amount</lable><br/>0 ~/ y5 B( c' y! o
<input type='text' name='item_amount'/><br/>/ M/ P$ S% M. C4 i
<lable>Item Upgrade Amount</lable><br/>
, j% l9 v: N) H) [1 [/ i+ K<input type='text' name='item_upgrade'/><br/>2 Z" ~" S5 \4 M; q$ U7 _
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)2 s4 Z7 |1 b% Z! A/ b: q, z& {

3 e# c" l. E  P3 S$ [$ p! n</lable><br/>
9 V  n8 u5 d1 T<input type='text' name='item_element'/><br/>
  q# I( q7 n; }& \3 V, o- z* Z% K9 M<lable>Element Upgrade Amount</lable><br/>, K2 {/ x' Z8 N2 b' K
<input type='text' name='element_upgrade'/><br/>8 X6 h! k/ A- b# ]
<lable>Pierced Amount</lable><br/>
1 V+ ^; W6 ]( ~/ |. C# `<input type='text' name='item_pierce'/><br/>
  C6 a: _! w3 R( f/ t5 A<input type='submit'/>
0 f  W" \+ Q2 N% q3 ]7 O; v% i</form>";
& o& W4 j+ k$ T! R: @$ ?  L0 \}
" A; \4 q% [: n- N; }# Y5 t: ^7 Z" I
8 d, o+ U2 {& i4 I* r. l0 V2 rfunction PostListener (){7 v! Y) z) ]# o1 I% A: I9 {- Z
//Add more post variables if needed and add them to initform() function aswell
$ n5 [# U- |2 x  T
* D- R* e. c. L1 Z' R' f7 O  i4 U################################; W! z" |1 v" {" H) S7 N3 q
##### Connection and Post ######& N* P$ U3 E, X0 w( N, u+ P, V: u+ w
################################
$ v& m9 {" _  _6 d2 G1 M$name = @$_POST['char'];8 j7 N2 L: T0 {! b$ g6 J
$ItemName = @$_POST['item_name'];! }( h8 W* I& R! j& P+ N+ N
$ItemAmount = @$_POST['item_amount'];0 e: \" \  ^8 s
$ItemId = @$_POST['item_id'];
: l3 z' t- O" @- M2 o! I4 C; e$ItemUpgrade = @$_POST['item_upgrade'];
9 ~! I7 }8 w; v$ItemElement = @$_POST['item_element'];
  y3 l8 c3 v+ \9 K3 N+ v4 j* X$ElementUpgrade = @$_POST['element_upgrade'];
% u# w+ ^0 `$ h, }3 ~+ a$ [$ItemPierce = @$_POST['item_pierce'];( c* w/ n& h5 L" B" j
################################
: ]1 P# g$ K4 ^. K4 F% b. u& ]( f/ ?4 D8 E: a* L" c0 u
//Check both variables for empty value9 i3 A; l0 ~+ s6 g& L2 p

& [/ E7 X% ]4 e- hif (!empty($_POST['char'])){
& H) o* p+ e/ n- v6 h- {$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where 7 `# r/ a  z, D0 A6 s7 `4 V+ p
4 o# _2 D, R; o& c
m_szName = '{$name}'");/ L' ?1 K7 x' f" o" N& ]# Y
while ($row = mssql_fetch_object($find)){
  b3 n/ q1 ?" g, m: _( ?6 ]- uecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
( u+ p" v$ e- H$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
4 S1 M+ g3 ~6 r, L2 s
) c& V" y- N6 Q( u- i" G2 G: S[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
2 ~% t+ @8 r$ Q4 v
, c& D/ N$ B7 @" l0 A, {! X[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
1 }5 H" t: B# ?5 N
/ y1 i1 _/ {# g# F- S7 vN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
) L5 ]+ _# I1 r+ @" M2 h, O
7 g+ }3 h: H+ q6 u( O'{$ElementUpgrade}', '{$ItemPierce}');");0 y& N' Y! D4 ^* c/ c0 H
}
6 k3 I; m7 f" S! f; F" H3 V9 d3 Y( }" @
}
; i2 J2 z1 V" |; f
; v/ N' R/ e; h- R}
' @' Z" h5 _5 C+ b* v7 ]
+ f& E" p, z: N* d6 t3 j$InitForm = InitForm();/ u& |! r, `) j, N% k# X+ w
$Listener = PostListener();
" i2 J( a% K% T5 k) Y" D
$ y* I& |* ]7 H& X- @2 Z?>" V; z; q5 {/ {2 [
* j! p& I6 @* L- r) j' R
7 l& @' L7 N+ }4 b

2 k5 F, U( I. e. n5 m& ?
6 I% j1 w3 e4 [# S7 j
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-26 16:54 , Processed in 0.065454 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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