飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
/ s( [! O3 f6 Rfunction Connect () {8 f, w6 a5 S( f6 `$ ~3 E" B1 T
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB - g& p+ i2 m$ L* V9 Z7 L+ j( n3 @! C1 {
) x) g9 D9 ~) l5 M  Y
Failed.');( i& F5 O  Y2 ~) r' v3 x+ k+ U5 e
}* B" Z3 j3 `( P  @+ S5 A  c5 h
Connect();0 X* _) `5 U: K& S' X, ~3 }* m
; B# }/ M! T( t3 n4 U8 g
function InitForm(){$ `! |& W! g3 v! B* l) l$ i
//layout for the form4 J& O- ?, F% L* p/ s
echo "<strong>Send Items.</strong>
# F' l0 H1 y: d; ^2 O7 G" c9 B' z<form name='select' method='post'>0 O% J8 v# y' L  ~
<lable>Character Name</lable><br/>
0 k/ \# |8 H. r, w" r. C1 N- J/ `<input type='text' name='char'/><br/>
# N% o$ c! @# h; A<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>4 I6 A- I( [- G* s: w4 x* w
<input type='text' name='item_name'/><br/>& \! S8 r6 }* o& H) o& y) E; x
<lable>Item Amount</lable><br/>
, z4 ~0 @* F' B. m2 P: \) b" [<input type='text' name='item_amount'/><br/>
$ o; g# O% B) R) q0 Y" y; D. _<lable>Item Upgrade Amount</lable><br/>/ f1 W/ ?7 o0 z' s6 z9 H7 K
<input type='text' name='item_upgrade'/><br/>
8 i4 h+ Z# f& O" @8 V5 k, }4 j<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)- O+ N  T* y. _% M3 k

3 [0 W! o* `* e</lable><br/>: }2 n% [' [% v
<input type='text' name='item_element'/><br/>
# q: x& X* @1 Y; `<lable>Element Upgrade Amount</lable><br/>( j% r. B2 w& `( Q
<input type='text' name='element_upgrade'/><br/>
& `: {9 a( u& V<lable>Pierced Amount</lable><br/>
0 n$ d1 A; u$ ?, a<input type='text' name='item_pierce'/><br/>: q2 x: R) ~! b
<input type='submit'/>
" q6 f  F$ Q+ p/ d8 D1 x  \  B</form>";7 W1 Q9 D$ s7 \& V1 l# ?
}" f& T' \* F' @  ^# b, ~

5 P7 K6 i/ B3 w( ]function PostListener (){2 ^% Z1 i% o4 e
//Add more post variables if needed and add them to initform() function aswell3 e; {- y* b( S. ~

7 }& w& i$ n* b- s################################
4 }% v4 {( r: M# ^6 r$ W" P" f( z! h##### Connection and Post ######
! y7 o% t4 ~: j# b( N1 E! p" I################################
5 c7 M$ C) R0 d8 _7 S9 E$name = @$_POST['char'];
3 ^2 b1 u9 o. U$ItemName = @$_POST['item_name'];
) l; P: s) n' Z$ B9 L$ItemAmount = @$_POST['item_amount'];- y& @$ U+ X, v5 K2 B7 ?* [9 O
$ItemId = @$_POST['item_id'];0 ^3 _7 e9 c5 ]* o$ I
$ItemUpgrade = @$_POST['item_upgrade'];
  K9 S  M/ `6 p$ItemElement = @$_POST['item_element'];
; X& A7 k8 l/ n, s" s. W$ElementUpgrade = @$_POST['element_upgrade'];; Q3 z7 D" e9 K9 [5 {  O
$ItemPierce = @$_POST['item_pierce'];5 s0 I* w# W$ q/ O
################################. i& t$ p0 b' \3 }; X! N
# k3 t* Q2 f: A. K4 r
//Check both variables for empty value$ F7 ]' H$ r  f% C

, Z, q( R! ~# c" Fif (!empty($_POST['char'])){& H) W3 q9 j" B( f" F
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
1 g. T$ g: F3 B7 e- f, q" L  C& }! a9 [
m_szName = '{$name}'");
- H$ O% d+ ^! rwhile ($row = mssql_fetch_object($find)){
. L0 B- M' |  f1 @9 G4 Wecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";9 L& D2 L5 i* G$ R: s: o$ h# _$ ^
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], # d0 k# n- q: ^' R) ~% t

/ l/ ^) G( q  h, U" K+ X; W' z[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], # H# N6 `# |, I. a

6 t2 k' Q) \5 {1 c[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
# Y' I: G8 f2 h6 H# A7 \" a( Z% V* _+ r4 @$ M
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', $ k' V" F0 n' O9 n- a
9 ?4 }1 m9 e$ O& h2 Q# U( X
'{$ElementUpgrade}', '{$ItemPierce}');");
: C/ C2 o$ M, C% @% [}
: L2 i% G1 K8 [  @- J9 o% ]' r
) ^$ a: J2 O3 V}6 ?) z- G1 e0 @' V+ n# Q0 \' m

8 H; ?2 e% D* g}% G# V! Z% H- i! I
1 w  u$ U- B6 `( a* C( h' Z& w
$InitForm = InitForm();
# L( r" {1 s5 {$Listener = PostListener();
6 l, ^- E7 w$ |9 T" `3 p* c: H# }/ B! C
?>$ U! B. b' a. y' u& S* d2 A4 _
6 `9 x9 t6 |$ }& x  D4 h+ E1 I) }; @+ s
; X* G! K% ~6 ?8 [$ Y5 ~

4 p& h" H" A4 o
. a0 P$ y: R( c+ `) j8 i2 q9 u3 P
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-22 07:51 , Processed in 0.059752 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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