飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1090

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1090
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php& i& t/ L# M: p' l; [
function Connect () {# {0 ~2 B9 K+ s
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB 7 m$ o' g! j! [8 \
3 Z7 L* W, W$ e5 }2 n; L3 f
Failed.');
8 i5 c; w( B8 V2 [# a) i) e; ]}
- L* g; |# p" Z) C5 j# i2 u, v8 v0 PConnect();
6 {' j% }5 x& w( s& V
. \3 _' C+ w# q& ~3 P7 r! pfunction InitForm(){2 D0 \5 a2 E/ d) s5 D
//layout for the form1 ~, N3 c5 v7 }3 c1 T; D
echo "<strong>Send Items.</strong>
9 Q2 ]3 R1 s9 m/ j9 Y( }$ u, ^5 U<form name='select' method='post'>
7 c1 [  c/ R2 E' R2 x<lable>Character Name</lable><br/>
1 P# y( R! S2 E0 M! h. j- O<input type='text' name='char'/><br/>
3 [$ _/ j9 f% n1 K$ p5 G<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
- k9 d! Q5 Z$ c<input type='text' name='item_name'/><br/>0 Y: ^& h2 y& d
<lable>Item Amount</lable><br/>( Y& ]( `  M2 d1 d( j" d* m
<input type='text' name='item_amount'/><br/>
5 O9 p, J& Z8 f  T5 W6 t- h<lable>Item Upgrade Amount</lable><br/># w5 u* n$ n6 f1 y  L
<input type='text' name='item_upgrade'/><br/>7 B5 E/ z8 }) I( ]
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
+ x' A# U. g. d: k2 T* d$ j& Q( i* s
</lable><br/>
% i+ w: I, s( t9 c: P0 j2 H8 [<input type='text' name='item_element'/><br/>
8 v, K% Z5 V8 d# v<lable>Element Upgrade Amount</lable><br/>
9 |* n* b4 E. P; P* B0 i6 O! o; f<input type='text' name='element_upgrade'/><br/>
0 N4 g" d$ C" {2 ^<lable>Pierced Amount</lable><br/>
' I* A7 o# U6 u1 T4 Y5 \<input type='text' name='item_pierce'/><br/>+ l% O2 l. D% @+ |" S/ `
<input type='submit'/>" q( k" [- n% X6 U$ j
</form>";
# t# i( _1 m/ e( X3 U}8 T" B. {  z9 d" _2 d
9 W3 ?: q8 |& P- e% e1 \1 l3 u
function PostListener (){% \! U  K: W6 c" s; `% W: h1 m
//Add more post variables if needed and add them to initform() function aswell
$ {: k+ A1 G7 g% |: k/ I) Q) f
################################; z, i  U! l  m' P: s
##### Connection and Post ######& }! z* j5 y* ?5 Q% t8 g1 \- [
################################9 o4 ^5 V" d. f
$name = @$_POST['char'];
& T4 h6 W6 N$ `$ItemName = @$_POST['item_name'];2 a! p2 q' Y3 L: m
$ItemAmount = @$_POST['item_amount'];
% `$ V, x( p$ p& X) s% d7 M$ItemId = @$_POST['item_id'];
! z* f, |! A2 X; G4 P$ItemUpgrade = @$_POST['item_upgrade'];
  `* s8 y% f' `* `# |$ItemElement = @$_POST['item_element'];' f& |. K6 v' u3 f0 j4 \( T/ \8 j
$ElementUpgrade = @$_POST['element_upgrade'];
" J: r  k' M& f( u2 @7 ]$ItemPierce = @$_POST['item_pierce'];
2 |9 r7 E& b2 l0 U2 ~; Q################################
0 W4 I2 ?' p9 C# s% T" Y
4 q' N0 o6 M( \2 l4 \- V7 f//Check both variables for empty value
- {; U) d$ M1 b& U$ I
1 I' A; h6 F  R+ f* p- {if (!empty($_POST['char'])){
& H; `4 c9 E5 v+ q9 N( U$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where " \1 L9 X4 c) k4 S  r
, q% L# ?, _$ N+ T
m_szName = '{$name}'");
" X# A, U, d: ?  e+ m% C( Gwhile ($row = mssql_fetch_object($find)){( {4 H6 V$ v' E( s1 h: h
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";9 B5 H# M8 F' F2 I. X% P
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
- Z. n9 t3 k7 {- u4 r/ U; U( X+ r: L6 L" |" {  J: ]  u
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
& R; L" D' O, y' |( x2 d1 C. b7 J- k7 r& C
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
# q8 F6 D. T0 u5 g! W' u" G7 W  e; P
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
! H0 G" B8 ~7 m( U8 B
' G0 i) q! H: l# S$ l4 e'{$ElementUpgrade}', '{$ItemPierce}');");7 n! s, C9 z) m+ e* y+ z* I
}
! {/ }; i* g( c9 D8 o7 c. H* E$ W" U
+ q/ ^! z1 z) }5 l: j}
( P5 v& a4 h: {6 Z1 w+ t7 V9 P- d7 _+ k$ |' w
}) C6 a8 B9 b, G& |5 z' q3 Z0 S

1 n  s- Z! F! z' l% ?7 h6 l% `$ T9 a$InitForm = InitForm();
6 a6 O3 j3 l! O# Q) e1 O$ c. M$Listener = PostListener();
( f4 k# Y% b: u& ^3 r
( x- @/ W# o6 v* a: t?>, g. n4 B: u" |, H
* S7 z, p6 t4 ~. I: \' ^' l6 R1 W
3 l9 l7 h7 E& Q; u' f* `
( t6 M; S( l" v8 k7 N+ x& @; m

1 D, Y6 ?9 @1 n3 p3 f
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-26 09:13 , Processed in 0.065072 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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