飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
5 R4 G4 Y8 |& R  x9 g, u4 Afunction Connect () {( k7 P& b2 u- U1 u  A5 a. h4 w4 [$ g
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB : Q4 I% l6 H: p: N; P$ \5 }% C6 o

: s, h1 {# g4 G3 P- M* _3 YFailed.');( h$ D: s4 J+ l# d9 W& _4 z+ o' Q
}+ f) P, g/ M# z' d
Connect();
5 y) }2 }5 v) U" ?/ ]( w
$ Y- \% k0 v4 N3 bfunction InitForm(){
) x% Y- V5 s* R4 x8 v% I//layout for the form/ m& l7 f% ^/ f1 d/ p7 ~! a5 ]
echo "<strong>Send Items.</strong># w. c0 w( N& D1 B( z- V
<form name='select' method='post'>
% `" P6 Y& r8 U. d/ v<lable>Character Name</lable><br/>9 x, o4 s6 ^/ h+ V/ j; j( R
<input type='text' name='char'/><br/>
) ~+ K  v) z3 c( ?* U4 {+ |) z, ?<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
# y" N1 Z  t1 S# t. g9 e# o6 X; r<input type='text' name='item_name'/><br/>2 u- Z9 k2 L% n
<lable>Item Amount</lable><br/>
4 p. Z: j. j" T: k( W# a0 m3 X<input type='text' name='item_amount'/><br/>
/ X; N4 a0 j- n" k: X<lable>Item Upgrade Amount</lable><br/>% p& k. V# V. e! F7 s: t4 U8 d# V& q
<input type='text' name='item_upgrade'/><br/>
! L: a% C, |  u6 r<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)" ~: i( d4 E2 L2 p) U5 E3 F* D% Q4 V
6 W# R3 M, ~; W9 m" T
</lable><br/>; ^8 K! g8 v7 ~
<input type='text' name='item_element'/><br/>6 l' r. ~, k3 w0 c
<lable>Element Upgrade Amount</lable><br/>
2 U$ t" K- ?8 H) N. S<input type='text' name='element_upgrade'/><br/>  t, d" }1 `& a/ \" l. X4 u5 Z
<lable>Pierced Amount</lable><br/>9 F' L6 a0 @) w0 k
<input type='text' name='item_pierce'/><br/>
. L8 C+ [# ^0 f- d6 f2 a# j<input type='submit'/>1 }$ g" o$ D' a) t" }) a
</form>";
7 y  k) I+ j" W" T6 N, |, x}/ Z/ t; f' g; u5 k% z

: w  r) d- b2 N/ L  F$ ufunction PostListener (){0 ?6 L1 [3 r' ~* z+ b! v
//Add more post variables if needed and add them to initform() function aswell
( t% N! ?  w* T% J, |2 v3 o  [, y1 h/ f, w3 k7 D" e2 u5 {
################################3 J4 }* k( V# ^+ E8 W% }
##### Connection and Post ######( ?: J+ H( a9 B4 O) H
################################
- e$ s$ M5 B# e+ S$name = @$_POST['char'];. L5 |* D* z. `6 _+ a
$ItemName = @$_POST['item_name'];& x- [" M+ E( h! L
$ItemAmount = @$_POST['item_amount'];
: u" t/ T+ Y2 S# I( M$ItemId = @$_POST['item_id'];
1 O) }# s' M. a# g4 j/ S$ItemUpgrade = @$_POST['item_upgrade'];
# ~8 P1 m% H% B: T$ItemElement = @$_POST['item_element'];" O- i# `& R% U/ {
$ElementUpgrade = @$_POST['element_upgrade'];8 V5 n. D# z# v
$ItemPierce = @$_POST['item_pierce'];! @6 j- Y. H/ Q* ?# U7 Y, r' f& J
################################) O; O& ?9 G0 ?& s2 }: L

$ B5 d6 g  s$ Q- ]) V5 k//Check both variables for empty value
1 Z+ b1 \, k! K
; L. \" ~6 k$ A: S. rif (!empty($_POST['char'])){
& p, e. g: h+ \. Y/ s; W$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where 7 E: g6 G# L) ^  J2 a0 ?

- s/ W0 ~: J9 S* }m_szName = '{$name}'");
" x/ m/ @, S! N9 L; {" ^3 v6 S0 ^while ($row = mssql_fetch_object($find)){
! q4 Y, m: v6 O/ Kecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
& ]7 O1 X* l( o$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],   |0 L3 [: ]; @5 k$ T; u( ~
9 _% n7 g( i! n$ v" y4 h
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
" B1 P1 i- _6 C( b; K% g
3 V) r2 ~( ~" c8 E7 Y2 l, H[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
6 E. \& P" h/ k$ Q, s$ M- B$ j7 N6 g; t) M% r& l  N) e
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
$ F. w! t' f  z7 T- T; Q! s# F9 P' k0 Z
'{$ElementUpgrade}', '{$ItemPierce}');");$ g6 F) W$ |& H, S3 n8 O9 }
}
+ ~0 l0 A) Y/ u) s
& i( y6 n* r0 W1 l0 @7 L}
( P# N& x4 ]' B; X8 W, X/ s! w+ E6 j* b8 U* l, U( X* Q. b
}" F# d( \9 J! G# M6 a+ |# _4 o2 H

/ i! z$ F& i2 e6 z* G$InitForm = InitForm();
2 V9 i* y" U4 y2 T5 w$Listener = PostListener();; u2 b6 t2 C9 Y/ k' p8 c  F5 [

# s- v- A6 q; \% i- y; P2 k?>( d: F0 M3 d  l2 r# T
3 @) y6 e$ ]9 W, b% c

& p. C) Q/ _7 L( h7 d5 d  q
! p9 I& k6 P. {4 e/ \  c. V7 Q; S% x/ m6 o! V2 |) |
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-25 13:34 , Processed in 0.065594 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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