飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php3 o2 d5 z0 i( k' d3 A
function Connect () {
- j; [% X  \0 imssql_connect('Server','UserName','Password') or die('Error: Connection to DB
2 Q9 i% s9 u: p" L" G; u% f; _+ `! ~' _8 E7 K! {( t
Failed.');
5 f9 L( L. |- V3 B* q}
+ `" }- x- J' b; gConnect();, P4 K. z4 {+ h

, H6 X7 N: t2 Y: z! a0 Q" tfunction InitForm(){
3 A4 P. l$ K1 Q$ v) A( w4 \; ]( D//layout for the form
+ g/ U+ w% V/ b+ ?9 N2 c4 ^0 w6 {echo "<strong>Send Items.</strong>+ r$ k' E% w. f
<form name='select' method='post'>
: E  }3 |# \. C7 v- l+ K7 n% E6 ~<lable>Character Name</lable><br/>
) S/ a% T) g8 D" t( {) V) m  w<input type='text' name='char'/><br/>
, w  u3 F8 v' ^% L, A% j- q<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
% `: t. i- \/ ?6 T& O<input type='text' name='item_name'/><br/>2 m+ b2 _1 s. k5 e- F
<lable>Item Amount</lable><br/>7 p3 R" I3 I7 b( X$ X# [" J
<input type='text' name='item_amount'/><br/>; f9 d" l- I' @- N' B; c
<lable>Item Upgrade Amount</lable><br/>
! E- n' h+ z. W" i2 a<input type='text' name='item_upgrade'/><br/>
  v" ?' }7 @5 N  e* n3 P<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
7 r$ b1 L8 j$ C- Y' U+ M) f
' d2 k& X' o& U2 C8 d</lable><br/>: x4 N) X, }; ]
<input type='text' name='item_element'/><br/>
8 V6 _. X) g% s$ g  [- ~! A<lable>Element Upgrade Amount</lable><br/>
# n3 i" l) Y9 F' M/ H( g+ O: \4 E<input type='text' name='element_upgrade'/><br/>* L! t1 [' D3 e* e# X8 N3 j
<lable>Pierced Amount</lable><br/>8 z0 Y( m" }2 ^, X: ?
<input type='text' name='item_pierce'/><br/>7 E7 K. F- |7 [. ?
<input type='submit'/>" F+ A7 X$ f- j3 ^
</form>";
8 y; {  I! z% R1 Z" z" E+ z}& ?7 e8 b3 {3 a) F8 C( W! @

8 }+ g; X. {7 g, efunction PostListener (){
" {5 I) |# J9 n: f//Add more post variables if needed and add them to initform() function aswell
6 U) R, w5 C$ j/ T' A% [
" ~8 N% B/ W; @( _' B6 y################################: _. _5 Z- h6 x7 c3 d
##### Connection and Post ######2 V+ ~) I* j: H! b5 T. D$ [: s
################################1 R  Y9 n( w1 C" W- J
$name = @$_POST['char'];
& I* O9 u$ M. a1 Q; j( {$ItemName = @$_POST['item_name'];
/ N0 ~0 b2 \' {7 V% W7 t. O8 ?$ItemAmount = @$_POST['item_amount'];
2 n. e, ]( v; i5 M1 S( @$ItemId = @$_POST['item_id'];
* t' V1 g& {' N1 M$ItemUpgrade = @$_POST['item_upgrade'];
. G+ B0 j6 A! Y  H: t+ N$ItemElement = @$_POST['item_element'];1 t+ r6 r. ~# N& B# S8 c  p
$ElementUpgrade = @$_POST['element_upgrade'];0 F. U, U! A0 |2 Y% T1 j; b6 u
$ItemPierce = @$_POST['item_pierce'];4 G% f1 o7 \9 P. k1 k1 b3 b
################################: P/ g8 ?9 F" E  ^, I% G
; ~: \: t  U% f% v$ G; r
//Check both variables for empty value
) O) P$ d  c- F$ c) }  w
, ~0 `8 Z; q0 X- M( ^$ X) vif (!empty($_POST['char'])){
) }1 P2 r: B! [6 w! ]$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
: Q% ?4 x  B/ Q0 H: L" v6 R7 P- C% n
m_szName = '{$name}'");) T+ T' Z3 P. \% l
while ($row = mssql_fetch_object($find)){
5 m+ Y: B% O) v4 J8 {5 g# q2 e" }* V$ uecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
& h6 s: p. z9 V( y2 j' c& ?% s3 L$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 3 a& j( s6 F$ K, b$ O) Q

+ Z% ~+ H0 U" [. t+ l" ]: s  V[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], ) F9 t' [( U: A7 L2 G# W% j- M

- B/ I% i7 I- n* Z! ][m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
/ z$ \: C! M: c4 {( |7 F4 a; k" P" h8 q$ w+ e
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', 9 Q- |4 ^7 k* B2 @; r- x) V

# ?3 e/ W# v/ {'{$ElementUpgrade}', '{$ItemPierce}');");
$ g: N1 k) V+ H' F2 S! `( v& {}
  J& L3 R3 J. }" w: w: s% f
. m) B/ _' D( c6 c% v0 o}
( s9 K6 l3 E# Q9 P2 i$ c  t
9 T& L% ^% O0 r! Y6 a: W7 H}2 X" D- M6 Q. s6 P( Z; _

3 J/ o! {% y% \1 B$InitForm = InitForm();( Z/ c" h2 ?+ \1 L
$Listener = PostListener();
. b# H! h8 x! ?: A% C* w* K- y  \( x* B' d1 n/ c2 u* S
?>
- \5 o$ o8 }9 L) V& s$ {3 f4 M% K: j* g5 ]
, z6 X/ B0 @' E3 g$ \; U
/ ^/ a! W2 ]( h2 i* \- V
* i# [: s3 d! V+ J* _
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-12 05:40 , Processed in 0.071590 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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