飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
7 X+ Q9 l* J- X) Jfunction Connect () {0 V4 S. ~9 }" ]. g1 U0 N& o
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB 0 P0 }9 Y& r* A/ R8 u- `
# O, \4 X9 W7 X+ ]. i
Failed.');' n  g9 P9 y$ a) w. `
}4 p  W+ n2 M5 d: }1 T- i/ N) Z1 ~
Connect();
6 }/ {8 l+ x4 h; z0 G3 T0 j9 v$ i/ u  ~9 ?4 s% b/ u% X1 Z
function InitForm(){
3 J7 l* N" H7 A. h; g! h//layout for the form
- `: X+ {3 k; v2 Cecho "<strong>Send Items.</strong>
& q3 J  `& Z5 w" U; J7 Y7 R$ K7 c( Q8 V<form name='select' method='post'>, Q1 t! R  @& {! {- `
<lable>Character Name</lable><br/>
/ `6 i8 J; W/ Z" q<input type='text' name='char'/><br/>
1 q. M0 e9 a6 Y/ u6 o9 c<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>  C* A8 {7 L7 s. K6 P" v
<input type='text' name='item_name'/><br/>' d9 o+ U) B0 C
<lable>Item Amount</lable><br/>
6 Z/ ]& p+ g* V<input type='text' name='item_amount'/><br/>4 z, w: |0 P* k% g& R7 s
<lable>Item Upgrade Amount</lable><br/>
0 N. ~9 W5 }: z<input type='text' name='item_upgrade'/><br/>
4 p5 k. Z; d/ Z* d, ^<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)/ B5 F" O8 j1 }+ J

/ p" X$ V' q9 }: [! j</lable><br/>' b! S# T, E( B
<input type='text' name='item_element'/><br/>4 M/ a* B% p7 d$ C2 ~& a
<lable>Element Upgrade Amount</lable><br/># y6 L5 N4 o' p/ o7 o
<input type='text' name='element_upgrade'/><br/>2 m" `6 ]' B7 v$ K! f+ E4 R9 ~
<lable>Pierced Amount</lable><br/>) V1 G! f. J$ @1 D" @* ^
<input type='text' name='item_pierce'/><br/>
8 h0 Q. g5 u# U9 d<input type='submit'/>2 z! g0 a/ U# P8 n4 R  Z
</form>";/ l# h. p& |1 }
}
- x0 }# C' a# d$ q* a3 i
: R- b: P" Q9 Q& ?5 \function PostListener (){
% i6 Z3 w% q$ f- V  h1 ?2 L//Add more post variables if needed and add them to initform() function aswell, i& J0 g* b. t, M2 ^. f

9 e- J" s5 ]! }: k6 ~7 j3 v( s################################( ~# k1 Q. V/ N9 b: X2 W
##### Connection and Post ######: W: o( E: \+ S% ~& f3 @- \9 b/ d
################################
8 Q  F+ m5 e# v# t! X5 z1 d$ i3 a$name = @$_POST['char'];5 n) s, D# n4 |( r* j( z
$ItemName = @$_POST['item_name'];
$ v, D7 v7 }; D# B% X! G* y$ItemAmount = @$_POST['item_amount'];- [. Y6 J: @, p  B6 T% A; s
$ItemId = @$_POST['item_id'];
4 \+ X# c( l* L6 A9 J- o$ItemUpgrade = @$_POST['item_upgrade'];  |; p6 w( {/ V- p% {  G
$ItemElement = @$_POST['item_element'];
0 Y/ y: |  r: Y& Z# D4 x9 J' X! i5 V$ElementUpgrade = @$_POST['element_upgrade'];7 p8 V* _  Y; ^. S
$ItemPierce = @$_POST['item_pierce'];/ R4 A" S; y; l7 p# l: Y
################################
) ~% Y$ |8 M0 Y
; R7 X) B+ ~4 S7 N. q//Check both variables for empty value3 l# ^- X. j3 b: i% b- u

  P: t+ B3 `1 t" Mif (!empty($_POST['char'])){
. I- |% F- O' H' X2 b9 X  a$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where 2 F6 }( A9 ]. t0 p" k

% I3 n6 W4 o" V, ]% Gm_szName = '{$name}'");
& ?0 x" S; C0 s* {4 q/ s4 l! o. V1 ]while ($row = mssql_fetch_object($find)){5 V2 J* G6 W& O2 {; ^
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";7 [# k4 I4 U" e
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], - s  q. k7 G7 K+ v, L+ T' `0 X
$ h) k$ Y9 `  p
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
/ L3 t8 z0 p/ b, A& s7 T  L( R% j9 ^7 i9 h9 H, o
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
) Q" f, r- @5 l; @2 i$ Q0 I/ m% m& }9 u
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', 3 W3 D/ M  {. t% M: W  G
& s1 ]5 O, t  t5 L$ L+ P# Z1 O
'{$ElementUpgrade}', '{$ItemPierce}');");
$ ~) k% _5 J  i}
$ @7 _8 ?4 q4 L; @0 z
' L( |2 a  N. w# u9 M$ }- W}
9 s, s8 a1 u8 `; S6 l
( K; u  s0 m+ F0 x}+ F( ~5 ?% }- p: n; x

' s8 u5 S3 K2 s5 N$ I$InitForm = InitForm();/ t& A- r4 W7 c5 y. ]' k! |
$Listener = PostListener();
. E( q. N/ h* a- |! V- q$ Y
5 @* a- V0 K$ P4 `) j! T3 Q7 g?>
0 {% r& b( X9 l! l* h8 B# B5 P' E  f. u' [% F

- F6 ~, M2 d5 O/ p5 }' ]
# V7 k7 K+ Y" Y
0 n. G" L/ V& Q; E9 q
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-26 17:32 , Processed in 0.058277 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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