飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
4 [0 o7 a$ ^4 h& O" G* afunction Connect () {
$ i/ L7 G/ w3 Z9 \mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
/ N/ N. F. h# o1 C6 q& T8 [
" O: L! `# N- F: j  {% ~4 aFailed.');( J2 l+ Q3 I! S4 `  a/ I# K: g
}3 I: b4 |( `2 t6 }! @
Connect();
- T% j" A8 C: P* L1 N' ^6 C: U
' p' L9 `6 P& \* p5 h7 rfunction InitForm(){- G- t7 _2 q8 p. x6 w
//layout for the form% f* J& g# [) g
echo "<strong>Send Items.</strong>: v9 t) k; ?  }0 b( ?1 R
<form name='select' method='post'>
/ M7 n2 p9 h& T$ C' j5 l, G* F<lable>Character Name</lable><br/>
& R* d2 M/ c' Q2 G<input type='text' name='char'/><br/>
4 q( Q+ P/ t2 @; H<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>* M  r, ^& Q) X7 a9 [4 E+ S
<input type='text' name='item_name'/><br/>
, F5 t& {; ]- K% _1 i: Y, y/ Y<lable>Item Amount</lable><br/>
, ]& O: w. V! p( \+ c<input type='text' name='item_amount'/><br/>( ?: s+ F3 }# ~
<lable>Item Upgrade Amount</lable><br/>7 R; U9 w$ Y  S
<input type='text' name='item_upgrade'/><br/>
# i2 Z8 F2 H  C9 Q: k<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
, H, F9 G/ T. w2 I& ], \5 W" H
0 N4 i6 v1 y) k, L- X" w2 @, Z+ }</lable><br/>
9 F/ u, C# x7 q3 b0 e) o; x<input type='text' name='item_element'/><br/>
$ B$ @! h& Z3 Y# H, y5 }  j6 b<lable>Element Upgrade Amount</lable><br/>
1 |1 F4 F8 ^! M  [! ^<input type='text' name='element_upgrade'/><br/>/ w9 f, U2 V" R5 t; p
<lable>Pierced Amount</lable><br/>
+ k+ |! r/ F6 A( k7 s4 g<input type='text' name='item_pierce'/><br/>( B, f4 q/ T* q3 p5 n
<input type='submit'/>
' P9 w6 S, w$ a. g% d' E</form>";
! }: T( V2 n9 C5 D$ c2 D/ w}# o. t8 ~0 C! u/ N! Y- P

7 J* f6 x! @4 `: S4 J8 Z# r& jfunction PostListener (){  c) c# ~+ C, `& |) S
//Add more post variables if needed and add them to initform() function aswell# H' l0 H" N0 \

: Z: ]( [+ K! h################################
8 W0 g$ E8 W) ^##### Connection and Post ######
/ A/ k9 S  d) `' n2 A. w" K  ?################################( r9 |8 M+ D% b( i2 ?$ h& R& l7 N
$name = @$_POST['char'];
& z, N" Q' k0 A! [2 m$ItemName = @$_POST['item_name'];# i+ n  V" L$ Y; Q' h9 ~2 z
$ItemAmount = @$_POST['item_amount'];
3 x$ d# i% A& G0 f9 T# D$ItemId = @$_POST['item_id'];7 S7 B4 {( E) c* }* t
$ItemUpgrade = @$_POST['item_upgrade'];
2 b+ p4 k0 B; W7 r: d9 ?$ItemElement = @$_POST['item_element'];
* j9 c- d" }4 c$ElementUpgrade = @$_POST['element_upgrade'];2 l& v# M. v- U7 Y( I2 k$ h5 N
$ItemPierce = @$_POST['item_pierce'];
- s( E7 M" D9 t################################: J7 ]& h/ u; [7 G. l

$ R' q" C. A: w; N& l//Check both variables for empty value8 [' i9 ?  C6 f" i

: `/ }, B6 r$ Y+ Dif (!empty($_POST['char'])){
* ^& v; a' o& j1 h6 J# \$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where ; d, }; q4 J' o. R( m) E) F
$ m  I  f4 O+ i+ ~( a* X2 l
m_szName = '{$name}'");5 V8 N: U6 x& k# \" x% V% X- c
while ($row = mssql_fetch_object($find)){! q/ O# D$ K# w
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
* s/ e" b1 O- q, X) K5 P0 U7 y$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], - X% l6 z9 B2 f, S& j: U! t

. d! G$ k) Y% h+ E2 x, x6 c[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
4 }. }9 ^& X' r, l, O4 ]/ u1 V) v$ f" h1 @9 k0 k! v
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
3 d$ r$ g# u, R! ]4 [9 t+ v% {# |! w* ]7 @6 q( x, t5 T
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', 9 m7 s2 H8 E" y1 t

, C" T5 T: X5 i- c'{$ElementUpgrade}', '{$ItemPierce}');");* a2 U& E- v0 R7 ^  d* S% ~
}
3 C- ]! [2 E0 U- E) O  l9 z1 p
9 K8 Z. Z/ d9 V6 [, J! F}( W/ u' G+ g  d0 u+ v
1 s) _+ `6 J. a0 b* ~- D4 E
}) T  a/ \/ O) x( P

* {2 q/ O  Y5 R. Z* A8 X$InitForm = InitForm();
- r1 A1 v2 p! Q# |* ?% R5 G9 h8 z$Listener = PostListener();- U4 D" R6 X5 V0 G
6 S+ B) y, H  k5 ^
?>/ X( c6 E, _3 `0 A6 _6 w

; v$ J# h* M' w1 K7 D
. |7 J0 F  h5 y) B5 i% V, f1 B
5 z9 [9 U, V( u0 a2 `( `, d. c/ C/ |7 @4 ^
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-10 02:54 , Processed in 0.059386 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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