飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
- L% I# D  l. M$ Ifunction Connect () {
3 Z* ^# `! O+ ^/ Fmssql_connect('Server','UserName','Password') or die('Error: Connection to DB 9 p& ]  k$ x: v" @( J2 H5 n

7 k" ~8 }. N5 y8 v5 _/ yFailed.');9 @" i& w5 y2 R2 o4 l; s( d0 r
}+ e/ o, C( B& f0 g2 F) x
Connect();
0 W4 F: L- [5 u& q5 I5 C$ |4 M5 o; d) u% e+ L( r, X
function InitForm(){& e- Y% ^+ X7 _+ r  w$ I
//layout for the form
& b( F% i" c5 {echo "<strong>Send Items.</strong>
. ?$ x. C9 H2 {7 A: i' d<form name='select' method='post'>
1 |, j5 |" E, n9 u& A<lable>Character Name</lable><br/>5 r6 T. S0 s& S$ h! h
<input type='text' name='char'/><br/>
& G; Y* ?9 g0 }, Y2 \8 m6 ]7 ~<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>/ p" A+ |5 z: B
<input type='text' name='item_name'/><br/>
) R( \1 @7 m# m9 K# t<lable>Item Amount</lable><br/>4 Z5 D# K/ {1 u! A
<input type='text' name='item_amount'/><br/>  \/ S: e0 ]8 g# E
<lable>Item Upgrade Amount</lable><br/>+ P: g% s$ n- e6 n( ~% f0 Q
<input type='text' name='item_upgrade'/><br/>
% F$ e! E' N3 K3 V<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
9 U, d4 q3 U- `( X* j" t% v$ q: O3 I2 {# O1 u5 L7 T; |# T
</lable><br/>
! U' {' Z, v$ S+ T6 W- E' u% {<input type='text' name='item_element'/><br/>
. U+ V# J( G. ^' n7 L! Y) ]1 F<lable>Element Upgrade Amount</lable><br/>1 d$ X4 H% V4 y; S
<input type='text' name='element_upgrade'/><br/>& z9 Q8 i4 N; J3 V1 X! W
<lable>Pierced Amount</lable><br/>
" c1 `) y3 n4 W- b7 N<input type='text' name='item_pierce'/><br/>' ^& a) R5 a+ O' T) |
<input type='submit'/>  X) U& h! H$ r: x
</form>";: m* U' W. c- j' ]/ L: O) n: t! F8 b  B
}( J, t. Z. C0 H. g! w

- d0 P6 t8 |6 ?; W: U) Cfunction PostListener (){' a, N' b3 V0 ~4 E  t
//Add more post variables if needed and add them to initform() function aswell
0 c+ k. I( l% g4 Q
! F: B8 _1 I- J" k2 v6 Q################################
' G! K  a* L+ @: B& f& v# A2 Q##### Connection and Post ######; F! B% P# f; w' ]
################################, v( l, e9 G, @, t
$name = @$_POST['char'];' N5 t) h0 V0 B# S* V( n
$ItemName = @$_POST['item_name'];
3 C' M% H+ W# z! d8 b* \  I$ItemAmount = @$_POST['item_amount'];
1 s; s6 ?5 l9 C9 @' L; j/ g$ItemId = @$_POST['item_id'];, X' x4 u  V) E
$ItemUpgrade = @$_POST['item_upgrade'];
8 i4 a" q$ I5 p3 M% D" r$ItemElement = @$_POST['item_element'];
- x" k" }+ _1 S5 Z$ElementUpgrade = @$_POST['element_upgrade'];
* L/ Z  U1 [# C1 l$ItemPierce = @$_POST['item_pierce'];# X* b# G1 \$ \7 Y9 ?' J
################################) r  M" t% B* \: b: j" W9 O

# T$ |: Q& ~, F9 @- M7 x9 M5 U//Check both variables for empty value
9 M) ?2 C+ D* z/ E6 a0 O% a
+ T: V: T6 C) z  y6 oif (!empty($_POST['char'])){. n+ M' S3 O* E& T/ ?# s
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
* c2 C: o$ l2 U, q3 Z& D) W) t3 w
m_szName = '{$name}'");
7 T: `" Z2 i% X/ Ywhile ($row = mssql_fetch_object($find)){1 t; A$ q7 o! S! N* I, ]9 l7 ]/ H; K
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
3 b8 u- f5 Q. o  j$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
7 X  V! M2 U% x4 A1 _) A% C1 J7 E$ t" A5 D+ G0 E% F
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 2 W( Y" R5 K) Q  o
0 \/ x3 N6 o% }' G# [( @2 H
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
& T! j( R3 v  |5 \$ }% ~/ ]5 Y; J, F5 ~! J
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', ; d: ^; f3 z. x$ z$ @  T
' I/ ~+ F$ y3 j: ]
'{$ElementUpgrade}', '{$ItemPierce}');");
& g( B# Q! B5 v/ V! `4 ~& ^8 W}# V0 N5 G# [* d
; P* t4 p2 o1 K! u3 H  c
}
. p# g1 x% [2 Q9 k/ q8 i4 \- V9 u$ n7 E( j7 m- d0 F
}
- L, ~% }7 H; F' ]  l
' \1 j% j1 \4 u) M+ \8 ?$ \$InitForm = InitForm();9 y, Q2 k8 b* _8 I+ C( b+ S
$Listener = PostListener();
  B5 Q4 I% v! W) V
( V+ k2 ~+ b; l% e?>
7 t- W! l; h1 p. _
- g( l2 ~, M. ]! o% C4 s0 l! U1 j9 N4 [2 ~) J1 k& R
0 n+ `6 F: w' F! ~

2 J8 Z6 I  B1 ?7 y: ~) V
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-23 00:50 , Processed in 0.059747 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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