飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php& E. b" @4 l+ @. c
function Connect () {, O, m1 D( S# x
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
8 c; Z8 L/ |, K) Q: u1 K* c* y! @
: N) d% B( E* f$ Q! J9 f$ R* E( W# W9 dFailed.');
* k' c3 H( {3 Y* @* W}
4 l% E  p7 }8 k! a( e4 H% R! _Connect();% I9 Z" n" m" ^5 s4 Z
  P6 L4 H- r+ w9 H
function InitForm(){: o. B4 M# A+ F# I5 J
//layout for the form
; b, ]/ }7 s7 i2 q+ w  {echo "<strong>Send Items.</strong>9 X5 q) k  w1 L+ w/ j. y/ b
<form name='select' method='post'>8 Y# E2 _8 [" H3 Q! H
<lable>Character Name</lable><br/>
9 q9 d: @! D. j- u<input type='text' name='char'/><br/>
4 h5 z3 H! _/ I. i5 F0 o4 X<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
4 K  k# l# o" w% R3 K$ I<input type='text' name='item_name'/><br/>
9 ^' l1 D( y! a<lable>Item Amount</lable><br/>
+ [- E: f4 D. e3 z<input type='text' name='item_amount'/><br/>
% U  y$ T, ^4 ~9 o0 ~" s- f0 `9 N<lable>Item Upgrade Amount</lable><br/>; w# u7 u" H  J$ a  m+ j% m
<input type='text' name='item_upgrade'/><br/>
2 x/ b5 U! i: \<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
* S7 m* \$ G# K- G1 [/ Z2 j( L2 D! t1 u) h# D3 p& l2 x
</lable><br/>
/ a- M  h" z' A2 L. i! t; p: O  y& Z<input type='text' name='item_element'/><br/>
: E/ ?9 D& r- a% k. H<lable>Element Upgrade Amount</lable><br/>
5 z$ R5 a% Y+ _" j' p1 H& Q<input type='text' name='element_upgrade'/><br/>$ a) E% Q' N1 O2 I
<lable>Pierced Amount</lable><br/>- B8 H6 U1 O& l, V; ^$ [
<input type='text' name='item_pierce'/><br/>0 p* Y$ V. g3 Z+ p4 S
<input type='submit'/>& c0 @; v6 _8 V2 I  r* k
</form>";; x' H4 [1 M/ j* x
}
( r+ `0 y- e  z, e: l0 A: U* x4 d$ F0 l( I. w
function PostListener (){1 `& p, |+ d" A: J1 k3 U+ ~$ `
//Add more post variables if needed and add them to initform() function aswell
6 Q$ J% H- r5 T+ V# n* A
# w2 K7 u- a' c! [################################
, Y" r( b% Z  e" `5 r; l( [##### Connection and Post ######7 w( B0 ~: z* ~& C* R
################################
$ n) t' T2 T' m  Q. \4 A$name = @$_POST['char'];& B& C" E' X, _9 `7 v4 A
$ItemName = @$_POST['item_name'];) E' B+ S; L( Q. B+ _/ L
$ItemAmount = @$_POST['item_amount'];$ X% Q" |) A% ~, C6 L
$ItemId = @$_POST['item_id'];: L( ?3 `& W# {. P& Y2 B/ y+ Q0 D
$ItemUpgrade = @$_POST['item_upgrade'];9 G6 K# ^8 l! \: O
$ItemElement = @$_POST['item_element'];) f- X* N( ^- |! u" ^
$ElementUpgrade = @$_POST['element_upgrade'];
0 K. Z7 D5 d9 G" S8 Z$ItemPierce = @$_POST['item_pierce'];
& j4 f( h/ X6 Q. m################################
& f- h0 u; D8 s/ v1 v4 k; u; m
% N% ^6 Y; t3 j; B4 l: E//Check both variables for empty value0 u' i3 ^1 R( E2 d+ @+ G

) z# K0 b4 G  Cif (!empty($_POST['char'])){
& L" U7 R8 F/ p* S( O& `' a$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where   I" z( B; }( e4 N
& J3 r+ ]  f. ^$ |
m_szName = '{$name}'");
- ?( G, A- M0 [7 O8 Ywhile ($row = mssql_fetch_object($find)){, a( T# V2 J2 s7 N% |0 j
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";& D* U  u) k8 A. i8 H
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], % _# f+ C. B3 }+ y: \1 `
( Q" Z1 e+ S1 o
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
* L8 D5 |9 D! L- r
: \+ s! b8 p, }# w) V0 W[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 4 k5 G, Q6 C% q1 z

5 W( }: l1 }, O' x6 bN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
! b6 I8 f' f; K# |3 ~/ u; N' }7 q* V+ V- S5 T# J
'{$ElementUpgrade}', '{$ItemPierce}');");
3 |7 T( @) K1 Y  }. @}
! g$ y6 `- E5 z& ?0 f
: d( Y% N. B3 L! u/ q& G}
+ e/ d8 B# j% a- P6 @, s( u2 Z) P
$ ]+ C1 |5 ?1 W}: y+ d4 a4 b. z

  ]0 \0 v/ X1 U# G' |; b! I$InitForm = InitForm();9 I( ^$ F! D0 s. e4 c" X4 `( Q8 |$ g
$Listener = PostListener();
! @/ v+ g" E( {# H/ Z: a' J; I: i- s
?>  |5 |& A# x$ o; n+ e+ H5 ?" A0 d

) C! l* ]+ n/ ~  A7 M5 X" i6 W8 v
3 y9 V) S+ v& \3 p. c% u* h3 D' f: a$ }/ Q7 Q7 r! M  ?
3 [# a/ o( L) F
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-3 14:59 , Processed in 0.060948 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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