飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
; r) d% F0 Y2 S  @2 X0 r. h* V8 Cfunction Connect () {6 N# |) `- A( C0 w! y5 C6 I( g& w0 I
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
% N+ m9 z3 R+ L: G2 S0 T9 F
$ n/ d6 n: E" G2 KFailed.');/ k& J7 x7 r; Q3 ~7 ]; p/ ~! R7 K
}
: U5 A" h" ^. F  Q+ w# CConnect();4 I% w- t6 T4 w$ ~

  u1 r  d, K5 D+ ]/ G. xfunction InitForm(){$ a9 a. q/ i- N) E
//layout for the form$ E7 N$ c. o9 C; ?! }
echo "<strong>Send Items.</strong>
" s: u  i0 V: K8 f1 y<form name='select' method='post'>
! n* T- N  ?  l' f0 L% p7 K  X<lable>Character Name</lable><br/>. \9 V& }" M0 m/ y  t" e* G
<input type='text' name='char'/><br/>
; c1 ^; W7 N/ S8 Y; F<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
# x0 I7 \6 X% o8 \5 x+ T<input type='text' name='item_name'/><br/>
8 x$ d# w+ {2 {" ^. n2 l<lable>Item Amount</lable><br/>4 [% V8 g9 F1 O& x  u
<input type='text' name='item_amount'/><br/>6 d. _  G# H: d! `1 ?
<lable>Item Upgrade Amount</lable><br/>: F7 ^/ ?; O9 p7 l  M4 ^
<input type='text' name='item_upgrade'/><br/>
2 o. ?5 R" t2 b2 t* h/ l<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
3 {# Z% P. K( S! V2 {! T* d  I0 ^
1 _8 G) `( p9 y4 n4 z</lable><br/>% M% z! `6 P2 [2 ]" @* B
<input type='text' name='item_element'/><br/>
; e! b+ s; |0 f' Y* y8 t<lable>Element Upgrade Amount</lable><br/>
" Q  }6 a& w8 G" F5 _<input type='text' name='element_upgrade'/><br/>  J* Q2 S6 X! P) R' I0 ?
<lable>Pierced Amount</lable><br/>
' h) ?, b  l. P# L& D<input type='text' name='item_pierce'/><br/>* S, s  ^7 M0 o2 S
<input type='submit'/>7 R# H2 H$ z8 P9 X; X
</form>";* B( P* g* h5 G
}
7 U2 ^2 R& x; }# y% b
; k) Y7 O( K3 D6 Z8 ^3 lfunction PostListener (){" E- `* s* E/ W
//Add more post variables if needed and add them to initform() function aswell
) _0 f' B& V: M; L9 z2 D
5 Q  ?* O( ~) M4 a* m################################7 m5 w* }: ~) v- m
##### Connection and Post ######
5 M! A+ [' U; J/ [' L! ?4 k7 Z/ S4 |8 o################################
' g; F( y7 W$ O6 W1 l7 o) F' o$name = @$_POST['char'];6 G0 w( |0 q- N9 B+ k
$ItemName = @$_POST['item_name'];- Y' Y3 E/ S7 {# p$ s/ \, T0 k; \
$ItemAmount = @$_POST['item_amount'];
+ t6 l' w7 A. L$ItemId = @$_POST['item_id'];
' l+ d, K8 x8 D2 K  K7 L; v$ItemUpgrade = @$_POST['item_upgrade'];
( `3 |$ r9 F$ Z4 n, X- V$ItemElement = @$_POST['item_element'];8 o: k- b6 V5 i; M1 L0 w; G+ D
$ElementUpgrade = @$_POST['element_upgrade'];+ d- x; a9 y9 j5 m
$ItemPierce = @$_POST['item_pierce'];
, z6 e6 K, k$ f* Q" c################################/ Y# C+ s" b0 Y( f/ n

* I  L3 h. M  ?* _9 w: I2 X//Check both variables for empty value2 Q: D0 E* f$ g* U) h

3 [: g: V5 i8 B" {; x' M2 Jif (!empty($_POST['char'])){1 M. [1 n* H$ l
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
) Z& S  k# D6 y, Y& c! l5 ?. ^6 k6 B; G: P% i4 b: j
m_szName = '{$name}'");
* Q5 D9 p* H% K) `while ($row = mssql_fetch_object($find)){
/ p0 n8 {/ g9 x2 z- }9 |echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";) w5 U% O2 S8 Q! E3 G9 ~
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
: y# z% s1 m: y% u" I
. @$ l6 r3 }6 O% w* ]+ q/ A[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
% G" `; g9 d0 B' ~8 P
; M1 M6 K3 V+ _# G! B& K[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 8 I0 v+ N  q0 J7 \0 a

& |& Q# X  ^3 D- FN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
, {) R$ ~) h) n; C1 E1 F
' T2 E3 g/ _8 X# W& g'{$ElementUpgrade}', '{$ItemPierce}');");
6 x& w8 e6 _( p: {}  |: o0 X: G" Y+ _% n# p
0 r5 S2 U: x' E: o
}, Y% Y  u' e& J

  Y2 x. J6 M3 T}  j$ t8 _. C/ w) B- s( C9 h
" L8 F9 U2 {/ m5 _6 V7 K$ D8 t. M
$InitForm = InitForm();
" o. g& d; w- r  j, w$Listener = PostListener();; s2 e( `" f# s5 p, v0 @

* S, j! M. t! C+ F7 b- I?>, A% b  y+ i1 b3 v+ H4 H
2 j& X, B" h6 i- r

+ Z  T4 l, o3 y& v1 t
$ b' r; M. y2 A$ b1 f2 K  R% U  f* r+ |/ u1 K2 F
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-7 10:24 , Processed in 0.069973 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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