飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
<?php4 T* ^, a" J7 O$ B+ F
function Connect () {
' L! F$ q$ r$ ], O" pmssql_connect('Server','UserName','Password') or die('Error: Connection to DB
/ A* x5 i( W1 k! v7 a$ L0 C  C
: \: b  }4 p' W- DFailed.');' S" W( O, X2 T5 a% D3 @4 j% |+ u. a9 F. G; x
}" d) D- A# M& \. z& ^1 V
Connect();
4 J& g9 Q) A& I5 ]
+ Y& @7 Q3 c3 [/ B6 b! v+ m4 m; Xfunction InitForm(){
# d$ P& G" s' |  F# f//layout for the form
. ^3 R1 L! E: t+ M. iecho "<strong>Send Items.</strong>2 S/ p; {4 `: f! a' X
<form name='select' method='post'>
6 |, U% v0 ]  m, P! ]' y<lable>Character Name</lable><br/>5 R$ D  |4 t7 B; O0 C
<input type='text' name='char'/><br/>+ }: E5 ~# Z: w( J! d+ Z
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>/ a8 Z' m& x" q! ?( c, [" a# h
<input type='text' name='item_name'/><br/>. U' Y/ U8 _7 ?# S7 ?3 B$ q2 Z$ _
<lable>Item Amount</lable><br/>
8 X2 A9 j  ]/ \; [4 g2 m4 g<input type='text' name='item_amount'/><br/>
2 d9 y8 ^4 F( [' l<lable>Item Upgrade Amount</lable><br/>
; ^5 M/ C3 C7 m1 C# V% P<input type='text' name='item_upgrade'/><br/>6 F+ |6 N! _1 ~) S& ]% I, l" C" @! D
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
& V8 Q, H) b0 u6 H7 \
& \1 W- ^( l. o: K  s) W' g</lable><br/>
/ i" t! M" \, d<input type='text' name='item_element'/><br/>$ p' g$ B3 L, J  g$ U/ B3 w
<lable>Element Upgrade Amount</lable><br/>
' b; l/ |; q+ ]0 G<input type='text' name='element_upgrade'/><br/>
- ]0 ?. u% j7 @0 m4 l; G) b<lable>Pierced Amount</lable><br/>
- h6 Z% S" }5 t) z<input type='text' name='item_pierce'/><br/>% N* U) e$ O1 A% F9 [3 l
<input type='submit'/>
- y; S  ^9 C/ q. @- b</form>";! n2 k; I0 @, ~% R2 X2 H, q
}) b$ f2 x% ?! l$ Y4 C8 o
% R: F# Z! w3 O9 E9 m' l
function PostListener (){
! v3 E4 q; F/ K+ Q- {//Add more post variables if needed and add them to initform() function aswell! i" c( d, W3 x4 ~; c

% U+ g1 ?( c( v2 G0 y& X' z$ w################################( P1 k  H9 E: d" y1 J- N8 p. ~
##### Connection and Post ######
7 T7 n- S9 ^# [; q################################5 v& U# R& T; _3 q2 k6 L
$name = @$_POST['char'];, r* A9 J) o* y- {# K; T
$ItemName = @$_POST['item_name'];; d2 v+ v  `# X9 p1 M
$ItemAmount = @$_POST['item_amount'];* s- n8 l* ?9 Y7 A/ v( z) N) N: m
$ItemId = @$_POST['item_id'];
+ B, T7 ]* m" W4 r! O, V$ItemUpgrade = @$_POST['item_upgrade'];& A& o4 D9 f* C4 j" u# ?2 M  T4 e/ T* d
$ItemElement = @$_POST['item_element'];5 ^; f0 o' v$ v# w& N3 w- h6 a' H
$ElementUpgrade = @$_POST['element_upgrade'];
) ]5 s1 _7 C4 X6 J$ItemPierce = @$_POST['item_pierce'];" |0 i! z- U, T
################################
4 V! l5 e3 K# P' ?$ O% Q
. S/ Z. N7 C9 N3 t2 Y//Check both variables for empty value
0 \  {# Y* L3 J
! C/ Y. G6 e4 H" Rif (!empty($_POST['char'])){
0 D9 `2 s# l2 c$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where " I( s# L8 K1 a; [

/ W! h* @% b0 S; P# B7 p7 tm_szName = '{$name}'");! V+ h! z& p: Y2 p8 G3 U3 @
while ($row = mssql_fetch_object($find)){
5 p# K1 T' a% Yecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
9 e9 ]' s& ^) _7 x2 p$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], * ]" l% h+ r0 s) v7 W# }

* T: c2 v9 ?: O: j  X, }[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], ) R2 C9 \3 \) x) q$ K

3 ^( [1 s( o) U1 q3 ^3 _[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
: L4 {0 a7 u# a# I) y# H0 q2 |$ p3 `% N' D  r1 E7 q" W
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
, ~/ F2 o; o' [6 Y! m1 J/ N
7 R/ F" M6 n. K  {9 R" Z5 A/ B+ D'{$ElementUpgrade}', '{$ItemPierce}');");6 a" F+ i9 D  p8 E8 H! W9 o3 J* _
}
3 `( W) o. r) w, j8 ]' M
! E' W0 }# ?- d& M8 C$ Q3 O}% C& I: T5 Z/ ]" r9 H* s) V
$ s# F9 ^9 h$ X1 ^9 y  ?
}/ [; ^- V) _8 u2 u9 J& O( w, Z0 Q
+ [9 Z$ |4 C7 `2 t$ a$ p8 J/ G* }
$InitForm = InitForm();/ d7 n! D$ O/ J% L* E  g( l! a1 c
$Listener = PostListener();  E+ y$ {$ a$ E% U

) k0 n) f. b" Y6 |( r?>" e* M2 I. \3 b$ ^- V

- Q/ R6 |* s) T2 O, }$ }& L: c$ I2 U# I4 ?  h2 |. ^* Y

/ q; Z/ y) G! B( _8 g  P" }8 j9 C* P% b: \+ b' n; u
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-28 09:25 , Processed in 0.104107 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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