飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
' ~7 Z! L, x+ |function Connect () {6 @9 x" y% I! F! r. g( s2 B
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB 4 N$ `# U: r# Z# k. \; i
! C0 d/ h) `2 H
Failed.');1 A* o& ^. L4 E! X8 n7 ?
}) O' B" w/ h3 x% k2 `3 }
Connect();7 A  T2 j2 t! F4 p5 p

1 Q& j! {4 r8 Sfunction InitForm(){# E4 m% ^$ b9 B
//layout for the form  v, M7 A0 T' d8 ?) ^
echo "<strong>Send Items.</strong>3 R  R* G' s& ^* U% `  _/ B3 B
<form name='select' method='post'>  y" L( H# ~4 p
<lable>Character Name</lable><br/>8 U. \9 m% t6 k% r' q
<input type='text' name='char'/><br/>
( k! W+ x' o4 x7 L6 z3 D  h<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
$ u; @+ v( l7 Q$ A9 Z<input type='text' name='item_name'/><br/>1 m1 r! B2 A4 \' D
<lable>Item Amount</lable><br/>
( R1 D- _% U7 i  {! U<input type='text' name='item_amount'/><br/>$ Q* |6 v8 D& v. \4 w
<lable>Item Upgrade Amount</lable><br/>
" D1 |0 \. {$ t0 a% }! [; o" F<input type='text' name='item_upgrade'/><br/>- v/ ~& l5 F3 g2 `4 z* I5 X
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)9 d2 i. M4 r& W4 Z1 D8 ]

, |3 y) |2 a5 l8 e# m0 H</lable><br/>
2 A4 o. x1 o/ t  a& g% F, p<input type='text' name='item_element'/><br/>7 f5 C2 I4 ~- M6 w
<lable>Element Upgrade Amount</lable><br/>
; b$ k) [, T' j3 e& s5 b9 u<input type='text' name='element_upgrade'/><br/># n, B8 r1 S* W8 x+ U1 u+ {4 E
<lable>Pierced Amount</lable><br/>
$ r  J2 B( \; f( s1 v- x# R9 X<input type='text' name='item_pierce'/><br/>2 Z3 h7 }! i! _# D* T: |
<input type='submit'/>& A% ]* e1 n2 f' r
</form>";: L" M7 U# _5 K+ P: ?3 k; Q
}
% X% o$ V) l1 a. Q4 W) A1 k: y; J: ?5 N/ y- o/ X) \6 |& C0 r: A
function PostListener (){
- O. D6 i- Y# }- i$ C//Add more post variables if needed and add them to initform() function aswell: ?1 N% n6 m: `8 X& I' X. ]5 B  g$ }& D

! T* c' o! }: b5 V8 {################################
7 v( D- o9 P# C: L5 j##### Connection and Post ######
1 k& \% v& r$ {. F################################0 ~! J' A# K/ V
$name = @$_POST['char'];/ i6 V4 P, h* t2 P0 I
$ItemName = @$_POST['item_name'];
( v; C+ y, L; w$ItemAmount = @$_POST['item_amount'];
5 s* r) u! E2 R" g: A. F$ItemId = @$_POST['item_id'];
; r) J) B, J, Y; A; X# T4 f0 v+ Z$ItemUpgrade = @$_POST['item_upgrade'];) h* Q$ i' k0 `% `8 c
$ItemElement = @$_POST['item_element'];* g' d6 _1 t% k6 c* n( G6 e& E
$ElementUpgrade = @$_POST['element_upgrade'];
, |. S+ V& d8 _3 z2 x# I$ItemPierce = @$_POST['item_pierce'];
  a6 V4 k$ y6 H; b; T: j################################
! }+ }; j' j6 q3 V' ]1 t( x  d- }9 `8 R4 m: k/ t, E
//Check both variables for empty value: H0 ^. ]& t& d0 p# W+ l

( }. k7 q0 ^! Wif (!empty($_POST['char'])){: W! H: M4 S, L4 _
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where 1 j4 H, u0 ~9 x5 C

0 W. Y* b3 W  ]0 |  |+ `# T3 F' f( wm_szName = '{$name}'");* @2 l6 a* J5 q/ T) q
while ($row = mssql_fetch_object($find)){& U% A$ t$ a6 I" c. X- x( D
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
, p- G6 g. `  R- G) ~% M$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
9 _2 Q6 D6 p$ Y% f2 ~; a1 @7 B5 G9 a3 \. y( ?2 s2 o
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
+ X+ o# S3 U% g7 u% q9 J  j9 [
' k1 _* p. d% `. g[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
' g: M9 [9 A$ I  G/ |; u4 P6 N) m8 H9 r% x, `# `$ z* F
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',   C5 l6 U# ^& S% _0 B
0 d( Y+ N1 R" B  Q4 K
'{$ElementUpgrade}', '{$ItemPierce}');");% \% U, ^! t; I( _- k7 O- M$ `4 Z3 [
}
3 Y( N( {! r+ Z% f- V
) |+ U, H0 _+ S$ c' t  \}
. @$ P' h6 p) c0 j9 C% `, r* s/ l  j$ y- \) \# v4 m
}
) T* [2 K. m' T5 ~7 q1 g1 c& Y
# B0 X' S% \, J# `$InitForm = InitForm();; s) H7 F( D3 T* h  T- ?2 O: c
$Listener = PostListener();
2 M! D6 O6 H6 r! _3 Y/ I3 Y6 A2 h5 i& S* @4 E
?>4 E$ V! P6 ^6 b2 i5 \* ^- W
1 r5 _1 A( H& }+ u
. |: h. h; p5 _( K/ i! }- u

0 X6 r/ e. S& A) M' e% @' }+ D
% R9 R8 j: u1 g
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-29 18:52 , Processed in 0.060160 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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