飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php/ v1 L" H" J5 {7 T. X7 {' n
function Connect () {
, m1 ^0 o! l( j% f- k$ V# q) ]mssql_connect('Server','UserName','Password') or die('Error: Connection to DB : b1 d  q4 H/ J! b% S# `

+ p/ R; H; j) QFailed.');" w0 l9 {' \5 p& C+ @
}) X/ v) {- j; b2 l% O! F7 h3 s
Connect();; P; a' u# \8 u2 `4 V. y

$ a% ?4 n* k3 `7 Jfunction InitForm(){/ u3 w/ S+ v/ e. [( K$ b
//layout for the form
& O$ C) `; w: |: n  Jecho "<strong>Send Items.</strong>* s& G+ k6 Z1 o) B7 K" T' D
<form name='select' method='post'>
% y: g; i2 O  \7 X* y5 L; d<lable>Character Name</lable><br/>+ t" G4 z6 \4 S
<input type='text' name='char'/><br/>
1 v  G( [4 E! c5 n% Y2 Y. {: R: R<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
# a7 Y, J7 L0 O* h! F6 w2 b7 C<input type='text' name='item_name'/><br/>
: A6 t2 ~" z7 E<lable>Item Amount</lable><br/>: J; X6 v$ p* L. a& F
<input type='text' name='item_amount'/><br/>
* Q5 F6 |; I9 u( k0 p<lable>Item Upgrade Amount</lable><br/>
, \& s3 H0 K' x<input type='text' name='item_upgrade'/><br/>
% N: |: c; ?% Y* m+ W0 J<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
8 Q2 ?* P, t1 a( W! D3 x
# L' P7 O; H1 D</lable><br/>
3 L3 z, K, T2 F$ G. J7 x<input type='text' name='item_element'/><br/>4 W  r5 d3 k" A' i% U9 t' b
<lable>Element Upgrade Amount</lable><br/>* x+ k3 B2 W% @. K
<input type='text' name='element_upgrade'/><br/>3 B. @0 B8 Q) A
<lable>Pierced Amount</lable><br/>* ?3 d) \2 T9 s7 f
<input type='text' name='item_pierce'/><br/>, {5 W$ @  \; l) P1 `' ^
<input type='submit'/>0 B& \$ O1 w( h& U6 ^" T
</form>";) B' D( E6 R; ?, m4 O
}* I9 e3 X1 n* G! u7 c
* }3 C7 x; F' ]& @& F9 E
function PostListener (){8 \2 X. o% |# g) S
//Add more post variables if needed and add them to initform() function aswell
* v2 v! D! M9 ]! u( o+ h
6 \6 c, O- d" a5 F################################; U8 k5 v9 h) x8 Z+ J
##### Connection and Post ######0 c. C- B+ t6 b; |2 n4 n$ V
################################; Z, n9 i2 M- j3 m: [- _2 y
$name = @$_POST['char'];
4 b2 R" O! U7 N+ c% v# _6 G, S6 X$ItemName = @$_POST['item_name'];- t( M0 A/ L( f; u0 z+ R6 Q
$ItemAmount = @$_POST['item_amount'];% d4 g8 v3 O* L
$ItemId = @$_POST['item_id'];
" X& F: p3 d' L& d$ F$ItemUpgrade = @$_POST['item_upgrade'];  j+ W$ F; w- h6 J/ r
$ItemElement = @$_POST['item_element'];
3 F+ o9 y/ [. w. }- w0 [$ElementUpgrade = @$_POST['element_upgrade'];
, F0 x/ n. _1 J7 ]- u* p( H$ItemPierce = @$_POST['item_pierce'];& V2 A! W6 x; I& G- c/ L. ?+ ?: K# H
################################
7 g9 V3 {+ f* T! S, l$ n2 x4 c9 h% w9 s
//Check both variables for empty value
- ]/ p5 F- F4 L7 _
- u; T9 ~6 d' }. A. ]+ N; _if (!empty($_POST['char'])){7 d0 W" j* |' {; E! E, G2 j; r
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
5 p' Q/ O4 g$ B. T5 I; D, j6 O3 `1 X3 J6 e' f
m_szName = '{$name}'");
$ `( ?5 u7 J4 X* Lwhile ($row = mssql_fetch_object($find)){  M# m) A+ c/ f4 @
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
( U- R* s( j" B; m7 _. m$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], $ R! j" J8 ]8 D8 t6 y5 W7 M

, s/ W& e( s8 }0 O/ L5 S7 [" `4 `[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
% i5 P& h/ w' _. h0 B7 s- i0 ]0 {. x
7 |8 x6 K: l# W1 J[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', ) X3 r# B* Q! ]1 h* Q
* }( i/ m! n* R: h
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', ( i) l2 j: R/ E) d9 q
, B9 s9 B6 Q1 r
'{$ElementUpgrade}', '{$ItemPierce}');");
8 t% |, d/ E& y5 T* j* e" \}
$ K* E' b1 |5 c* I; T. }) P3 D9 I2 T1 A" D: l8 `; \
}' ^% \& X" j/ y

- a9 a1 x2 [; E}
8 \5 M4 s3 i7 ~
: b" y, q* M" m% W$InitForm = InitForm();& ?9 M6 g% Z% {% D
$Listener = PostListener();. _- ~8 v0 H' F' I  d
0 G: \; ^5 S* _  |/ Q
?>+ |5 W7 M0 v' H- _3 s

1 l  i  y: b7 t- Y; L6 \
9 ^  }% f4 s1 Q: ^8 I  {
) R* y/ `% Y. c2 }( Y  g4 s8 E; I  D, {4 P$ m
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-12 01:51 , Processed in 0.081503 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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