飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
<?php+ \- j+ u- Z* k. }9 s
function Connect () {
$ f8 T: a5 E( A% r* W- Lmssql_connect('Server','UserName','Password') or die('Error: Connection to DB ! w& {* H2 I1 l7 |5 U
8 f+ Z  M5 ?" T6 Q1 }4 q( U9 \- S* Q
Failed.');
8 b9 J9 W% F; I. `}
; E8 A8 q$ O2 k  `+ iConnect();
) L$ E+ ]! ?4 Y; Q% l' k
0 Z$ \$ v) {) ~' O2 A2 W: ofunction InitForm(){
, g5 L0 n0 p/ b( s7 J" Y0 b8 {//layout for the form7 P0 \% Y4 d0 a
echo "<strong>Send Items.</strong>9 G) q6 L+ q/ \. i; O
<form name='select' method='post'>
# z, D9 E! m3 l" ?. K* C. x; a( E3 Z<lable>Character Name</lable><br/>
* A, c' k+ k. `6 m3 F0 ]# b% w<input type='text' name='char'/><br/>
; L, g& R+ F4 [<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
8 G' P$ x* H1 N: h2 |( R; S$ K<input type='text' name='item_name'/><br/>
2 q% x- Z2 c* R' d/ ~- {6 }<lable>Item Amount</lable><br/>) U2 G2 r. u; z. X
<input type='text' name='item_amount'/><br/>
. n6 H; [( g. E3 q<lable>Item Upgrade Amount</lable><br/>& G3 t- G/ Q4 B3 h' S( I6 U" g
<input type='text' name='item_upgrade'/><br/>4 a9 r0 M. g7 o8 Z) L. _: r1 ~
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)  t( {% {, P9 Z$ M" B- Q
1 F6 v) D: M  b+ T
</lable><br/>0 Y% G& Z' e9 B
<input type='text' name='item_element'/><br/>; I! H. [% j) j/ }
<lable>Element Upgrade Amount</lable><br/>) p4 G5 k/ c- v6 _# K
<input type='text' name='element_upgrade'/><br/>
9 D) ~  P6 A$ K3 P$ ~+ d( O<lable>Pierced Amount</lable><br/>8 e. X9 `; X7 M, q
<input type='text' name='item_pierce'/><br/>0 g( L8 }9 V8 O8 w
<input type='submit'/>
/ x+ e; y) B2 z9 K- @( W</form>";4 H/ d3 k0 I% X& I8 v
}: I! z+ w! I- D2 Z6 u6 {

( l2 Y% S! i* Tfunction PostListener (){
6 g! f6 e  D0 |: z( \//Add more post variables if needed and add them to initform() function aswell
. S9 d* A/ a$ Q4 g- ^' {* \. O" _8 d# p6 b
################################
7 g' D9 ~& U( m: _: I##### Connection and Post ######
( u" i" o5 {0 f. d8 E################################, x7 B$ B1 k8 D4 w5 P- r* D
$name = @$_POST['char'];
1 f+ Y" @" {1 q" B; _) a/ t, ?* ^$ItemName = @$_POST['item_name'];/ v' y/ A! O) u( |! P2 `
$ItemAmount = @$_POST['item_amount'];2 V! [3 `* R! u, I) v' ]1 J- k
$ItemId = @$_POST['item_id'];
9 y% b* A5 @  C9 k$ItemUpgrade = @$_POST['item_upgrade'];% N2 b9 E' J2 m5 B7 ]) R( L
$ItemElement = @$_POST['item_element'];3 k5 X$ q: @7 R
$ElementUpgrade = @$_POST['element_upgrade'];
1 j) J2 o' e- B# j) e2 ~+ _, o# x3 K0 U$ItemPierce = @$_POST['item_pierce'];
7 c: p- l- [8 E8 h. c. D  b' l  n################################
  i0 T. ^) }% ?9 }) d* S. ~1 q% N) |( p' y% ^! L! g
//Check both variables for empty value: N8 Z+ `  g) s, O5 p6 P
$ |( Z0 R1 |9 b: C! s7 f* H- Z
if (!empty($_POST['char'])){3 B: P3 p: D1 L' j: [
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
- p5 Y/ E3 C! q) o' `, K$ y! ^* X* N+ E# r
m_szName = '{$name}'");
: u+ H! ^5 n$ dwhile ($row = mssql_fetch_object($find)){
8 |' j* n5 l) ?# n0 w9 |echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
6 J) H! g+ ]6 [0 q- J& {$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 4 m! e1 g  [1 ?8 L

: R3 t4 U4 a. R' C3 U[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
* H% G% d1 [# v) e
5 u" Q+ \7 ?7 A8 K( p+ _  T[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',   u* s" j9 K, e% f: N4 J
# ]9 s: \  n8 e; c6 v* F1 X  q* Q
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
5 ]; n# I7 N$ W! Z
" R  P# P2 u% J- i: R" Y'{$ElementUpgrade}', '{$ItemPierce}');");
$ b0 `7 Z; F" c- F$ G; Q" f}- ~1 C* }) U. R" z! G) y( n
# ?9 k. r" x3 n/ y/ |3 Y' W
}+ y* S1 C2 Y$ y+ ^& y

& i; ?6 x* k) m/ D/ Z9 w9 d}4 I6 H$ Q( n0 y/ o+ B1 d
: f, B6 s/ E4 C5 Z/ \! t% V
$InitForm = InitForm();( `* {7 ^3 x) f- o. l9 O1 f# C
$Listener = PostListener();* e5 A- h* b  ^2 q3 ?: q
# i' q, v+ e* p% b4 C( c
?>
' _' P& {# M% |3 @1 E
' b7 s4 ?/ e9 P8 U8 W2 P. Z0 a( p% I5 @: ?* y
8 A" e1 [  ]3 x$ D6 |

0 w. p6 L0 i* _/ _  G
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-16 05:30 , Processed in 0.062309 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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