飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php1 x* f6 N, L9 S8 m; K
function Connect () {+ m  A% ]4 ^% I+ a
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
: V. U& B! G2 r$ `) O  A  W" g
. A  R7 c, T' t: i0 p& g& [6 `* J3 FFailed.');
/ ]  s7 l1 w' |6 I' F4 z) ^}
5 @, l4 ~2 A. \4 k, c! FConnect();
! `$ O3 l( {( E9 E$ g* R' W
7 R3 y) f% e3 y& h! A9 yfunction InitForm(){
6 Z, ~$ i- t7 V- e( ^* l//layout for the form  d( v1 E: d& @$ |
echo "<strong>Send Items.</strong>
" x& j9 x6 T2 d! _7 i<form name='select' method='post'>
# R1 ?3 t6 x) L$ ?6 L! Z: F1 {<lable>Character Name</lable><br/>
6 Z* N; q; w: I: p) g<input type='text' name='char'/><br/>
7 j6 f* A3 e/ b5 A<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>! o6 g6 L/ M8 a6 ^( T" \
<input type='text' name='item_name'/><br/># ?8 y4 k, Z) w( b* M9 _, G; P
<lable>Item Amount</lable><br/>2 {9 v% [/ g' c6 c( ?7 Q
<input type='text' name='item_amount'/><br/>
5 b$ T6 Q, }, M  `4 K$ b<lable>Item Upgrade Amount</lable><br/>8 L6 s$ @# M/ s0 J9 H
<input type='text' name='item_upgrade'/><br/>/ G' C$ [9 }+ B( z& Q
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
  k7 _. C+ N  a0 `' r3 M0 e; q$ M! p; N6 H6 ~4 |
</lable><br/>
/ E( A) n4 _- h2 W9 i0 m<input type='text' name='item_element'/><br/>+ ~# c6 _7 `5 h. q% b. R
<lable>Element Upgrade Amount</lable><br/>
! x9 G# M$ t+ _, \3 j<input type='text' name='element_upgrade'/><br/>5 ?3 Q" Q; `! n# y8 Z
<lable>Pierced Amount</lable><br/>2 W# C) b& I* f( ]+ m$ |7 O/ H
<input type='text' name='item_pierce'/><br/>3 l- d! y( D7 Y* @, B. m/ n  ~
<input type='submit'/>" c6 I# c  V' ?$ D# _4 A/ A; k
</form>";
" V  ]4 g0 F' S: ?}
& M; w) Y. C2 M" B+ r2 I. b+ J" M- Q, _) y. a
function PostListener (){% R0 k: ~; Q  B
//Add more post variables if needed and add them to initform() function aswell. n" f  j. g1 \: u" T

) x, @- k3 w: L) C3 l################################; F6 S! G; j' f9 o1 A2 ]
##### Connection and Post ######3 n5 o: i! M4 w. G/ [) U2 t
################################  |+ v( [) m" l) d) V
$name = @$_POST['char'];
& d8 q6 x2 F$ b$ i5 W$ItemName = @$_POST['item_name'];
- D8 T) L: T$ z9 F6 W( v9 `5 q$ItemAmount = @$_POST['item_amount'];
+ b: b2 n9 h# J* c: d* \$ItemId = @$_POST['item_id'];+ V/ j8 W: C2 \% ~# b9 n4 {
$ItemUpgrade = @$_POST['item_upgrade'];* u  s6 E% m0 j+ Z6 F4 H# }. w# Q
$ItemElement = @$_POST['item_element'];  N" m3 y. J9 a8 a, V
$ElementUpgrade = @$_POST['element_upgrade'];% u+ F, o' x' J
$ItemPierce = @$_POST['item_pierce'];% V( I5 v% P' t1 f# F
################################* ?4 k& i, k' |9 i" m

7 w) r3 s6 j- k0 V$ V//Check both variables for empty value- H5 f; I; Z" t/ R; J

: @& C3 o" M- n' q1 Dif (!empty($_POST['char'])){  `3 [/ R  z! R0 Z( H
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
/ ]: B" B+ u1 D. g! P" J! _
$ x9 Z- _# A5 |- L* c* Y7 \9 b0 qm_szName = '{$name}'");* W* Q2 b: n4 [$ V2 G1 V
while ($row = mssql_fetch_object($find)){
, y/ w- }( Z! _$ L( Pecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";0 ]# o8 n; ?1 A, J  j1 E
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], - ^  C' [/ f" G9 l
2 F) P5 U# ?8 \4 [% b) I
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
- y3 m' L2 T( Z  ~4 ?
3 B0 b; G7 ]1 s8 `( E8 r3 M[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 9 v3 y& P5 Q3 \% y' Z8 o2 J+ A
8 t$ {6 v/ `- S
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', + l4 t1 E) H7 Z/ A' V
& {: i6 V8 c; d: a" h
'{$ElementUpgrade}', '{$ItemPierce}');");
# |% E, C7 p$ i}
& O+ N& _& q+ y: _* U3 W5 O
& Z8 D+ J  m/ m/ S" y7 \7 B; g}% e2 q7 V1 H$ X7 T: {) f0 q
, _" Z7 E. Y7 @; g, C# @
}
$ h, N6 X$ K  M3 V& z! {
% Q3 A* r& Z, p$InitForm = InitForm();) A" w5 n7 l; s* |3 ^
$Listener = PostListener();  g5 e0 [* P- [- M8 P! ]

! p0 r' m/ T4 N0 J# F- _4 z* u?>
, E8 I5 m4 a( \" r5 r8 ~) H# }5 O7 [8 j( {. z7 D2 K
3 |3 v) n/ j* W, U; [
1 P5 e. E2 i1 h5 [3 D3 x; S
2 h1 q) C- C1 m- M# J
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-27 00:19 , Processed in 0.075258 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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