飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
<?php
/ g: T) r% p4 [% w$ Q* L# Tfunction Connect () {, h0 {! i; X, {, ^5 O- u' S
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
6 E+ l) I- O7 a8 k# B) {5 y
- }+ Y' s: \3 r. T# IFailed.');$ l* q6 p, ~3 e- z: H! r
}( Z% g; d+ i3 d7 c$ v- i. L  U
Connect();0 W4 L$ K& D6 m) z5 Z+ {
5 ]& s9 Y: F8 O5 r& G; i
function InitForm(){! I* @! V5 A0 W  a3 I
//layout for the form0 M& U  ^- S( i; @# t' Q
echo "<strong>Send Items.</strong>
) V% y5 n# M% `0 g% t. s# Q3 f<form name='select' method='post'>
2 S1 Y7 P1 R3 c" E; L# ^0 t3 c<lable>Character Name</lable><br/>2 Y4 |4 I9 m) Y. d6 W
<input type='text' name='char'/><br/>
6 F2 Z% c" q& s- `9 b& ~<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>/ b0 y8 E; K  K
<input type='text' name='item_name'/><br/>
" \2 o. {  {0 L! ~6 `2 G<lable>Item Amount</lable><br/>- c  g9 ^' y+ K
<input type='text' name='item_amount'/><br/>7 J1 |) N: s- v  ]/ a4 H. l
<lable>Item Upgrade Amount</lable><br/>4 \  n, p) ]: z. v
<input type='text' name='item_upgrade'/><br/>
9 ~, W, x5 S$ v3 `) O<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
. j: d4 L5 j. e
+ B4 F! f. f7 E7 D0 S8 g0 K3 o</lable><br/>
) q0 C* o* h  x% a- Z<input type='text' name='item_element'/><br/>( h- T# P  H8 ]7 ^! r" M& X2 x5 k' o
<lable>Element Upgrade Amount</lable><br/>
% R3 A7 M: ~" Y  ]3 C<input type='text' name='element_upgrade'/><br/>
8 C! D% b  g9 Y1 l- u; [- Q7 n<lable>Pierced Amount</lable><br/>7 Z& b8 H$ r( V/ l+ O
<input type='text' name='item_pierce'/><br/>
% t' L) M7 `6 f* V<input type='submit'/>* N1 v, s* `: ?3 \
</form>";
9 ^0 D; {- U/ J. R, v7 R* n}$ _8 y7 ?; A7 O( u* y/ h  I

1 |3 @" i% A1 {0 O7 I* vfunction PostListener (){! A; f- Q$ U) o& ^6 L: ^5 G0 y
//Add more post variables if needed and add them to initform() function aswell% O8 y+ D  y8 W7 R! Z/ O/ U

: W. m) J) q, ?8 @$ z. h################################( Q( I7 I2 \2 d8 H
##### Connection and Post ######
; m. e, ^1 S) ]; n& R, f# H################################
6 ~( ?- D# l& h+ b& P$name = @$_POST['char'];
7 K, M4 R' P: p$ItemName = @$_POST['item_name'];
% Y* k/ D" i7 ?. k. h4 V8 |- g  r$ItemAmount = @$_POST['item_amount'];
! Q  K4 u! ^# |% z; r7 s. R$ItemId = @$_POST['item_id'];
: t  X& `- F4 w* c1 S: K$ItemUpgrade = @$_POST['item_upgrade'];! r% E5 H$ |; H! j0 T
$ItemElement = @$_POST['item_element'];: o4 \7 q0 ?. `
$ElementUpgrade = @$_POST['element_upgrade'];5 k9 u: F: ?) c3 Q- b5 t' x
$ItemPierce = @$_POST['item_pierce'];* C+ t' Z' s: W. \4 r* N
################################5 U7 f0 v7 U( f* K3 h& g
( D! P9 J/ R- X/ a* z# S' L4 o
//Check both variables for empty value6 [# Z6 E' x3 M- Q' N- q3 }, d. a
; I. k; b4 A  E" c( e- Z- D
if (!empty($_POST['char'])){6 j! ~. U% Z2 s2 `8 D9 @
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where * n) i: {7 r* C; c) Z" G0 r

- m6 m% e2 i& I5 [1 um_szName = '{$name}'");, U$ ^6 g4 _/ R( t3 |* X* x5 i
while ($row = mssql_fetch_object($find)){! a; T3 }2 j6 X9 f/ Q' r
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";! l. T5 d+ l9 m3 v4 N: E+ _2 ~
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], : `& h& p$ }' G; O: \
0 j8 W2 P% I7 G) [2 z  p3 S
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], * _/ N1 ^' L3 e( w6 L

; E) U  M9 |1 h5 |( W+ X" a+ F6 [[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 4 b. q4 P' @( H7 [0 {# B$ ^7 D! R1 l
4 E  E7 V8 H4 W* a7 x
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', ! Z  h8 @9 v* x

" a- s" ~/ E) x( ~$ l'{$ElementUpgrade}', '{$ItemPierce}');");
! i/ }; S% h( R+ c2 p}
4 H+ R2 ?+ G5 O3 x5 o% F
, |9 T- }) ^, K$ A}' l8 z; Q9 V* u$ W
, e% @' m5 P- S9 e0 p
}
* l1 A6 A4 I( q9 E$ q/ x
; b3 k3 H9 K9 n: F5 n$InitForm = InitForm();
$ e& A/ w' W% j* K" j+ G% @9 N$Listener = PostListener();
0 D; S! J# D! I! f
2 L9 }' T" t- f( W) t* N$ c?>
# f& C+ V' w& X; E3 I/ p2 ^* i$ i& C
( O4 d7 A9 f9 y6 `- Y+ _; a

; \* ]# @8 @7 ^2 S" h  v
. U5 U# K. O0 m& }; P( [# ^# n  C
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-15 08:40 , Processed in 0.061681 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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