飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1070

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1070
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
+ {/ M$ }# u' k: ^8 S0 ufunction Connect () {9 W2 ]0 ?2 h/ d& Z! z7 N; V
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
9 q6 D* o  G! o! {
# `4 Y5 Y' r4 m2 oFailed.');
7 A7 h7 a* y) @8 C, V7 h7 b* G}4 ^: F" ~' i( b7 T& k1 y
Connect();
2 ^/ w, F. T* ]2 r
, C  U! h5 O) t* x! [: Jfunction InitForm(){+ S; Q  ]6 l( m. U
//layout for the form
1 D, F5 U0 e- S: ?echo "<strong>Send Items.</strong>
  Y- Z- V: R& t. D% W3 [0 C$ M<form name='select' method='post'>
# w9 i- l$ D- n3 N' X<lable>Character Name</lable><br/>
& E/ B8 ?- e) u<input type='text' name='char'/><br/>  d4 P# a& z8 h; q! O
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
8 w+ q1 q7 [$ {/ K<input type='text' name='item_name'/><br/>
( L+ Z$ f6 M8 j7 W<lable>Item Amount</lable><br/>& ?* H5 A% D  A) Q/ }' j: G, H4 t
<input type='text' name='item_amount'/><br/>
; k3 E% M0 ?$ D2 \. v0 c1 S<lable>Item Upgrade Amount</lable><br/>4 r9 p/ A: W' P% x* Q* e" `8 P
<input type='text' name='item_upgrade'/><br/>4 F) i- g$ l  Z$ G- p
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
; ~8 m& H5 }2 F, u) c  d( U2 h
* Y' k' ]7 y! y8 Q. N) _, m1 F</lable><br/>
7 J: Y0 ~+ J6 F: z<input type='text' name='item_element'/><br/>
, d  [- {! G7 s5 ~, H$ p<lable>Element Upgrade Amount</lable><br/>
2 Z( V4 q9 t: Z6 g<input type='text' name='element_upgrade'/><br/>
1 M" l( s2 k" [- q<lable>Pierced Amount</lable><br/>" I+ T# T- J8 s9 S( A" Y
<input type='text' name='item_pierce'/><br/>. T* d7 O- y9 Z; E
<input type='submit'/>
! h5 d7 [8 U+ D1 N( ?% ]% i  h% y</form>";) j; E% X0 N; Z; U4 N
}* I; p, j2 k6 N! v1 ?, L

( |: t- P5 P5 V" K9 v' N7 ?function PostListener (){
" J- I$ Z4 D0 {  h//Add more post variables if needed and add them to initform() function aswell
4 E) F7 h7 y# j$ ^/ f% l: e% s% t  E0 C; V/ E8 q: d+ L. z
################################
, I* _# O" Y7 g7 A- T##### Connection and Post ######
* _# n, V2 t- {6 _################################( w; L. \4 u2 v9 _
$name = @$_POST['char'];' O+ B1 J; \; M$ R
$ItemName = @$_POST['item_name'];
( Z0 T5 B3 D) o0 G! m! `& E# S$ItemAmount = @$_POST['item_amount'];
. u5 ~' p/ R4 \) J2 F$ItemId = @$_POST['item_id'];
, j5 a( F. g3 ?0 z, J" n  {! E" {6 @$ItemUpgrade = @$_POST['item_upgrade'];
+ M% ~  w( d. m9 [$ItemElement = @$_POST['item_element'];% c3 G7 {; N; u0 f8 `4 u! r3 r
$ElementUpgrade = @$_POST['element_upgrade'];8 Q9 A( {  a1 W% z/ r) D
$ItemPierce = @$_POST['item_pierce'];2 P% A6 w! }- g! S" @2 ]+ J2 o( S
################################+ ?4 y# [6 s( S5 h4 F) k

7 w  t6 q0 f8 l+ ]" ~/ k//Check both variables for empty value  X7 r$ u% l, f7 z) T

# Q: E3 m2 D! F* dif (!empty($_POST['char'])){/ `5 p$ Z- M; M6 W7 ~7 B
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where % p8 ?: i' ]; V& ]  d' i9 ?* f% G

( G& g* W8 c( a' j' d7 F. zm_szName = '{$name}'");
# A, Z$ ^/ C8 z" l8 |& p* @while ($row = mssql_fetch_object($find)){
4 {+ G( k) K- f+ E7 ]0 t+ ]* Secho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
2 c' q+ U6 L, _& y+ d6 U$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
9 ?4 v! \- f% W+ K% x' r' X
$ e" M' d' }: n* W. n$ X[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
/ D5 F" z( I9 O  t5 |
# P! L) B6 F- C& D[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
1 _) r$ i! Z: B: B# x
% L+ u1 [/ J9 \N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
; ?: L4 O6 s7 ^3 E" Q/ |& u, Q5 G
'{$ElementUpgrade}', '{$ItemPierce}');");
; O1 ]6 l% q; g5 B; L0 E% h}# u) y$ l" g  }  t3 ]4 P

# C$ j9 t2 {1 o) K" ^}
% G0 n6 X4 j+ b7 q3 s& R- `! }! F- r  e) V. Y
}+ Q" k' ^* M, E) Z+ h2 J8 x
3 t; ~- j. Z4 A% C7 R/ u  W! x
$InitForm = InitForm();
& E" h: n3 v! a; C: y3 K$Listener = PostListener();# q0 _$ X! Y7 C0 g0 W% q

1 W/ ?6 z& }/ _% s) l0 h+ f?>- b! \, Q8 g2 [3 {8 V2 k) {1 `

" _7 _+ z5 i0 n- T" }
' t: l; k( Z5 o% I6 \9 j; x+ m7 F* f6 V$ ?/ ?

" F2 o4 X( u+ r; t7 ^+ J
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-9-5 03:48 , Processed in 0.078211 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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