飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1088

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1088
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php( _  {0 a' W6 u) V" `% c( _
function Connect () {
- H# W0 I: n+ gmssql_connect('Server','UserName','Password') or die('Error: Connection to DB
9 z/ v. _: j0 |* S9 V$ r0 t( x# Y6 \
' p) J3 l, g+ Z: z! T+ ~; pFailed.');5 r" k/ t8 ?& S: s. k& ~
}& u6 i' d! c9 S7 M3 i; R( S: a- a4 V
Connect();
. S0 G+ _) z+ K1 i; p' G# ]- F+ H% E0 }# ?  C+ i, S9 T
function InitForm(){8 u7 R4 s3 W  y) x1 b
//layout for the form* s$ t. Y+ T" y) v9 ~, B9 o
echo "<strong>Send Items.</strong>
8 C/ ~  O+ Z7 g<form name='select' method='post'>
3 T+ j. y% `; _7 b+ o! G3 S<lable>Character Name</lable><br/>
: h( U" R, z9 i* b1 S  o<input type='text' name='char'/><br/>: i3 }  V6 @  ~; K2 a0 s
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>; U* c6 i$ p/ l5 p5 ?" s+ T" u, c% \
<input type='text' name='item_name'/><br/>
( E  `% N* Z  }5 p! e# i<lable>Item Amount</lable><br/>
. z2 o  z+ G2 S3 m$ R/ l3 L<input type='text' name='item_amount'/><br/>
' }# N- G3 _; k* z$ N<lable>Item Upgrade Amount</lable><br/>
7 F+ Q  Y8 X" C0 Z4 e& ?<input type='text' name='item_upgrade'/><br/>
; G" V: C/ D1 ~' Y+ m& v" P<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)% k6 Z# b8 Q8 A
( @8 Q( B6 W+ J
</lable><br/>6 [' v; g# t/ H: f, W! [" w' @+ o
<input type='text' name='item_element'/><br/>
8 \5 @4 \8 |( n/ J<lable>Element Upgrade Amount</lable><br/>
1 H( r% B( ]9 a$ L* a<input type='text' name='element_upgrade'/><br/>
9 p! @" W$ |5 P, T1 s<lable>Pierced Amount</lable><br/>
$ P5 y" q* M1 M8 y<input type='text' name='item_pierce'/><br/>$ Q6 G& i$ i" N- f7 o6 {8 Q2 f
<input type='submit'/>
6 @7 E- N3 |7 n( I% h- E9 T</form>";
8 W) }. l: {6 R* Y& h}3 L8 v& W1 B( }0 D  O# p

! y0 z/ q5 Z* b0 _; B* ?8 pfunction PostListener (){4 n7 l+ d. R5 S8 j4 _/ E8 [
//Add more post variables if needed and add them to initform() function aswell
* Q% H# H0 p- m2 s& G! n; A( t' U8 b
################################' _8 d+ E$ M# F5 }' w
##### Connection and Post ######$ U5 y" d4 D3 J* O% ]! f) R, \8 O$ m
################################! @2 C$ U* P3 L: I. W1 g3 U
$name = @$_POST['char'];4 G6 p$ T( y& ?' ~# P. X: H- k* \
$ItemName = @$_POST['item_name'];
* [' H3 l5 m$ t$ v5 q5 o7 h$ItemAmount = @$_POST['item_amount'];; ~) ~* b' \, n. Y/ ~
$ItemId = @$_POST['item_id'];
! Q+ I' ~% v/ [3 f6 w$ItemUpgrade = @$_POST['item_upgrade'];6 z% Q% a9 h1 S% m' p
$ItemElement = @$_POST['item_element'];
4 F8 ]: J5 o. E3 n! y6 u$ElementUpgrade = @$_POST['element_upgrade'];
$ m; F% d+ M2 F+ M- q5 u0 r/ ?$ItemPierce = @$_POST['item_pierce'];" l0 _8 F8 V5 Y6 O1 l' B
################################
$ G$ y$ A2 l+ t( x6 |6 f/ G8 {7 f1 ^/ d; Y$ c
//Check both variables for empty value
- G2 H/ o9 W- V. R
3 O9 S6 M; P( c0 Lif (!empty($_POST['char'])){
6 r2 f& c1 v- l$ C# u$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where % z7 F" G; d3 n9 y1 {

1 q, M; L2 O2 _: b$ xm_szName = '{$name}'");- M2 G: h+ f: Y, u
while ($row = mssql_fetch_object($find)){" y9 ]" P) i1 ]) _- q5 a! Z
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";) {6 @" K+ E0 r; {2 e  Y
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], * Y+ g. f3 C2 @: W2 Q, A" _" h/ Z( z
% m  s9 @" }, E; N1 r! v
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 5 h* E/ h* e8 p) o" `7 w- ]! d
+ }. @! J8 D; k6 H% A. s7 }
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
; {; a8 F5 n3 c
" f4 W& w7 M8 M* U7 E. q# X- `N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', $ [, F- G1 ]2 f- c

5 g; f# F9 N  E* q'{$ElementUpgrade}', '{$ItemPierce}');");9 Y! C# Q& H. |
}
/ o2 x- C0 L% a& x! t6 o6 \3 M* A. x' C" d8 [) O
}4 b2 Q  s& k0 x6 ^
# X% |& l: b6 y( a
}7 p6 w8 m9 U/ c9 Q! M; L
& w) O. m8 f, `/ C: r: v2 P
$InitForm = InitForm();, @" \, N/ M! y% t6 p3 F# ?
$Listener = PostListener();  H* \' l$ @) K+ c! j0 U7 C" M
7 t+ p/ D0 p5 O0 w" Q# ?
?>  o( r/ G/ ~4 v

4 S) `9 g' c0 O3 j- B4 o( u/ [6 O2 f/ l! e3 D( _* [0 k
- K3 [5 a. C* W4 m! b: x! [9 E$ r/ P

. e- e+ V4 c9 P5 A4 D4 p
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-23 10:40 , Processed in 0.061163 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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