飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php! w( U! B7 U# Y+ |$ Z
function Connect () {9 W- ]8 a9 H$ Z6 c
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
% |2 \1 x, c# ]# k" o% x- ]9 V6 b- x# B
Failed.');
  m; S3 W" V* C0 y}* B7 r7 V1 J+ A& q4 q5 ]4 l
Connect();
7 h% z& C; j4 V4 s6 K3 Q$ ?! g1 r9 f0 ~, g/ w3 L% w
function InitForm(){
5 e9 l% Y- \0 _1 z, l4 r/ p$ @//layout for the form
. U6 h5 i1 H: M( r) [( [$ Y* S6 [echo "<strong>Send Items.</strong># p: q4 \4 v, D- d1 ^" W
<form name='select' method='post'>  E/ T% h# Z. I3 x0 M* t
<lable>Character Name</lable><br/>
: b9 {& |7 y' w# X: i/ Y/ |2 n<input type='text' name='char'/><br/>
' h/ ]7 H. D& ?  P/ R<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
1 O  n* S* R7 i<input type='text' name='item_name'/><br/>: b. f4 W. K4 X$ A+ t" e
<lable>Item Amount</lable><br/>
  L5 q+ V1 C) ?9 j9 a# }<input type='text' name='item_amount'/><br/>% r* o% F$ i( N5 L) e' N
<lable>Item Upgrade Amount</lable><br/>* t4 N5 F$ d" f  z/ G
<input type='text' name='item_upgrade'/><br/>
! f) J0 M0 ^5 ^, J, g& ~<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)2 m9 G2 e( u, G4 z( ~1 P* i

# w( M5 _  |; |6 z, T4 V- A" k) q</lable><br/>
0 ~  d% A8 v* f<input type='text' name='item_element'/><br/>8 T! {( L1 I- d( L# ?% L# c7 Y
<lable>Element Upgrade Amount</lable><br/>
0 u) k8 A1 z1 Q8 R<input type='text' name='element_upgrade'/><br/>' B& W2 [9 [2 d/ L# L
<lable>Pierced Amount</lable><br/>
/ j* d! e3 ^, I, Z, ]+ ?<input type='text' name='item_pierce'/><br/>5 {3 _  m$ U" ~: C" t, @. P
<input type='submit'/>2 F6 y7 H; ~/ I6 d! F
</form>";
; u" n7 I8 R! V) V1 e$ w}
2 I8 j4 u0 }" c
8 K  e# i7 B( S/ \' R: T; y: C  yfunction PostListener (){- @5 @8 H# ]  c* q( y
//Add more post variables if needed and add them to initform() function aswell
( F; {& F5 T, @, d
0 c( E: d) \, j; c################################" {0 Z9 V$ y# W6 o. j/ H& q
##### Connection and Post ######. _3 k6 J$ J. Q( n* Q9 u" `
################################9 {, T- O/ N$ {- L4 J0 q. y
$name = @$_POST['char'];
$ H( f- g* J. {$ItemName = @$_POST['item_name'];
0 p, H! q5 _& U% v( A; ~$ItemAmount = @$_POST['item_amount'];
) v6 s( D1 C; U/ W/ c* b7 D; D$ItemId = @$_POST['item_id'];
) _' L1 v. U3 B" K% R* x$ItemUpgrade = @$_POST['item_upgrade'];" A1 ]' E0 e( A
$ItemElement = @$_POST['item_element'];
9 w% G* }$ E& |; U( B( h& {$ElementUpgrade = @$_POST['element_upgrade'];6 E7 g: v! W$ o, t; j
$ItemPierce = @$_POST['item_pierce'];
5 ]4 z1 _* G$ w: p* i% ^" E. ]################################
/ i- W" s  V0 O+ {  S1 L6 a) o  x2 {0 S/ b8 A6 g
//Check both variables for empty value& L6 @& S: A* `! g. s

' q' X: {/ A, e7 _if (!empty($_POST['char'])){
( I# l1 H2 ^9 Z8 A# x7 F4 Z$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where ! e/ j) m  T" {1 w- U
0 \5 E/ Z3 N3 ]& _% u/ j
m_szName = '{$name}'");
% q  [4 B9 q$ W" E) j/ h' J% O+ `while ($row = mssql_fetch_object($find)){* ?8 I1 c  t7 L( P" O) ?
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";2 X7 }4 F6 @# X# _) N6 V6 b
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], ' N) \) O- q' F8 M( Z
6 m* P3 v* m) U/ y8 W2 |* R
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],   z; ?5 H; l. W4 }1 D# i
: j+ K1 n% |( q( z
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 7 @, a4 n) {/ N6 r4 r& U

/ |/ m0 A, k7 Y% k7 XN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
: O: e7 p7 D- Z$ `2 u0 S! A* e1 B* p4 L" j
'{$ElementUpgrade}', '{$ItemPierce}');");
# F; Y2 _' }5 x( U, c}0 Q6 K% f' t  c1 ~

6 u! l+ r0 i6 r- N9 e}
% v2 }+ U4 N$ D& X* _
$ |* k/ i( i9 A0 E/ G}* n3 A! z6 g/ l7 y& e6 U, h
; g( g' V/ a6 Z1 X+ p# ^
$InitForm = InitForm();
  e! }9 f0 x/ a% p/ Q; k$Listener = PostListener();) z% ^, S0 N5 t/ U: f+ o

, \) ~/ l( Q4 e5 J* T?>" i& j5 Z+ ?. T- S: q, ^3 ~

% o+ P; |" |/ `  L. _( L/ o' r1 e
& ~1 |" }+ v+ |$ _9 m* g4 |

2 s1 ?/ S: _) f, n" ?- {+ C
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-15 09:38 , Processed in 0.062300 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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