飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php6 C  Y: |+ _5 e8 v4 S% T( c
function Connect () {
& _3 S8 q: T( {mssql_connect('Server','UserName','Password') or die('Error: Connection to DB " I  o& t( c6 L& C' ?! W6 x0 K8 C
& |9 J! N% s) F# p
Failed.');
0 u; M) `* d' I4 |" I: z, ~6 _/ C}
6 l9 Z0 o1 K+ D$ p4 h' ZConnect();
8 z4 U: O; r4 C+ e7 y$ A
: f; m7 \  p5 w% ffunction InitForm(){# N( I9 ^% E, R8 B
//layout for the form3 m1 [1 R! z. f# h3 ]( P
echo "<strong>Send Items.</strong>- y: L6 I; {0 ]2 ]" K$ F
<form name='select' method='post'>
- z: v0 z  G; N# _# b' Q<lable>Character Name</lable><br/>
$ F1 Z- F. K6 h0 P0 m<input type='text' name='char'/><br/>2 A$ T. ?( ^: q: p9 ~' }1 X. a, i
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
: P6 n# k; l+ ]9 d- w3 f" K<input type='text' name='item_name'/><br/>6 X; d+ o3 m& j8 K9 @
<lable>Item Amount</lable><br/>9 L! o3 h) i" O3 Z- Q; c& j6 M0 E
<input type='text' name='item_amount'/><br/>. c' t3 c9 y- H: p; ^
<lable>Item Upgrade Amount</lable><br/>
5 f7 r" A9 o& ?% n( d8 u<input type='text' name='item_upgrade'/><br/>7 p& t- f+ r5 ~! u2 o7 B
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
" M: k, D2 E7 i8 v" O
" M" H: x( ^' H% V" }' n: u</lable><br/>
9 H* j$ [. D/ L6 i( j! x/ w4 x9 X<input type='text' name='item_element'/><br/>
/ J& V3 l) ^- q- [<lable>Element Upgrade Amount</lable><br/>
4 J) y3 P* V1 \' ]7 x. f<input type='text' name='element_upgrade'/><br/>) d* p: z9 |( [5 U: E
<lable>Pierced Amount</lable><br/>
+ O: n9 [$ T# a  d. [1 K<input type='text' name='item_pierce'/><br/>
! p! k1 Z$ }4 a* a  E) s9 U+ ]! ?<input type='submit'/>
% q9 Y1 j! d; B4 ]8 O9 [</form>";; q4 R# N, W4 k' S+ J3 ^( R
}; L/ ]  \4 J4 J, ]% \

. O) p* C, P  [4 mfunction PostListener (){
  Q/ y9 f+ B" k* s% W2 [//Add more post variables if needed and add them to initform() function aswell0 |  T2 ]. w- Y2 S5 s
$ T* `* s$ m6 O" Y7 _# f
################################# q9 R% Q# J" {8 X
##### Connection and Post ######8 Y* Q9 `3 U2 d( v
################################
8 Q) s: y2 R$ T0 F- u2 ]$name = @$_POST['char'];5 v- j. r+ T4 t% H+ ]# Z/ |
$ItemName = @$_POST['item_name'];6 j* N1 x) T" @" G1 K" a8 i
$ItemAmount = @$_POST['item_amount'];" Y- [" z$ e0 `$ E' O- Y0 v( f- }" Y2 W
$ItemId = @$_POST['item_id'];
. q# F) l+ u, o3 d/ i" h$ItemUpgrade = @$_POST['item_upgrade'];
: W7 O, h  `: C4 r' @3 c$ItemElement = @$_POST['item_element'];
: a" T! Q+ i3 A5 h( L* D$ElementUpgrade = @$_POST['element_upgrade'];$ X3 P" g( p: K+ l# {9 v- m; H
$ItemPierce = @$_POST['item_pierce'];
, C6 c# R( o8 A8 K, I################################
5 x( o9 Q0 Q' I7 i7 B
1 |7 \7 I, F' T8 q/ f//Check both variables for empty value
9 ^  O8 y* \* i% Y: M; R9 m% M! c' K# ~& L( i& |7 c
if (!empty($_POST['char'])){
2 `0 I) n1 C* _& w, T% x; b$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where # h" r3 M$ A( V; T5 j8 h3 U
4 S6 p' i. }5 Q9 e. x- _
m_szName = '{$name}'");, S% o( M/ T( I0 X4 x2 r
while ($row = mssql_fetch_object($find)){
" p) L- n( d; p; U% K% {echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
  U9 A0 x; `4 a% T$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
& J; w# s* B5 p, ]4 b  a2 G/ O% K1 y) P4 u5 w% h% q* t8 w
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
0 g4 ]& V' ?- v) _# M$ t/ i0 a# r' W5 ~1 f
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
! ^5 R$ y6 A, l  Z$ v; z5 N- B7 B
; C" c5 o. n3 x- Q  n! Q# S9 P/ G8 zN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
9 Y5 p$ r8 J) _  j4 m1 O/ t- [, m% J+ {! C7 p" x
'{$ElementUpgrade}', '{$ItemPierce}');");- f( w6 f/ C: F) n; W
}5 z3 z( ^2 ^3 R3 G9 _. q- u! i

% W, b! D! M' A' g% P) o; A/ z}
. k9 |. q& b2 F1 I- a, n; r
4 n" c8 d; g& v! V5 h& y}
& [( D* V8 h' H5 _4 u4 K$ S! P5 f& R
$InitForm = InitForm();. Z* f& Z7 r& N9 _% }' ]
$Listener = PostListener();* k3 G$ q1 k2 F+ F
* ]7 @: }' e$ z$ L- U
?>; q# P: g7 Y; ?2 u5 @& V
; `& s( k/ _2 ^/ x- B: N; w+ B8 s
* I" q8 s5 g$ ?& B3 x7 m
: U) n3 O, L* U9 o! \
2 p$ m$ I) M+ ~  f% k+ S5 M0 E7 J
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-18 14:21 , Processed in 0.057227 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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