飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1064

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1064
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php0 T( n' ~' p5 L9 c) _
function Connect () {
- q9 T- Z# ]6 J: C& emssql_connect('Server','UserName','Password') or die('Error: Connection to DB 7 g0 k# k8 w# m0 }9 d

  S( V, x9 y2 S0 i" j: mFailed.');2 o! H! `" L9 p$ o, J4 X
}
, r; H8 @( Q; }1 k/ X. H( tConnect();' Z6 K; A' F3 J. H) g  y9 l, l' j
/ q7 i. }- I0 h% O# n
function InitForm(){
5 b, `) Q! W& t+ N//layout for the form
6 n9 t/ T1 Y& i9 ]8 @echo "<strong>Send Items.</strong>3 |: Q( {1 b) @
<form name='select' method='post'>; z% a( Y+ n+ U0 g
<lable>Character Name</lable><br/>
# c$ D  u  S6 j6 T3 J<input type='text' name='char'/><br/>2 z5 \- U$ a* E5 d- g" W5 H$ v
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>8 j$ R8 L5 A, l# Z# v$ E% d0 P- S
<input type='text' name='item_name'/><br/>
3 Z! I# r9 R$ }, W/ R" M, @<lable>Item Amount</lable><br/>' @( T7 k! S- K+ g) ?
<input type='text' name='item_amount'/><br/>
8 ?/ {9 L. m3 G& T3 R1 ~<lable>Item Upgrade Amount</lable><br/>( f1 v* Y: G3 Z8 k
<input type='text' name='item_upgrade'/><br/>
6 ~% }8 x* Y  o( o) Q+ H<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
5 J: l+ ~, _+ a) W. Q3 M5 A( s$ B" W3 Q8 \4 Y' ~
</lable><br/>1 s# h1 j9 v% R" ]
<input type='text' name='item_element'/><br/>" c, T9 H) L- u" y( |! A
<lable>Element Upgrade Amount</lable><br/>
5 Y8 [  |1 \$ a) C$ c<input type='text' name='element_upgrade'/><br/>. B" S3 u: ~+ X* n
<lable>Pierced Amount</lable><br/>
! t  W5 }7 p1 Q0 C1 c<input type='text' name='item_pierce'/><br/>: i6 P- Z- f' U
<input type='submit'/>
' z- j& l) t! e* W& W3 Q) M</form>";
- k: C. a5 g( v. L0 T4 N# N; l}9 B- S- W0 |+ d
. a5 b7 ]- ]' f; W5 i4 i7 u2 Y9 W% J
function PostListener (){, b) z6 }( p" j
//Add more post variables if needed and add them to initform() function aswell
! ]- z/ |6 g0 k+ Y/ ^2 @! _' _9 g
% l+ g# A& f& J$ K- P3 ]################################
6 T7 ^1 ~& f" X9 z7 h##### Connection and Post ######
! ^0 J: L6 p8 ?) ?5 _################################7 i3 k  t' ^1 }5 l
$name = @$_POST['char'];
# V. Q# y4 S6 r, L: X$ItemName = @$_POST['item_name'];
$ {. {4 B6 q, f$ c( U) A$ItemAmount = @$_POST['item_amount'];7 s8 J3 K1 Z' h% H( U
$ItemId = @$_POST['item_id'];
1 ]. V: H! F0 F# T" G/ L9 c$ItemUpgrade = @$_POST['item_upgrade'];
$ X  a0 Q% K( J9 S9 }5 n$ItemElement = @$_POST['item_element'];
2 R; f  i1 {5 Q9 q5 r$ ?3 _4 I$ElementUpgrade = @$_POST['element_upgrade'];
! I5 J& ]- q5 Z/ c/ f4 }$ItemPierce = @$_POST['item_pierce'];  z. @* D5 T, W% W- [
################################
2 |) {; H1 g9 X' m& O1 D0 s; t/ `# z6 e) n* p% C
//Check both variables for empty value# I; h' b2 I4 N7 ~0 N9 k

& S0 V- i7 V* c3 N; b# s; eif (!empty($_POST['char'])){- C; B' d. E+ ^( G
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
4 j8 p9 L* b- C, m* M0 ^' y( ~& z4 A
m_szName = '{$name}'");9 n4 a5 @+ V2 H0 H2 X% |/ V; i
while ($row = mssql_fetch_object($find)){
4 l' Z6 g* T; Q6 L+ L" C3 y6 Wecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
: p4 i# i; r: m* b$ V$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], ' D$ ~4 \. w- R9 f' M5 z
* Q% e5 e+ m4 {- h' ]1 }# [
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
2 m' s+ K, w5 T1 }3 I5 X6 X4 p3 P
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 2 V. `+ w- N7 E1 T* G1 t

/ {2 S1 j9 n$ O/ LN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
5 G+ m2 q6 L3 S$ m- f& `6 B
2 [( U2 Y# h% V% R" l2 h- X'{$ElementUpgrade}', '{$ItemPierce}');");9 |% P, k  f. A% ]
}
/ @/ N/ a8 c0 [3 {5 J! r: W: u& o* s2 [6 C+ K5 l9 w$ ^
}! b$ o# e# x+ e4 ^

* L# ~( e! \0 C2 C/ ]7 i}
4 M5 k2 Q# X3 a: {- K- W4 o- t' `% A8 c+ e9 ?3 l5 O
$InitForm = InitForm();
: ?, [- M6 A. k$Listener = PostListener();
6 A* S0 J; |5 P
% e# n/ m* h5 n# O2 u?>  [$ k# q$ x2 f! U% I! G  a. U( }

" u1 P2 Z7 L: \; M9 F0 Q1 ]' Y
" N* Y1 G5 [2 A" L
8 }0 k2 B% o, \3 g
! P" s" r9 ~. g: O. p. U
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-7-12 20:18 , Processed in 0.058699 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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