飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1092

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1092
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
0 y3 ^7 @8 C: P# }. G( C) Y! m- a+ Dfunction Connect () {
3 h+ F# f# q5 bmssql_connect('Server','UserName','Password') or die('Error: Connection to DB
$ W" X' u7 C$ W# d, Z
: C. ^$ ]$ X' \% T( u& {) Y+ h! Q/ [Failed.');& c6 `& p# ^1 K: U2 [  p1 ?
}
1 F& O2 b2 x# ]! dConnect();
% r( G- Y9 c! w5 W! X& J
. ^! u/ i7 V! Afunction InitForm(){
: A. _5 {! `6 t+ N5 `7 X//layout for the form* p0 Q: \1 S/ y( R7 _. D: G
echo "<strong>Send Items.</strong>
9 H/ A: G: v4 f2 d$ r<form name='select' method='post'>4 o7 s+ x/ _2 s& u7 r% B
<lable>Character Name</lable><br/>% u6 J" [. ~6 k6 Y" ~) E3 z# o8 t7 i
<input type='text' name='char'/><br/>% R, Y+ k3 P1 A# t6 v- _- l1 _% D
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>& V7 e5 ~( v: p4 f
<input type='text' name='item_name'/><br/>
9 p% V3 V  b+ b) L7 D% L3 Q% Y<lable>Item Amount</lable><br/>
6 N5 e" k% E  r- O<input type='text' name='item_amount'/><br/>5 G7 m7 k' G8 P. F( s. V
<lable>Item Upgrade Amount</lable><br/>
2 F" h$ {! f) y7 E<input type='text' name='item_upgrade'/><br/>
5 m! R$ |2 o) O<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
; o, F. `0 s( ^7 H
& m  ^8 P- h: _5 g- j</lable><br/>3 V( N+ W7 Z1 \3 _. H
<input type='text' name='item_element'/><br/>& S) t: `- ?; C7 i' n
<lable>Element Upgrade Amount</lable><br/>; G$ h$ J* L; a& f
<input type='text' name='element_upgrade'/><br/>8 b' [3 H" J+ i7 p8 V2 z7 k3 D
<lable>Pierced Amount</lable><br/>2 T: l3 X; W. ?6 y* \! |& _" d
<input type='text' name='item_pierce'/><br/>9 u8 z7 q+ S* W8 z1 V) Y
<input type='submit'/>. C; G( O2 g5 n) @6 s# t
</form>";9 A/ Q/ x( V$ n6 k2 u
}* a9 ]9 ^' D" T

0 v. A- ~2 x2 e& n/ @5 k6 G8 Sfunction PostListener (){: p6 f" p4 |8 Q
//Add more post variables if needed and add them to initform() function aswell  [& @5 q& E5 N' |
. L/ I* T# ~6 |& a  l  f
################################
5 x; a( k6 u$ O+ x" e4 N##### Connection and Post ######
$ P( W1 x9 m: S7 \6 \################################
; t: Z9 f9 [+ v$name = @$_POST['char'];5 h; L: g* z# M# J
$ItemName = @$_POST['item_name'];
3 g1 K! p+ Q1 _$ItemAmount = @$_POST['item_amount'];  f* h5 q0 {3 }' \2 V
$ItemId = @$_POST['item_id'];0 |$ u% B( ], ^' }0 [
$ItemUpgrade = @$_POST['item_upgrade'];0 B3 d. b' {% K; X& j+ z3 g
$ItemElement = @$_POST['item_element'];+ v8 _' w6 s7 V7 d  I
$ElementUpgrade = @$_POST['element_upgrade'];
" P! |7 m* v+ j% }  q, H) f$ItemPierce = @$_POST['item_pierce'];
6 P! J% k# T* G/ S################################/ d- r- a+ J8 }" I9 `% Y# a
; \0 @( ]! M  ]3 \; e* \6 z- J3 I
//Check both variables for empty value
6 l1 M! C9 Y1 _# v( P# R- g7 _6 C+ H" J. |' g5 _
if (!empty($_POST['char'])){% j4 b8 B( D1 ~$ e6 K+ y
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where 6 D6 f2 z% o& r3 k

! d- q  R  W# @+ K/ L6 u/ i+ {m_szName = '{$name}'");
0 G( g% G$ S- u# n2 Z+ gwhile ($row = mssql_fetch_object($find)){
$ W. K5 O4 X& ]echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";! F* L% c* B0 J$ L
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], % ^0 y- X: k4 ]. m8 I, S& T' ^
: p7 \; S3 w0 y4 m
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
1 H/ j8 ^; C6 b* E8 n. W
; v6 r4 V2 W9 B; O: W, p[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
1 S0 [2 O1 o% Q
2 H, l4 F# ]9 J3 o4 ?$ WN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', $ O& @8 m" w- V2 h3 w
+ ]9 Y0 J, \6 Q, L# K
'{$ElementUpgrade}', '{$ItemPierce}');");9 Q( m7 n% c3 A; G4 Z# ~! }
}
3 B) k8 m* |6 R* d9 F
5 I2 g6 e1 H7 j* j( @7 H}
  i' @' J7 ]  i
9 L2 a* {+ d: g7 s' q5 m' E, B}
1 p( ~7 g* o) Q6 d! u( G/ s9 o7 v8 p9 Y/ u( X. P- K# b" `
$InitForm = InitForm();: ~' J. }; V! \" r
$Listener = PostListener();
" f( q& _' a% L" b/ h3 ?% \' U! ~* s" q6 r+ L7 f, |; S
?>
: }4 g# }# D" {: Y! ]6 j
) P/ K2 A7 i& a! Q5 X9 L  _4 x9 Y7 Q0 y4 K# G/ P) _5 X
; `/ l) `0 }3 K% S! l+ Y4 Y

0 ~( W5 s4 K8 E- k4 E- ~
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-30 21:39 , Processed in 0.065967 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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