飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1094

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1094
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
<?php
" A" }9 x  x; B% Nfunction Connect () {
; f8 F+ A6 k3 y- N) Umssql_connect('Server','UserName','Password') or die('Error: Connection to DB 0 D! y0 p) _7 H% u3 Q
" ^+ V; l- x/ N( ?  N+ q6 A# u
Failed.');2 b5 ?, C& b. l
}8 V0 z* q* {0 i9 N2 c
Connect();2 J, ~" x+ R4 B& E- W$ U' V8 B' u

8 _# F( b$ Y) U! \7 Ufunction InitForm(){' P5 A: H, u# w' W2 j
//layout for the form
, L: g2 N2 x3 ~  J8 E; A! uecho "<strong>Send Items.</strong>
0 }% o2 ?, w7 q& U1 d<form name='select' method='post'>
# O$ v. I0 U' I  h/ N5 s. z+ O( L<lable>Character Name</lable><br/>
4 m8 C* C% v  R, ~<input type='text' name='char'/><br/>
: S- N& _5 f5 B8 u/ |* z9 G6 n<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
- E- W" t0 y( \. _  L4 Q  R0 k! `. q<input type='text' name='item_name'/><br/>( W9 X  B/ ~8 ^
<lable>Item Amount</lable><br/>
# Q+ P+ ?( I4 w( E, m9 z" Z<input type='text' name='item_amount'/><br/>
' P$ x+ r6 m. M2 @5 g<lable>Item Upgrade Amount</lable><br/>2 ~# c1 T% z% Y  c) l. f9 x
<input type='text' name='item_upgrade'/><br/>
4 x& C5 h7 z4 h/ r<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
% N) }1 d6 k  `2 f' m* U0 _  \' f( O' Z& n- ]! G
</lable><br/>
+ N4 {- R. _$ R. d<input type='text' name='item_element'/><br/>$ d( k" i/ L  z  w
<lable>Element Upgrade Amount</lable><br/>, b: h9 P  H( L$ E
<input type='text' name='element_upgrade'/><br/>
; g; r$ Y: B7 Y/ k( e0 X<lable>Pierced Amount</lable><br/>
$ u( y. y) S& A9 L; _) ^$ F+ ^<input type='text' name='item_pierce'/><br/>. [3 R; P( D: ~- `* k0 J
<input type='submit'/>/ M' I4 F, K3 U. b- `  k
</form>";
5 t$ `% V& U0 \7 h' P7 @}" v7 J8 f( b0 }1 O7 k1 q
9 U1 ^1 h, Z7 c" L" `8 |+ p
function PostListener (){" R5 X6 p4 Q: I1 }, Q
//Add more post variables if needed and add them to initform() function aswell
+ g8 l; t( n- h" d7 D" ?4 B
5 `* A9 H# N; U( l# `2 V1 S' J################################1 _, U2 k! J7 z, H' _
##### Connection and Post ######
6 o# c3 C- n. g7 f- h6 h' [- T, j################################
3 e, U5 w& k0 I( A! k$name = @$_POST['char'];
' i  u  o% \2 L, C$ItemName = @$_POST['item_name'];( Z2 A1 \  z( i' q5 Z  R
$ItemAmount = @$_POST['item_amount'];6 a9 Z$ V) H5 [$ R9 ~4 O" ?7 F- N
$ItemId = @$_POST['item_id'];
8 V6 W% ?6 d5 j1 c1 b$ItemUpgrade = @$_POST['item_upgrade'];
  E" \9 n. [; V$ItemElement = @$_POST['item_element'];, c4 i. M& v4 `" d1 [
$ElementUpgrade = @$_POST['element_upgrade'];
5 M5 D+ Q4 w3 I6 F$ItemPierce = @$_POST['item_pierce'];$ ~4 p8 `+ U% S
################################
: S/ [' G2 j6 y2 b2 N
% l# ?# a, G/ {. x7 o0 r: V//Check both variables for empty value5 p/ o1 P1 n/ ~: T/ [; c
, n5 l% q, K  ]2 G6 A3 G/ w
if (!empty($_POST['char'])){
; @! Z/ c0 y5 K9 p$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
# c/ N% o0 }5 M& N; n( S5 [- e3 T4 ^/ U& d8 y4 @! ?" E, W
m_szName = '{$name}'");3 m! Y/ c: i$ p, I+ A
while ($row = mssql_fetch_object($find)){) D6 B. n$ A# J0 G# r# |+ Y
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
; X6 X4 D+ b: A* {: t9 d( K$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
4 o6 c( V$ j- g/ n9 a6 T: \; f8 |5 f7 }" }) X" e0 O' s
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
* |- s" r$ \8 j/ H
/ X) P, I8 I0 g8 B9 z[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
1 O! x! d1 F# X/ c: z! H! j: l" v1 b/ q1 l2 Y) ^
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', ! ^8 I9 A8 F. ]* H: q( ?
& s7 M4 }, h/ F
'{$ElementUpgrade}', '{$ItemPierce}');");
7 z  H- B' f; |3 Q}" q3 U' r  d0 H! Q6 T

( _9 q- }) X/ I* Y}: b$ I7 i; p5 a. j% \
, Q3 h+ K; d( F3 k
}8 K" R% w4 \: X+ q* {4 r
. C4 e( q% W! C* ~+ K
$InitForm = InitForm();; e) j. J0 F" ?
$Listener = PostListener();: Z3 t$ U" X- r1 R% i% `3 ]- U
; w; o- `  O2 l; W
?>0 v* B/ \8 x0 t$ H! S; Z: i: v
3 \1 d: y1 g- b! K/ B

7 i/ L5 U, X# R1 E. X0 E. c- J# s6 s# i2 p6 e( M. u- }
: d( O) r+ e0 g! Y
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-31 04:44 , Processed in 0.059287 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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