飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1094

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1094
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
<?php
. v" d, c' x9 @4 Q6 kfunction Connect () {1 w+ g/ j3 W4 M0 @, G8 k+ s6 N1 e
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
3 h1 I; W# q& ?9 i0 [
  }! A5 c& F( @! {. B. mFailed.');
# p' w! w! q3 G& @+ U) T}
" r4 S% d0 g% v9 C* i1 J7 NConnect();7 R  r; ]# {/ E$ }% w

5 V2 O! S0 A* |& e0 Q. Z8 p* Afunction InitForm(){& k, r9 U/ V6 k" |  L% G8 Q
//layout for the form
' ^9 g# J% O% Z3 |7 }2 _echo "<strong>Send Items.</strong>
6 b. P: P2 r5 V, O( M* c2 A<form name='select' method='post'>0 k% G" e/ F8 L  x4 Y
<lable>Character Name</lable><br/>
* M- z  X9 ~0 }. B<input type='text' name='char'/><br/>
/ [" T1 b- y! a, e' S! g$ c<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>& ^  n, K& {' ^* ]& {
<input type='text' name='item_name'/><br/>
' `' |3 U1 |3 |7 E& N0 h+ b<lable>Item Amount</lable><br/>
( ]$ U  q  Q+ E5 W7 b<input type='text' name='item_amount'/><br/>! W5 T2 a! A, ?* w0 c
<lable>Item Upgrade Amount</lable><br/>* c; t& H9 x9 e' K& f7 b) }
<input type='text' name='item_upgrade'/><br/>
/ _& I" p2 B0 K# u0 L, C% T& h( l- `. k<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)0 D- Q/ ~( U4 M5 G9 I9 k. W
! A5 t9 O- k6 U2 |, ]
</lable><br/>
$ H: T- r9 h: n& F<input type='text' name='item_element'/><br/>
- Y* Z5 c7 ~( \- }<lable>Element Upgrade Amount</lable><br/>6 P+ X5 [$ _% T# Z0 M
<input type='text' name='element_upgrade'/><br/>. p0 @  Y8 u, Y9 k. H
<lable>Pierced Amount</lable><br/>3 z+ ?: R+ J: E3 h/ p5 O8 U, E. D
<input type='text' name='item_pierce'/><br/>
" ]  y: x3 |3 ]( Q$ l' m6 M5 u<input type='submit'/>% K* y/ b) Z/ R5 m
</form>";
0 v6 g: B/ d8 C/ I}
* ^/ ^  ]" R; x2 e
" y' ]/ K' }, t5 n- }( hfunction PostListener (){+ E. B! d% _; y; |5 u$ N6 Q
//Add more post variables if needed and add them to initform() function aswell( g$ `0 C' m: S) f
4 B' d! ?* B3 u+ w/ j$ A
################################$ ?% K3 f1 H  S" e
##### Connection and Post ######5 Q) R: }' R2 P
################################
8 S3 V; e7 a7 m1 M8 S6 u# A" n7 g$name = @$_POST['char'];
, E$ X2 A/ S4 z* z$ItemName = @$_POST['item_name'];
! c1 ~4 l- M6 e# W* x6 F+ r2 v$ItemAmount = @$_POST['item_amount'];
1 D3 j1 G5 B6 ?3 n; r' J4 `) r9 |$ G9 `$ItemId = @$_POST['item_id'];
/ l! @4 U. }6 D4 F$ItemUpgrade = @$_POST['item_upgrade'];
0 {: b+ d: a# ^7 M3 \& {' }5 f$ ]$ItemElement = @$_POST['item_element'];
8 E' W  T. r8 V$ Z! O$ElementUpgrade = @$_POST['element_upgrade'];
: z$ m& w( `8 k$ItemPierce = @$_POST['item_pierce'];0 S6 d5 s& H( l  J
################################4 j# M% u+ z5 w& ?

6 W" A1 s! ^) \; k% [4 H//Check both variables for empty value
1 d4 p2 c% N/ `) D
& Q) g* P9 L; @& [if (!empty($_POST['char'])){
7 W" w; c- A3 Q: M  u$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where / _7 Z: {' B) w8 t

* C& @# W) e1 {8 i. j1 im_szName = '{$name}'");! y# Q. a, G! j7 p8 \) u' @* `) {. D
while ($row = mssql_fetch_object($find)){0 e9 Z' w5 c, s" W+ u
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
2 |  Q5 {4 f) |% g$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 5 c7 o5 N8 ?# e7 h  s! A$ G

+ C  Q1 v! l& s! y! F' Z[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 6 C' c4 S. B6 V
2 L$ B0 S* {! J& W/ g7 y' w5 d2 I
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', % t' A7 r' L' a

1 u" N8 N# a8 p6 Z+ Z  Z7 GN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', * |" Z2 n7 `" M) W

7 n, U$ B9 i& r0 ['{$ElementUpgrade}', '{$ItemPierce}');");
4 z+ L( `& X' C6 E1 q6 y( d}3 C/ n& ]9 O# C4 H: ~. Q$ j
, n  ]2 c0 e. G9 W( S3 E
}
; d$ Q0 U3 v: x' H% Q
7 B5 N9 a$ G" T4 i) j6 \}
7 n) b2 O7 G; y3 m" ]2 M& e5 D  Q% k! [
$InitForm = InitForm();7 D. H) E$ E) Y% C8 O7 H# a6 s
$Listener = PostListener();9 F+ Y; U3 e) J6 R6 f0 |+ d# W
. b: V! Z3 g$ |) d* K! B
?>
/ _( \$ X, P: G$ U
2 t8 S  A5 H5 z8 ~" r& P9 a
! [6 w( X4 T% j: U1 s
: b% N5 c# ?6 |7 y" e
" m( I3 ~, @& |0 {( g8 @
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-31 19:16 , Processed in 0.067905 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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