飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php1 z( U/ ?+ a) H7 l3 U+ |2 q4 C; |
function Connect () {
! w4 {$ I5 A! _+ Rmssql_connect('Server','UserName','Password') or die('Error: Connection to DB 2 u  C1 C% }( t* ^: [8 U

3 l% _) m; R, a1 ^* rFailed.');& @. B* e  G- A+ p+ c
}
$ D7 F/ ^1 V, Y* f0 M: l- w& `Connect();' r+ J5 J8 w  b+ L
: V7 M! k* F( z6 G) [
function InitForm(){6 m# o/ w3 V% p1 s  U/ e( T8 Q5 H
//layout for the form9 Z  F5 u5 Z/ {5 g
echo "<strong>Send Items.</strong>3 w" F, p3 K6 ?
<form name='select' method='post'>
" e! \2 o7 \8 Y) }6 A4 R<lable>Character Name</lable><br/>
9 C' O2 [1 P8 a; t6 O: F7 d2 Z<input type='text' name='char'/><br/>
/ Q' D9 P$ ]. S* V<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
: p  V0 m' p$ w$ i" u! r/ ?& E<input type='text' name='item_name'/><br/>( K- \! s. ~( T7 n- v5 [/ |
<lable>Item Amount</lable><br/>
  Z) ~) w) \' U2 u; w<input type='text' name='item_amount'/><br/>
/ m1 `" ~; F; F- Q. s<lable>Item Upgrade Amount</lable><br/>% y, F/ m* x  l8 A
<input type='text' name='item_upgrade'/><br/>
" H3 K/ f! Y3 A6 f% M5 u<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)- S# r3 S$ l) j3 k: v5 b7 Y

( N" O9 P" f: ^7 g$ W) c/ j) D</lable><br/>
% d5 k2 W0 `( M/ j- \0 g<input type='text' name='item_element'/><br/>
% J, }$ m# N, h$ ^7 f% \<lable>Element Upgrade Amount</lable><br/>
5 M/ o, O! ^$ l+ h<input type='text' name='element_upgrade'/><br/>
& }, C; [* E. A' y7 z<lable>Pierced Amount</lable><br/>% k2 `$ f% _6 b% x8 [7 J
<input type='text' name='item_pierce'/><br/>
! j' |  P! G$ S" q( _% x! ?, Z<input type='submit'/>
4 x* t8 `& y3 J( s- m</form>";
. p. V  F1 g, I4 G  t/ k}
* N7 P9 |4 E; |0 y2 @2 v0 F" I& H  ?7 g, N6 x
function PostListener (){7 p! `$ n% \2 w
//Add more post variables if needed and add them to initform() function aswell
+ k7 d( U  ]3 `( X* @$ @6 g) U$ b0 }6 B6 @1 V
################################9 F+ D5 y8 N# m# M/ `& i
##### Connection and Post ######& z) N; P" r9 G5 f& x
################################  B8 w5 Q3 `# h  l
$name = @$_POST['char'];% p& u% J. ?) f3 K! E" L
$ItemName = @$_POST['item_name'];
/ |0 G" k# @& O9 f$ItemAmount = @$_POST['item_amount'];
3 b; y, @2 D8 e" x: u* {2 p8 b* R. t$ItemId = @$_POST['item_id'];
% _6 Q1 [3 ~$ w: V8 r- X$ItemUpgrade = @$_POST['item_upgrade'];
: Y8 g: |3 D+ V6 N6 Y$ItemElement = @$_POST['item_element'];, z) s( n+ l+ a$ Z9 h/ R- L- p, E1 Y
$ElementUpgrade = @$_POST['element_upgrade'];
3 A+ D! r$ k% `. c& {: d7 H$ItemPierce = @$_POST['item_pierce'];! I( {# U" k" g. w% S$ ?3 U: ^
################################
4 D' \3 n+ n: ~- w
' H3 |. Z& o$ L//Check both variables for empty value
0 Q7 F" Z8 o2 p/ }! w
/ Y& F# a: [/ O( Yif (!empty($_POST['char'])){; Q4 g6 _7 Z$ {. A
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
, W/ r0 G2 o. b' |* P* g5 }- @; Y4 l3 G  P
m_szName = '{$name}'");
3 `! C" p; C4 J% ewhile ($row = mssql_fetch_object($find)){
4 O- ^( X4 b, Z" W; ?/ X& ~: ~echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";) H/ q) C6 Z5 l+ C0 H% K
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
! q* M8 c) _/ t9 d) F( Y9 [
9 @4 |2 n( {1 D0 i[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 0 k( |: N" k3 H# b- d
" D- S  J) e4 s- u+ D$ a
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', . c+ B' w& d5 r3 F1 }
+ p  Z' W( D" |
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
8 C* s, ]3 X3 Y  L5 F1 Q  ^! W* }( p' a3 _7 `' v* K
'{$ElementUpgrade}', '{$ItemPierce}');");
! p& s! s/ S& [3 `; k* h) T}
9 k, o3 @  ?2 b  U. J+ y. H! @6 V8 @! n" q$ G; Y
}# i8 b2 R" G* R: i$ ]$ S4 \; p

5 V/ W7 |# |- H" P. b% O+ h}3 D. m% k/ w  b- ?3 ^. T1 F' X
8 s  m: v$ E% i6 J
$InitForm = InitForm();. n4 `6 M0 B& i! i/ E
$Listener = PostListener();- P6 U& H0 J; G

" R- s1 ?* D; Z( V1 j7 l?>% V. @/ R& x' _+ n% e' @1 b
: @% B7 r7 V& Y1 V  \

& _& ]) L0 ~$ V3 ?, U# I1 Y
; Y0 ^) K1 U& E5 I! Q" E1 F4 _  t; ?! f' s3 x; W& }& ?" z
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-4 12:38 , Processed in 0.060755 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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