飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
- l0 ?2 u$ m$ V1 t2 f9 G5 b) P% sfunction Connect () {
. ]. _0 a- n5 A& C$ umssql_connect('Server','UserName','Password') or die('Error: Connection to DB / k% |: L$ [0 A- L& b7 `% K0 m

" X; a7 [* k* ?5 N5 E: RFailed.');  P( P) F  S5 K7 K: s, [
}
# W/ s3 Z$ o6 Z9 Y. V6 E6 }Connect();
1 @5 F( E; W2 q# i( E
/ `3 M+ v/ o7 t4 y6 E! a- h- bfunction InitForm(){
7 U; m0 Q$ m) o- C//layout for the form
# C* y- V0 S5 iecho "<strong>Send Items.</strong>* ?$ r2 H& c$ S$ k
<form name='select' method='post'>' {/ {9 q9 e* D  h
<lable>Character Name</lable><br/># R+ \/ O  |7 y
<input type='text' name='char'/><br/>
4 b2 @7 u1 E6 U; j7 Y  p: q. T<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>& p# L+ J6 T6 U; y8 J4 h8 S8 A; B
<input type='text' name='item_name'/><br/>
. d/ W+ N+ w& Y! O3 B4 _1 H<lable>Item Amount</lable><br/>4 R% c5 A, S" H/ ~% C% q8 _
<input type='text' name='item_amount'/><br/>
' B* @# C4 G1 c0 V9 Z9 c5 V<lable>Item Upgrade Amount</lable><br/>
# Z* |& D+ I* S" R6 ?+ _<input type='text' name='item_upgrade'/><br/>& f7 f/ y: p+ P5 z
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
; V/ d3 G; I: f) W2 [/ \: J1 j! ?* ?) ]7 Z; r3 I
</lable><br/>7 ?# x  \& q( U' h$ i4 L4 u4 t
<input type='text' name='item_element'/><br/>* e4 ~: ]; d. h1 q; R
<lable>Element Upgrade Amount</lable><br/>! b7 D) k, B+ f; K
<input type='text' name='element_upgrade'/><br/>
- @# V! E" E5 x, C<lable>Pierced Amount</lable><br/>% H, M# z2 b' l& m* W8 H
<input type='text' name='item_pierce'/><br/>
0 v" s) K0 g' \<input type='submit'/>
& }7 g; d3 o  `</form>";1 e  F1 j# |9 Z8 N$ h3 Q
}
/ `4 o" E/ T+ Q2 x8 a* c
* P7 w5 _1 K2 ^' pfunction PostListener (){, K6 P3 H/ `( k8 P* B
//Add more post variables if needed and add them to initform() function aswell
9 |3 u8 k( f/ B- e- I
/ F  h0 ?$ |, J! l# x& q9 d################################
, g# k. g" l- k. r: O' y: X# Y##### Connection and Post ######
: `' v5 J: i- `, r4 N################################
# u- P% [. A$ l: ^+ o$ R' Z) z4 Q$name = @$_POST['char'];, ^7 R7 x" ^- H' p7 p' J
$ItemName = @$_POST['item_name'];
- O% \1 T- G- |- ^( ~$ItemAmount = @$_POST['item_amount'];
! {( }- ]8 H: c  _! l% x$ItemId = @$_POST['item_id'];
* p: Y, B/ m. }$ItemUpgrade = @$_POST['item_upgrade'];. [+ p! j6 p+ S& U
$ItemElement = @$_POST['item_element'];" _5 p8 C! q/ n- i
$ElementUpgrade = @$_POST['element_upgrade'];" [9 ~! R7 ?6 D& k0 `8 H9 |
$ItemPierce = @$_POST['item_pierce'];
* E# r. d4 E2 m6 L- V################################" Z0 z2 O6 q( A4 z! s

% d9 R6 N+ {6 d" p: V8 z//Check both variables for empty value! f0 v1 ?' H( w4 P1 S3 e2 |+ ^

1 F1 _6 U& m# S. b! S* hif (!empty($_POST['char'])){, z( B7 f% q7 E" k- f& B. L
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where & R( w4 I9 q4 Q2 z
/ k% w' G. Y; x
m_szName = '{$name}'");
; ?1 F, w& u1 D# z9 T9 xwhile ($row = mssql_fetch_object($find)){% t9 Z  h/ R8 Q, E# \
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";% ]7 Z1 D1 M1 p7 U! x0 h! o
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 0 b1 H& i/ M" ~
* ~4 {( ^4 [: F; f: z
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
+ E4 u' K# H2 @% \% n1 j9 y# P
1 Y& o$ ]$ n: G% Q3 W[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
+ g6 k8 V% b9 l- g, p: M" t0 K9 ]2 w4 p  U
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
. V( v8 e7 w/ v. h1 w. j% R7 w! P+ @) Z2 Y$ d
'{$ElementUpgrade}', '{$ItemPierce}');");
# B4 {* K4 x4 m$ ?}! \7 u, X! l- W, z/ m% E4 E( ^
' K" I. J9 B# n: i# A7 L! g8 Z% E
}
5 J. B8 e3 w# r) d0 O! l  ^  L0 Z6 Y# [8 U# C% `7 A
}
. K7 M- p& C' h0 s0 L4 V  ~: p$ w: b3 W" c% ?0 G0 l0 {  n
$InitForm = InitForm();4 X- H4 d+ K' W$ B- }
$Listener = PostListener();
1 U& A8 g$ k& Y) ]: g0 w" h: `6 @, M, T9 y; P; R' m* P( x. c
?>" d& L6 o% o" c+ O9 m
9 B5 k0 p( z* _  w: ?
* N8 v& f/ \: B, n- e  D2 F

& C6 m: a7 K0 M5 v6 |- {( G; K- f; z( \! M$ T$ _/ ?4 {# B6 w! }
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-5 17:53 , Processed in 0.060325 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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