飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php6 I+ l$ D; d1 p  r. ]
function Connect () {; e% x) c7 a- `4 m
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB , n- Z* h! F  K. l
9 ?  S8 \3 b# V3 m* ]+ }
Failed.');
; l5 o/ s! n4 z9 W; W( q2 R}
( U; M% V. ]8 D1 S( i& LConnect();
7 @$ k" P% x/ w5 Z7 \
3 j7 N" C9 q6 r/ o; h: N: p7 rfunction InitForm(){
2 y5 d  i4 q5 r1 D8 d//layout for the form% l) Y' h9 T: E
echo "<strong>Send Items.</strong>" {3 s% a' S& j! ~% ]5 J: w
<form name='select' method='post'>
3 V# k8 {. n. T% }" G4 I<lable>Character Name</lable><br/>, b. }, `5 F7 X! J3 u
<input type='text' name='char'/><br/>
* S0 y  g& f4 C<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>6 |9 C, i& T- C( |) N1 O/ m
<input type='text' name='item_name'/><br/>
  a0 b. V4 e0 R' l<lable>Item Amount</lable><br/>5 }7 C) u$ j- z4 `4 ~. W
<input type='text' name='item_amount'/><br/>) N) S: `7 T) B4 ^) G. [
<lable>Item Upgrade Amount</lable><br/>! A! D- D3 W) Q* h% i" ^
<input type='text' name='item_upgrade'/><br/>
; d! j+ `+ L8 J5 I" i<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
2 k+ n* X9 q& m3 o% j) ?! @; t" p. u7 w
</lable><br/>
6 u  Z2 o% G$ R( {( [; r<input type='text' name='item_element'/><br/>! y) T* L7 Z) ~, d& v" I8 l
<lable>Element Upgrade Amount</lable><br/>9 g$ Q8 }0 j' t3 `6 Y  {4 q
<input type='text' name='element_upgrade'/><br/>; f9 w1 q; c: n
<lable>Pierced Amount</lable><br/>
& e$ ?; z7 J/ {- m4 L, k+ X! `<input type='text' name='item_pierce'/><br/>6 W: {6 o+ R( a' }- D: t3 J
<input type='submit'/>
5 R, l" t: X# W& v' b</form>";
, r& y: P; E- R2 M' }% L+ [3 d. S}' _8 N; j2 Q, J

3 W! n. ~8 g* I- s6 j, _function PostListener (){
& O5 r. _) {; n6 T( U, D% L$ U0 ^//Add more post variables if needed and add them to initform() function aswell
! r% L- D2 H( H* {! |* l+ Y" V/ B1 O+ y
################################9 ]2 @2 e7 Y$ U5 S) l. J& K
##### Connection and Post ######
9 o, t4 q- C1 B1 e! [$ q5 _: v################################8 G/ l* G+ e3 S; b. F
$name = @$_POST['char'];" z, u  c3 b$ `' ^3 i4 p- j% ?
$ItemName = @$_POST['item_name'];* Y( I& o3 C9 I& R4 t  e, x
$ItemAmount = @$_POST['item_amount'];. l1 n' a! ?5 b( h, R9 E; s% O9 U
$ItemId = @$_POST['item_id'];' J0 _0 M7 w. W8 F5 W2 `2 S# X) s
$ItemUpgrade = @$_POST['item_upgrade'];
9 |( n) M( |3 T/ K8 n$ItemElement = @$_POST['item_element'];" W" X+ z" }  B0 f
$ElementUpgrade = @$_POST['element_upgrade'];
% Y7 d2 z5 \! B/ S& D; m% G$ItemPierce = @$_POST['item_pierce'];4 c" t% S$ s( @
################################- U" E  c. O& ]0 d6 Q" G. ^# u' ^: H

9 Y9 ^$ t8 [+ w% l! W4 r+ q! }//Check both variables for empty value
6 t$ j& ^' `) u( z
, _- ^4 \! ^: j; zif (!empty($_POST['char'])){
1 M" z$ U- `4 K/ A4 j- E$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
% L; g( Q/ @3 h" K0 x: K0 C6 B" J- Q! S+ v' i
m_szName = '{$name}'");, Z" |1 W6 V8 W/ _; G" T3 R) H$ R
while ($row = mssql_fetch_object($find)){3 c1 u; j% D3 @0 m
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
. c9 p, s& p1 E5 J$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], # k1 u& Q' G, O9 y2 @- X3 _
: J6 q2 R+ V; \1 ]
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
& N7 Z, }- u; P# j' H2 k; w4 y; I" k1 a, Y; B* a4 ~3 N; E( x
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
# O( B4 G5 ^* u; N0 ?% E" m1 a* _8 F5 m  u( F, U. z
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', ' Y& C5 \) R2 n' x+ M
0 m( r8 ~/ ~- y$ r- f1 l# x
'{$ElementUpgrade}', '{$ItemPierce}');");# ^+ S, @1 U  I0 N
}
3 \0 a: c: F0 q5 k* S7 A6 J  F# [0 d1 o. L& d9 X
}7 b: c5 A, L/ j, P) c8 _+ L  c

, n$ u4 R$ M, f: d8 @: U/ }}
& ^8 a4 M5 l9 V, A
" t/ }6 S. I, _  w- @$InitForm = InitForm();
8 D+ d) e. V5 V) b$Listener = PostListener();# [4 L2 w) |: R( Z5 f5 e2 E) t2 c

( M& T8 o) m% v* Q( U?>6 G: \6 U2 \3 T$ C3 o

$ M( i/ N, ]% r" G) A
* ?3 p3 y* x) h' u; }
. s3 X9 q: y& _& D
" b, d: m5 i4 R- v0 J8 w1 ^' t* }
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-17 07:39 , Processed in 0.062909 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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