飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
<?php
% |0 U8 k  O$ M: `' Q# {; \+ O6 zfunction Connect () {
! P7 U6 R# u* {* Q; V/ Q* Kmssql_connect('Server','UserName','Password') or die('Error: Connection to DB 4 ?5 `& A4 t. d; n, u+ A( g3 ]6 t* v

1 W" p% F9 m# l  F$ p3 sFailed.');, m6 l/ c9 W0 x+ [- A" g
}
% f: O$ Z" |' T' XConnect();
! ~: K' l$ u9 Q; U( w$ L% L& Q; g% {& r( Z
function InitForm(){
) a* B3 w3 F0 b! t//layout for the form
' d4 Z. v% N$ R. c+ Techo "<strong>Send Items.</strong>
$ ]8 P- F1 m: n9 g' z* X<form name='select' method='post'>
, j- @& `' i8 P7 ^' `5 j0 I<lable>Character Name</lable><br/>: l% G6 {) }, E, @5 F
<input type='text' name='char'/><br/>
8 s1 d& t, D2 s" y( g6 H* {$ }<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
6 Y! d; [+ r9 ^: Y- t<input type='text' name='item_name'/><br/>
. X+ N! i$ |5 P' L. H7 A<lable>Item Amount</lable><br/>, s. ^  H% j0 R/ }6 D: {
<input type='text' name='item_amount'/><br/>
# B4 h9 W1 J2 x<lable>Item Upgrade Amount</lable><br/>
' X: K9 A2 x5 a/ k5 t<input type='text' name='item_upgrade'/><br/>6 U& v2 K9 P2 [% {% S( W
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)' c" t/ Z. n3 X7 U8 C" [4 T

& \# O* ?) P$ r' o</lable><br/>9 h/ g0 A/ `: ~7 C+ w; k; y
<input type='text' name='item_element'/><br/>
7 L# A1 J2 T+ Q. P( \<lable>Element Upgrade Amount</lable><br/>
8 H/ w% \  H7 q7 F" g<input type='text' name='element_upgrade'/><br/>
; _6 a: F( ~0 x- K6 M. o1 I<lable>Pierced Amount</lable><br/>
/ T0 {6 c! x' g! N9 Z9 o( M  d3 Q<input type='text' name='item_pierce'/><br/>% ~  r' T/ f/ ~, J
<input type='submit'/>
* `9 p! N$ _* H7 v* Q</form>";4 R* H. K8 f$ F0 D/ n+ X4 \% v$ Y
}1 w% }+ i8 h# @3 @( ^* T
! j; d0 r  E' v
function PostListener (){3 E# m# t" |4 i) \, s
//Add more post variables if needed and add them to initform() function aswell5 m0 g$ U: Q: G) A) s
$ k; v) N- |0 i7 ~
################################! U1 ?. u. D! ?1 e3 x7 Z" J1 |; P2 u) ^2 q1 u
##### Connection and Post ######
* T8 i1 _7 e# f" b0 z8 l8 @################################9 D: w: _3 O% R( ]
$name = @$_POST['char'];8 t4 H, e% A( ?$ h+ j$ x5 Y% |7 T
$ItemName = @$_POST['item_name'];
6 Q9 v" N9 L) B. h$ItemAmount = @$_POST['item_amount'];
" j5 a2 T; {6 e$ItemId = @$_POST['item_id'];, i& ?% `$ |$ \. E1 F+ j
$ItemUpgrade = @$_POST['item_upgrade'];7 a" \- Z5 D6 h1 ?( L
$ItemElement = @$_POST['item_element'];9 a, h  p# h% W9 }
$ElementUpgrade = @$_POST['element_upgrade'];
0 v& w0 Z1 z- Y0 ?* ?& S$ItemPierce = @$_POST['item_pierce'];. O* L- ]# m: i; P* x
################################) B/ @+ ?. `5 F- }) r: x
% q$ H  {; A9 F" Z9 ^- Z8 b
//Check both variables for empty value" s$ u0 K. Z$ x/ t6 X  x$ P

7 P6 N1 F! A8 V' cif (!empty($_POST['char'])){3 S9 v# y8 l4 Y2 ?
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
' p, J' E. h7 Y. E
2 t% u% t/ b0 ~5 lm_szName = '{$name}'");* k  i' e6 ^$ `% I% F
while ($row = mssql_fetch_object($find)){
8 L9 u0 k* [* `& j4 Jecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
3 ^+ H; y' t! {7 \3 [8 W3 D$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
3 B* y0 ]# G. }1 Q1 r. r
6 s; M) V( ~8 K[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 4 O$ {# c8 y9 Q7 u+ m% H

; a, ~4 g8 Y* y  \4 R[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', ) Y& z- o  Z2 ^& D# X$ t3 A, p) R( e
1 l2 q! m5 Z+ {) L- J, u+ @
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
4 W( Q. P& ?* ~7 t) D  w9 u) `& Z
+ }* I2 O3 O. g% ~+ o0 y1 U'{$ElementUpgrade}', '{$ItemPierce}');");
5 z8 H  i. A2 u- e+ y/ }}) x4 J- i3 z+ V% u: s

! l# X& z# q4 Z/ r3 u5 O4 D}
3 l  f6 c' [6 T8 N9 K8 a  @8 I- K  j* n! n* W2 D
}
$ @1 H7 M1 N+ t7 \# t! M! R: _$ p0 }6 ?+ _. D
$InitForm = InitForm();
6 T! X5 w9 e4 G. e$Listener = PostListener();
4 ^# w3 p, K+ |# I  O) e/ z( @# Z; ~
?>6 `1 Z* V% I/ c, z0 m: b

# U/ ?; [0 T& M; t8 N
4 c0 v9 t( d  {/ _8 i3 t
6 y: u: P, L# R3 l4 U7 f
7 l" X" d# I4 \; [6 C: \
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-6 01:05 , Processed in 0.066002 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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