飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php* n+ A' U7 a1 o3 Q
function Connect () {
2 f% W* D+ x, n" }' q9 m2 X! Nmssql_connect('Server','UserName','Password') or die('Error: Connection to DB " |  ]1 f" K7 ^
: ^' c1 f  |* }# Q7 ~
Failed.');
. W" N+ i1 v* [5 i}
9 r8 Q* e* q: G- B7 {! C4 qConnect();% C  o8 r7 V# {* j( e
6 ~' k" j/ c. y5 n7 W# d
function InitForm(){) S) T& {5 x/ n
//layout for the form% I4 V: L$ T4 j( ~; R
echo "<strong>Send Items.</strong>- ?' H* t  Z) ^. ~% X/ M
<form name='select' method='post'>  f' ^4 j6 ^8 R9 o* o- k, D
<lable>Character Name</lable><br/>3 Q" I* ?* D* L6 ?. U0 |- ?
<input type='text' name='char'/><br/>
2 ^8 Q+ p3 P, T: Z3 v, H<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>6 J& X9 @2 n; }4 t0 p/ @% m- c
<input type='text' name='item_name'/><br/>
; |0 z8 e" n  C% U4 k- T<lable>Item Amount</lable><br/>0 B) U/ N6 L* F' ^- w2 y. u
<input type='text' name='item_amount'/><br/>
/ x: w8 J: g$ J1 z" f1 C- x<lable>Item Upgrade Amount</lable><br/>
$ F; l, ]3 A) l<input type='text' name='item_upgrade'/><br/>
/ E, c" i' n" ]& S$ I<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)5 b: g( o) ~% u. ]3 ~2 g; ^& J1 t

' G; o3 g. ^! s- W</lable><br/>
4 Z, c& j. O* y& R9 t<input type='text' name='item_element'/><br/>
; F  z) i* ~5 @& C4 m9 n$ }<lable>Element Upgrade Amount</lable><br/>9 o2 @' W+ m/ O3 Q/ s+ T2 N' P
<input type='text' name='element_upgrade'/><br/>2 U; ?* O* N9 k. ~% _
<lable>Pierced Amount</lable><br/>
1 P, V. N( p1 @9 ]( |- k<input type='text' name='item_pierce'/><br/>* E0 M& l4 @3 ]# w+ ~0 t( r! z# m
<input type='submit'/>- T, F: s. n8 }' }0 D
</form>";# R4 _9 t. \8 o4 S7 F. r
}
7 e; z% Z6 b( V  W* W
3 n: c' B0 s) v8 Sfunction PostListener (){
8 ~$ e5 i# T$ V//Add more post variables if needed and add them to initform() function aswell
! T6 H( D% }5 i, u) G( A/ ]: Q# C( q& b' A( D$ [& u# R
################################
" ]3 P8 a' _9 I; X, K1 N  Q& @##### Connection and Post ######0 [% Z; D% {7 P9 ~: n3 ?
################################
$ N1 f& T2 ^: B2 ~  G- G$name = @$_POST['char'];& D( i  s# B9 [1 n& y4 y2 |1 x
$ItemName = @$_POST['item_name'];" `+ x9 n$ r. G0 Y6 R. y
$ItemAmount = @$_POST['item_amount'];' |* m3 U: E+ g# Y& }9 G
$ItemId = @$_POST['item_id'];3 y& c* `3 ^. Y0 A
$ItemUpgrade = @$_POST['item_upgrade'];5 e% j) p. V  [" d: D; s* w7 C
$ItemElement = @$_POST['item_element'];( p# f! l4 C' L3 D6 l1 u
$ElementUpgrade = @$_POST['element_upgrade'];) C7 G; T9 T. Q, j  q% M
$ItemPierce = @$_POST['item_pierce'];2 z$ D7 `) Y7 L* w3 Q) I3 M* K5 g( Z
################################9 v0 i! L0 W& a# S8 {# P6 F
9 t& B" x; |( i* }9 N* u, z  f
//Check both variables for empty value7 R" i. N& j  W  p1 I0 `; }0 A9 {
5 g5 ?- B2 A- V( O
if (!empty($_POST['char'])){8 R% k' A7 ?. E- J9 m- M0 @5 h
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
6 u' O) g1 ~; N1 h& k& M' N& p  T7 M* i2 x) n5 K5 F
m_szName = '{$name}'");
# d& ~& G  D  \# gwhile ($row = mssql_fetch_object($find)){4 o" ]) d6 V2 p) b/ i- w/ h; h
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";/ j4 P4 \) z2 u' |6 x8 B- a
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 9 ^1 U; w+ i1 L/ P2 x- Z2 `
" x  l' W; B% @4 e/ z0 \
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
8 p; d# `$ Z$ X& n0 c" \) E8 t' `( P1 a8 i" H
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',   [0 H, M& _$ o+ W6 D# T' B! {, _

3 L$ G( a: t& @* L3 pN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', ) U& M- w& X8 C

6 F; _# u6 @0 f/ `2 `( B% ^5 `! f'{$ElementUpgrade}', '{$ItemPierce}');");1 n2 J8 j# K: F4 I' `
}
& c9 T; R2 V" w/ D- Y+ T; {
; K. y" Y% g$ g$ R1 I}
9 O* \  R9 E8 P
; ?* U+ \- s" ?1 r}
$ u/ Y- ]$ A& c0 `) R: C1 `( @
$InitForm = InitForm();
4 B) Y& g7 _" Q) Q" O  g$Listener = PostListener();
3 w& U. t2 [5 `4 b1 C$ s1 B/ ~  w4 N( P6 V
?>
, n) Y* c; {0 y: X; `" T
5 b2 J/ D7 h+ R. b/ @3 |0 v, u) h7 @

/ T' ?. K; H0 f" P* b  F+ _
' _: l  k: ?6 f  B: l4 k
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-13 02:39 , Processed in 0.058220 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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