飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1022

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1022
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
& X$ B, D- i) [function Connect () {
. m( G: N+ @' V5 v0 a" ^mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
* d; p1 p- j* T6 P: w6 n1 g8 J+ y8 w6 F
Failed.');5 g9 w8 c5 j" l1 z5 [" {
}! o% U$ M/ R( L* p; l: z+ _
Connect();
2 u! O2 h) n# }2 b( |! s, o
% ~- |$ ]8 b5 V# [# b$ c' Q, [3 |function InitForm(){) ]' Y: z. T3 B5 R
//layout for the form
' h) [# a* g1 ^3 B. Kecho "<strong>Send Items.</strong>" [8 C# r- w/ O6 ^. H$ A
<form name='select' method='post'>
0 m" I: r0 A  E  [4 \# m<lable>Character Name</lable><br/>
5 A7 `9 [8 U8 R. _<input type='text' name='char'/><br/>' R! p9 u7 V, v9 w
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
6 U+ K( ]% s; S3 O2 h  e7 l<input type='text' name='item_name'/><br/>
' a+ T4 N+ t: Q# Z. s% f8 Y<lable>Item Amount</lable><br/>% Y& L1 R$ p6 u7 n0 \
<input type='text' name='item_amount'/><br/>
7 X- K. c- V  U5 t# q<lable>Item Upgrade Amount</lable><br/>
9 t2 l; e" n5 U& U$ l' @<input type='text' name='item_upgrade'/><br/>- Q2 b2 G' L1 C& F1 W& J. n3 u+ k4 s
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
( J6 m7 l8 B; x1 \
* U9 V; a+ z# a0 b- s) ?2 ]8 J% \</lable><br/>! o# C, m# U: `) d' n  C  ^2 b1 j
<input type='text' name='item_element'/><br/>$ L* @! N; v; o7 q" y& N1 A
<lable>Element Upgrade Amount</lable><br/>
' S8 x6 S& p: P' n; {; J/ a- S<input type='text' name='element_upgrade'/><br/>
# P) O6 f) k" @8 O<lable>Pierced Amount</lable><br/>
$ V+ {8 k/ W- s, H4 c$ @<input type='text' name='item_pierce'/><br/>
) _) X# \3 \( x9 y; d2 ?<input type='submit'/>+ o9 U( _( t3 Q% y; o( g
</form>";  n4 n0 Y) t* q# b0 j- G
}4 c% h7 z! E: r3 r0 M& O
: [+ }8 L' N- }3 u# t8 \
function PostListener (){4 C7 L( g' N0 F/ m7 n. s- N  U
//Add more post variables if needed and add them to initform() function aswell
( S: Y' k! L3 t' b! D/ K" [7 ?8 e6 e1 T- L; J# D8 I' E
################################
1 q8 H/ \! Y3 _: U! i4 e, V##### Connection and Post ######, l# z3 S! T5 M) g& Z
################################
# b: P9 P: y, N4 o' w( ^5 M9 Q; I$name = @$_POST['char'];
! C/ s8 c, E& }, P! O7 S9 b. h$ItemName = @$_POST['item_name'];8 S' K) `4 A/ }/ [2 ~& m( L
$ItemAmount = @$_POST['item_amount'];
: @0 p7 W9 }) M* f# U' w$ItemId = @$_POST['item_id'];
7 n: i& w' v, I. ?$ItemUpgrade = @$_POST['item_upgrade'];
; \1 U) R! z' E2 J$ItemElement = @$_POST['item_element'];
1 [# J. V5 m3 U$ElementUpgrade = @$_POST['element_upgrade'];1 J; [9 U3 H, {" V. T0 ^2 n# L
$ItemPierce = @$_POST['item_pierce'];
* N9 l7 H8 N8 J- W  B  I################################
$ P, K7 d( ^5 i6 t3 g2 Y. |' D/ n% _# o, x6 T& ^: h1 |3 d7 \5 h
//Check both variables for empty value0 @. V& H+ i2 [. C! r% `  ~! x

% q, R( P8 f1 W* Z7 aif (!empty($_POST['char'])){
6 H' x4 u+ d5 A$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where 4 _8 z" q8 a7 A: w1 _& C

8 b$ C  d6 Q) e! z4 M' v. t0 Zm_szName = '{$name}'");
( s$ j" N% ^4 k6 R; k# q, D, twhile ($row = mssql_fetch_object($find)){' q: J" U, q. \, B
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
6 q6 I# h$ H+ [7 ~$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], + r. u! r! \/ y  g' ^# u' c0 k" a

3 R3 O0 |$ k+ g[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
% Z% V; v' J: g0 b4 J* B7 J4 p# _$ [, v3 q8 R
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 4 d' H7 e! e) q

; s. N1 l0 U$ t: Z9 fN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
$ d- z! P! f/ X8 c7 Y/ z4 K" U$ }
'{$ElementUpgrade}', '{$ItemPierce}');");
5 M7 p4 t9 e- L4 m, Q: I$ F  H/ U}; I: M* |9 [7 U& U1 M% z0 b

. S9 F' A* x: |, `. f% N. S}
5 u/ p4 u- @* R4 Q$ z
* s5 n/ ?; I: H- }, \8 s# ^. s- {- ~8 ~& t}3 i( o8 V$ T# L+ Z* q9 v+ n. O
! a/ u: ^  G4 A2 v
$InitForm = InitForm();/ l; x: U: T/ [# V9 |) U( j
$Listener = PostListener();
8 q, u  V! M# I* J
- A5 Q4 P4 w7 u6 `, G8 Z?>
8 M& ]& w8 y) j& Z* @( Z6 A9 u; b6 ]# a5 E
# Q8 Y3 w& _: M$ U: @2 {
+ h. u/ P. A: |+ R
% X" v: h4 k; w9 o& ?
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-9-29 07:28 , Processed in 0.058279 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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