飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
, D: A& R$ I4 \/ b' sfunction Connect () {
, m: X$ U  d  O, Jmssql_connect('Server','UserName','Password') or die('Error: Connection to DB 8 W1 j4 \' y8 i+ W
8 Y4 e6 L' a0 U4 S
Failed.');8 V, i: \. P8 L
}% O9 A+ Y) n( f$ b5 c
Connect();
$ d' Z# L  g" i* j; t0 Q* ?( b+ ?/ M* E6 s7 E
function InitForm(){9 T5 b$ @& C7 e' P  \  e
//layout for the form- B& d! L' p; b* v3 f
echo "<strong>Send Items.</strong>
, O8 r  i* ]3 }$ T3 Z<form name='select' method='post'>7 f; G4 y5 y! k, N+ C6 `2 c
<lable>Character Name</lable><br/>
0 [! o  Y0 V, K7 h& u<input type='text' name='char'/><br/>" s; W( `/ r  m6 e! f  H0 D
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
5 A( w5 S& P- }5 u1 p# c$ M<input type='text' name='item_name'/><br/>
3 _3 U; S8 _9 {: {<lable>Item Amount</lable><br/>
' e8 j- e) d& b3 E4 y8 d<input type='text' name='item_amount'/><br/>7 G( S1 G$ b, O3 ]
<lable>Item Upgrade Amount</lable><br/>+ K0 H4 G0 r. E2 L0 @) M
<input type='text' name='item_upgrade'/><br/>
* I8 S! X  Q/ c: [' z( U1 K<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)) q4 P) q3 G6 c2 ?) ]3 D9 K

$ S+ x1 ~9 O4 {! e* [2 w</lable><br/>/ I6 f. F4 K1 y( \' R, e1 K7 i7 M
<input type='text' name='item_element'/><br/>0 O# R! z% v5 y: j+ g: ]" {: Q
<lable>Element Upgrade Amount</lable><br/># x& y# d1 l3 P. g! {: q
<input type='text' name='element_upgrade'/><br/>
' V' D- }2 s! u<lable>Pierced Amount</lable><br/>0 s: ~$ I( z' y2 b8 b: L
<input type='text' name='item_pierce'/><br/># y% s4 ~/ n8 [8 X7 q$ \
<input type='submit'/>5 m. C) f* d% a1 Y
</form>";8 u8 F/ y/ x; }) B% W1 Y+ Q
}
* d1 n7 N2 p& r' z% Q  c
* h7 Q. Y% d0 O! R# U$ p& Zfunction PostListener (){
  v, e# ]  P. k6 {3 C4 S' x//Add more post variables if needed and add them to initform() function aswell
* ]5 U, T  R9 G* l' t) S. I. e3 o, s. F% G5 W  Z) V# V
################################% N+ J3 a7 `9 D" R- l6 P8 z* s
##### Connection and Post ######
, X6 w' s$ q6 d6 k+ \4 K################################
' K; q- \& f7 r- n; X5 A5 X1 C5 [% J" b$name = @$_POST['char'];
% |5 [& _2 c) c7 O- A. N2 S$ItemName = @$_POST['item_name'];
6 |) c  D4 f2 i& [3 }" L$ItemAmount = @$_POST['item_amount'];/ }' K2 j8 {  ]; l8 G; s
$ItemId = @$_POST['item_id'];" P3 x2 P! Z' }3 o% J$ c* w
$ItemUpgrade = @$_POST['item_upgrade'];
; o5 r: q. W% f$ItemElement = @$_POST['item_element'];1 g1 g5 P" @: i
$ElementUpgrade = @$_POST['element_upgrade'];
2 m* X; _& Y+ l! f0 C$ItemPierce = @$_POST['item_pierce'];' d) K; J# \/ p0 d& H& N7 Z6 _
################################1 z9 i3 l+ X/ V: @  V: [$ k) h

/ r8 y5 i5 ]9 ^+ _1 O//Check both variables for empty value6 P) Q2 c+ W  J7 W- _3 _0 }
; I6 n: B& W/ q6 Q
if (!empty($_POST['char'])){# i) _5 U0 y$ d4 l& X0 M
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where + Z  U0 M& B3 E* C3 |2 q& ?

; B, j. D2 x) S- Z( ^7 bm_szName = '{$name}'");, f( H+ y8 b6 o+ c9 r6 f2 }2 r
while ($row = mssql_fetch_object($find)){' }$ V  }. X) Z2 c7 a' |
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";1 A9 O4 e1 j- Q9 \! I7 v
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 0 t* b5 ]- E) S' \  _6 a' \6 r' H/ q& c
- r# `( o! s- k5 \
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
( A2 t6 k6 `7 _
1 y& z; x4 \; f2 B[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', ( l3 A: J1 e/ z( r) I6 U
* D% v+ o" V. ^4 v! i
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
) W# `5 `. X% H8 U1 H: ^
) Z% M  @' ~0 I* c1 N: K/ `+ c'{$ElementUpgrade}', '{$ItemPierce}');");
" m3 M, h8 ]) `}
  X/ ^( E% C6 q% L1 H; ^/ t. F1 ^) _% Z( Q8 {6 d2 L
}0 Q  `& o$ M  q  m5 X
2 p% x, l! u, X' W' k; m
}
  p0 B, |1 j8 F; `& Q9 |3 n5 [: S
* W$ ]* s& N) b2 w$ F! t  K0 r$InitForm = InitForm();/ Y0 v6 P, `5 I1 c- f- M
$Listener = PostListener();7 @3 _4 ~$ U- Y, H* F% r  t( Z

& u* ~6 ?9 h3 q# z$ @$ B# r3 g?>
2 Z/ r: H" ^8 m1 @
; F- b1 i* M% H& U6 Z# E& m, k  r9 B4 ~. y5 [! Z

0 B9 i+ i  d- u0 B1 G: ?# q6 T& I1 \, T( u; j5 y( R4 y
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-25 04:09 , Processed in 0.062352 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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