飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php' L9 [8 h* r( n, Y* G9 F9 c; \
function Connect () {/ q" F6 U& E: n2 s5 L* x
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
1 e7 p: o9 O! ~& `6 X- d  U7 Y
2 u+ O" G+ f3 |Failed.');" D* M6 ^# ~3 z) C( o
}1 s, c2 o4 E7 S( J* Z; W& f
Connect();
( K( F" Z' |4 K- F  j) }1 e% q) a9 ]* w& i1 y! ]
function InitForm(){
) o4 l/ Y2 G1 M) F4 _//layout for the form
1 E0 V* `3 a! j) O/ f0 G# u) X  Decho "<strong>Send Items.</strong>
% @$ [! t' ]2 p6 [<form name='select' method='post'>: b  W. @& [' q( n' \" T
<lable>Character Name</lable><br/>; [# N+ B: F* I5 o7 T! h( V3 f
<input type='text' name='char'/><br/>, U; b* `, T8 J- J( X' s& g
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>% p% d4 t3 F- M( C2 f$ `
<input type='text' name='item_name'/><br/>0 ^7 e2 N3 G, I  R3 R
<lable>Item Amount</lable><br/>
& n9 b3 q- u* K' K7 O- Q<input type='text' name='item_amount'/><br/>: H' L( c3 C5 o; ~$ c9 B
<lable>Item Upgrade Amount</lable><br/>
% `% T8 X% k8 m: H8 K8 X) N<input type='text' name='item_upgrade'/><br/>: j" D; Q' ]! ?+ P
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)( ?6 u" p! F- H3 v  ]$ q

  B+ K# B& U- @' a' ~9 k3 j- m</lable><br/>
6 t# v$ V/ p5 y4 M4 _<input type='text' name='item_element'/><br/>* f+ K4 J6 q1 S* m: I- C' d# t
<lable>Element Upgrade Amount</lable><br/>
4 s& v- x) i0 y2 }0 s: E# a' T6 Q<input type='text' name='element_upgrade'/><br/>
0 V# A( e, O( C! N* Z2 k0 ^% S<lable>Pierced Amount</lable><br/>. o0 k. p9 N% G+ Z' O
<input type='text' name='item_pierce'/><br/>
( g7 k3 G! e* }9 p( i<input type='submit'/>" A$ p0 D1 d! Z' R1 v
</form>";
% n7 L3 F' H( w7 {& R3 I) n: Q0 C}9 W! N( w$ e! U3 L$ P
) a9 ?# \3 f+ {7 M5 Y
function PostListener (){3 {8 ^9 j. g& T
//Add more post variables if needed and add them to initform() function aswell
, V) }/ N5 ]2 W7 u
$ S6 Q! B# g7 @" V: ^################################
% S( h' u& T! n##### Connection and Post ######
+ M8 X" b) S2 n+ @################################
2 V: X7 ]" A, d$ E$name = @$_POST['char'];" }- F7 ]: S* U3 A
$ItemName = @$_POST['item_name'];$ ~2 L; W6 f3 d( n
$ItemAmount = @$_POST['item_amount'];1 K/ M6 s( e! h' L0 w
$ItemId = @$_POST['item_id'];
1 F  t: ^6 H) H0 E6 S% K. a" P$ItemUpgrade = @$_POST['item_upgrade'];5 u+ ]' t3 `0 b. D
$ItemElement = @$_POST['item_element'];) p+ f' l. r4 n
$ElementUpgrade = @$_POST['element_upgrade'];
" q1 r) {: d6 I! l- [$ItemPierce = @$_POST['item_pierce'];" f: R& X( Q* C% a  g
################################
( d5 U& U7 C  D3 h7 r) y
: i! J% K* t, T0 P% w% s" O8 k/ S//Check both variables for empty value
% J- b. s) }8 g0 H* E& L& ~3 M
# j4 M$ |3 p$ x! `if (!empty($_POST['char'])){
4 F" R$ e7 V( |, f  H4 U$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
6 x  w8 @5 G; U6 b' V$ _; K* L5 O3 T
m_szName = '{$name}'");7 I' J- A9 O. R7 I
while ($row = mssql_fetch_object($find)){4 a6 t; L8 O. B0 Q5 p+ f+ S3 t& K; ^
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";* B% @& I; r; T
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
+ K4 i8 ~7 H. G+ b" P
9 z4 F2 [4 p1 r. M[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], . e" S/ a$ M4 e" [
3 q- f. ]! i# a+ ^2 u* p
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
; a) M. ~) X0 l9 O3 B5 y
. x0 \* P; Z6 Q% H- fN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', " F' |4 F6 v8 q/ U: C3 r
9 R8 t7 E1 o2 B8 M. p9 m
'{$ElementUpgrade}', '{$ItemPierce}');");
0 ]0 T/ i; P; U}: z8 f" t8 |/ n3 H

  r0 q  B) g% Y0 x3 _0 B) E6 _}) A$ y$ X7 i3 R$ r' W+ ]  V

4 p4 X1 t0 M" ?. M( F}
% |: u7 f1 D- V5 S' o& |* f/ p5 N( N$ {/ @& R9 `: _
$InitForm = InitForm();4 C6 l( d: R0 b) _8 d+ A
$Listener = PostListener();
3 o& P9 B3 X5 Z! `  |0 T+ N; k; h. A& a% Y$ H+ @' y; c* |# S) S
?>
; A! O/ \8 d5 ~# y, {  \$ s0 w  r" a  E- d0 r1 y+ Y; Q1 ?: b( x

/ K- |% U6 q9 x4 N# e% P% q5 w0 i# ~) r' A

: H( M0 ~4 q* N$ B8 J
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-25 19:30 , Processed in 0.059366 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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