飞飞世界论坛

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

物品发送脚本

[复制链接]

200

主题

203

帖子

984

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
984
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
6 `$ {! [+ D# q( I7 q/ X* {7 \3 cfunction Connect () {
4 R& }7 ^' f, v  c* y( Hmssql_connect('Server','UserName','Password') or die('Error: Connection to DB % U# H# ^6 p. M9 l

0 x* F$ y' v4 q. D0 N8 z4 Y# LFailed.');( f; Z2 `8 Y: r
}
! x# S  T  L) f' c2 zConnect();
: |6 r5 A; ?8 ]" n7 m) q! U  U% q8 E- E* [+ e$ y% o% B  R6 h3 v
function InitForm(){
8 V- k/ g9 W. d- X//layout for the form
4 |: b! v* v! X& O; }. j+ qecho "<strong>Send Items.</strong>
; ]# y' D9 P1 O; a( T0 j<form name='select' method='post'>
, h3 X( y8 o+ f* |* @) G<lable>Character Name</lable><br/>
2 U5 g7 y9 G+ v) ]6 [) e<input type='text' name='char'/><br/>
! ~: a) N/ d3 s, z% U! K/ o% O. [<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>' G# [0 ]# [+ W  F
<input type='text' name='item_name'/><br/>, Z5 x: R+ E; |1 F" p! J
<lable>Item Amount</lable><br/>0 `) C& u# E) ]$ [
<input type='text' name='item_amount'/><br/>
* g( s' [  h8 m: t  C- i; V" L% U<lable>Item Upgrade Amount</lable><br/>2 ^: I# H$ v+ R& D
<input type='text' name='item_upgrade'/><br/>1 h4 w6 O$ r! Q- t% N2 n
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
7 F* I, B. i% N$ E$ E  K4 l4 s% z( H3 F3 X# I
</lable><br/>' b" I4 M4 b& ?7 D9 e2 x! r! i
<input type='text' name='item_element'/><br/>
! o, |3 G! r/ L4 ]# Y. W<lable>Element Upgrade Amount</lable><br/>
1 r! R/ l8 t$ k* z<input type='text' name='element_upgrade'/><br/>
$ ~3 u6 y, r0 Q4 B: {" p6 {9 `+ Z<lable>Pierced Amount</lable><br/># O8 i9 P) P! p: j0 o
<input type='text' name='item_pierce'/><br/>
( {' {, J% g0 L( y: c<input type='submit'/>1 \6 w8 w9 A- }% J) D
</form>";
5 D# K7 a. M! x+ u0 U}
7 j( ~# j( ]" r( b9 |4 o) F4 C0 N3 h+ p4 d1 m6 E6 u+ q) ~/ Y
function PostListener (){
$ u2 K! X! K& p8 z$ d0 K. v//Add more post variables if needed and add them to initform() function aswell& @6 R; d: m1 P/ {" U
" d4 `; w6 l. z9 C7 Q
################################6 }; P1 v9 T6 h9 P5 t/ E9 ?
##### Connection and Post ######" l. w7 v! S2 Z; D1 E: K
################################
/ G: z" m) _" d. N9 \$name = @$_POST['char'];6 ^4 G9 p4 G: w$ I6 S0 _, U% p
$ItemName = @$_POST['item_name'];
2 W% X( t) g6 ~' V- ~$ItemAmount = @$_POST['item_amount'];/ V& u, w; [; N; @- B5 q
$ItemId = @$_POST['item_id'];
, P8 s6 S/ G2 d  ]- c$ItemUpgrade = @$_POST['item_upgrade'];
, U1 Y3 n9 h' m) k+ H/ p$ItemElement = @$_POST['item_element'];
3 K# H  h# G, b) {$ElementUpgrade = @$_POST['element_upgrade'];
- A% m, z; L6 S$ItemPierce = @$_POST['item_pierce'];
( L& Y% |' Z9 E0 ~7 x, r& {' _; J+ F& t################################
9 X4 ^, x4 e2 }  q6 w/ [5 v$ E: F# G  S0 O5 ]6 ~0 r- r
//Check both variables for empty value
/ [6 @2 ]' z, s# [) _. R/ t! ~# c. [' \5 g* ^. k
if (!empty($_POST['char'])){
4 B3 h5 }( I6 n; t1 j) m5 [$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where 7 U+ S  |* L5 q+ p

2 p+ ~# j9 I; j! i- q3 \m_szName = '{$name}'");& q! t0 o% U* S6 q; ?
while ($row = mssql_fetch_object($find)){
9 _0 U  Y1 B* R; E/ Pecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
0 X7 w9 R  b; J5 C4 K/ g/ ?" s$ p- b$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
4 o. n. n7 e$ A2 L) @% S, ^- l" E1 j
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
' c1 F3 ?: X- A9 y% ]$ Z& h7 t/ z; e" _1 L( h! E9 I2 T
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
# a* h4 o+ N! ~
7 E( G, M# m. }" \8 gN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', / G1 o& E/ t( q. v9 v

% \! E' h0 x1 ~  I+ p: k! x# I, M" d'{$ElementUpgrade}', '{$ItemPierce}');");- a9 k# x) B% s4 M" `
}
( i; J, h! X/ x6 M* [
8 B  R" l5 D8 y3 W2 A1 y- q, r# l. @}6 p8 J- x, `. Z) b' ?/ v

7 d* ?5 H' W+ N% x+ W5 K}
! _: r* q& o* A9 u4 J  _1 S: i# q4 Q9 t" l4 |* I
$InitForm = InitForm();5 w+ \- Y& X' U3 z/ m# G
$Listener = PostListener();0 A/ B! `7 k/ E( j" h

4 a- F( u$ N& r) B?>
* W0 k6 Z# |! f) |; ?& b) F; t9 Y- w) ?
1 _- ~) x2 d+ x% K: h$ @

( o% x6 D0 @+ ^; U& [) ?! [0 U6 H/ C$ N8 \4 k/ X8 H6 P
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-20 02:10 , Processed in 0.058245 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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