飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
<?php- D* P' M+ {/ b4 n' b( @! `  b# e
function Connect () {
( q2 L1 {/ a' u/ }$ {8 F1 E3 Nmssql_connect('Server','UserName','Password') or die('Error: Connection to DB
5 I+ t% F1 _6 v1 {: b" }& n
9 I) J/ D4 \' V; G6 QFailed.');4 L% y4 ~; _6 i0 {+ K) _
}
% B" A) [0 j) e" Z) _- V( NConnect();
2 y( e# X6 d* Z! R$ n- S  Y  S9 I2 \3 h' @6 D7 }, u- m
function InitForm(){
4 c7 I# _* c5 M# i' `. \; ^* t//layout for the form
9 P( s9 v' h3 f5 ^5 ~% l5 Recho "<strong>Send Items.</strong>
  m* N6 K5 p, d+ B<form name='select' method='post'>% p- `( k7 B; s% u( q
<lable>Character Name</lable><br/>
$ o% p/ s2 i3 }$ C1 {<input type='text' name='char'/><br/>
! @8 ]- {6 ~( K; S" Q# W5 u" ?' N+ E# I* g<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>0 y/ H2 L" R( J: k( `* ]
<input type='text' name='item_name'/><br/>, w3 s. S! w* W$ ?  D* G
<lable>Item Amount</lable><br/>$ l' s0 N1 f8 L$ J# c/ }! q# X2 S
<input type='text' name='item_amount'/><br/>8 _: E! l3 m+ c/ [. P- R8 Z
<lable>Item Upgrade Amount</lable><br/>. O: ^% [0 a" a5 B- ]9 u. g' U
<input type='text' name='item_upgrade'/><br/>
3 o) X2 Q5 e; h. e( C" n<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)" S( |4 i9 R, x% [
- @+ z; p& ~9 f7 |& {# m
</lable><br/>
3 V8 N0 `/ F# u8 |/ W8 O<input type='text' name='item_element'/><br/>
$ y7 j7 p1 A9 N( ]+ G# A<lable>Element Upgrade Amount</lable><br/>  x  {# p7 N/ C
<input type='text' name='element_upgrade'/><br/>* E8 v2 |6 i  }+ |; N8 _
<lable>Pierced Amount</lable><br/>
( x8 y6 s9 C  B; A* e<input type='text' name='item_pierce'/><br/>. ^3 T3 }+ h, W* j
<input type='submit'/>
9 N, t/ w% C4 V4 q5 q9 {3 S& \, _5 E9 o</form>";
: {+ w" Y: ^+ v}
+ E) ?7 L2 X6 [2 h9 s
/ p) J9 k& r6 V) rfunction PostListener (){
4 f" ]9 I/ j6 ~* R//Add more post variables if needed and add them to initform() function aswell
" J( U4 h; k  l2 B) y- O7 R
( n: S, g+ g3 e# D- C################################/ R# |$ a8 b4 ]2 o# T$ ?; I
##### Connection and Post ######
5 O* i9 h3 M6 M1 x8 I, K################################8 L+ t* ?) E# t& x0 N" M1 n
$name = @$_POST['char'];
- S! B+ H( ?$ c! z* s- j$ItemName = @$_POST['item_name'];
: y0 k# C* m& e: ]" ~1 B$ItemAmount = @$_POST['item_amount'];
6 B# T; E- I* d4 a$ItemId = @$_POST['item_id'];% M5 w2 U+ m- }; F* ?
$ItemUpgrade = @$_POST['item_upgrade'];
9 j& \2 Y4 a7 q4 h$ItemElement = @$_POST['item_element'];
) g0 B1 X, C% T9 Q0 _  v$ElementUpgrade = @$_POST['element_upgrade'];
, d" o! W$ f2 j4 C. ^  a  n" [$ItemPierce = @$_POST['item_pierce'];1 H- g+ o8 i- p  n0 E  {7 C. ^
################################
" \$ v9 R* \; h( w- t2 t" o* w. T( [4 W2 C8 r( f6 j
//Check both variables for empty value5 `$ g$ k* U; x- }" v1 G) @

" I9 }+ N; o: j0 {- eif (!empty($_POST['char'])){
& O2 d  ]- j5 r( O& |8 Z8 a! Y2 v$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where % O* G- U' n- K) H+ c

7 g/ I8 j) A% Tm_szName = '{$name}'");  A4 h9 B0 k3 x) P( T. k
while ($row = mssql_fetch_object($find)){0 G* H; m; y3 h- J
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";4 v$ Y7 @( s+ W
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 5 m; P  @) Q. D) I) M* T& T

3 z( Y# K/ G8 R. u. i0 o! k[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 2 F8 l% [8 q, D0 G
0 H4 |. W2 X4 Y. P! O
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
2 ?8 o. o- _( @) z9 R. B& j! h  _: C: H% n) U& [2 @
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', ' O9 [2 G0 w  D; J+ ~

1 w% u, ~( ~1 F& F+ B6 A6 C'{$ElementUpgrade}', '{$ItemPierce}');");
! \4 ]% X3 `3 W6 q, ^% `1 y( \: E7 e% }}
$ [' C, i9 q- H3 |/ G  h
2 H* X, Z9 b" L# Y" W}
- b; P6 p  D( l% p) k' n) W' n
/ C! W1 @  ?+ D/ h# }4 G}- z7 b+ P' ~/ y4 s' l
1 W  W. v. S$ E. d- L8 b8 X
$InitForm = InitForm();
; d9 J6 @! G. c. h8 `% N& V$Listener = PostListener();
  B7 R4 \1 o# W+ [; w
5 U+ o! `: K& a6 P( {8 b?>& s$ j: T% F3 V  U
8 E  t1 n: f5 ~3 b4 p# G* q; ~& z7 }+ v

$ h0 x) G; e: l3 C. i
' m' D/ _2 ~# i8 _/ a5 g! m* h) A! K/ f) R  h& g* Z& c
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-9 07:50 , Processed in 0.060048 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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