飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php! u* E$ T0 R# t% y9 B" L
function Connect () {, ]. O/ l8 a4 r; a
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB 4 r# D# [! W5 K# i8 o

; h) c9 d  G6 T3 f" M* k# u5 P* AFailed.');
. b6 w0 i4 X  A: N  v) N}/ ?0 O" Z2 t. i; E# M: [
Connect();3 k& p# u9 ^4 ^* {  S% U
- v* l5 o3 v3 C; F5 V' w" O- l  g
function InitForm(){
! B, V0 k6 ~( w" t4 d//layout for the form
; {- A6 {' `  p8 Mecho "<strong>Send Items.</strong>
1 ?; P- |, E" T$ H, P7 H3 b<form name='select' method='post'>6 G) s% S* u4 W) ]# X
<lable>Character Name</lable><br/>
' E: L2 W9 U/ H0 C! V<input type='text' name='char'/><br/>
* U- e7 m8 E7 R! ?* v) W1 o<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
4 |% x1 n) B3 K5 U3 Z<input type='text' name='item_name'/><br/>- b0 M  x8 m2 u" n' I0 j0 u
<lable>Item Amount</lable><br/>5 s! D" J0 l8 {1 @8 G" p% E
<input type='text' name='item_amount'/><br/>) f/ C4 S- P+ Q- N& {
<lable>Item Upgrade Amount</lable><br/>
, Z% d+ Y9 z: c<input type='text' name='item_upgrade'/><br/>
: d% u1 [5 w, }<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
9 R/ c6 H; R) k- Z% s: X4 n# F" [1 a/ j
</lable><br/>
" M) V$ C' h  Y+ k<input type='text' name='item_element'/><br/>
$ c( A7 K* g' E3 B<lable>Element Upgrade Amount</lable><br/>1 c5 b- W4 W" @9 M- S
<input type='text' name='element_upgrade'/><br/>, j$ s& P( ^3 h
<lable>Pierced Amount</lable><br/>
3 T' u6 l/ C( A" u* J! o<input type='text' name='item_pierce'/><br/>5 y  E, U2 M6 ?- k2 m
<input type='submit'/># r  X8 Y/ r: u/ z; [
</form>";
# v8 w4 ?4 g& k" b}
, S$ H2 @7 k# y) S! c  H% b$ B) n1 e" Z6 [; i
function PostListener (){
* x. K6 C: [! p6 T6 v+ {0 Z& I//Add more post variables if needed and add them to initform() function aswell$ z( T3 u+ Y/ L6 e

2 a- [) X( o5 D################################
% [# l4 q) g  O##### Connection and Post ######
, {( A& q1 e0 i; N9 u7 k################################
5 Y1 W  S) P& n$ l$name = @$_POST['char'];8 d8 e( N- T7 H% C1 F3 o
$ItemName = @$_POST['item_name'];
" m. t/ l. y) }( S3 i2 f' M7 c! p$ItemAmount = @$_POST['item_amount'];# J  E/ ~$ Y1 A
$ItemId = @$_POST['item_id'];  P0 u! H3 H8 q  x& m
$ItemUpgrade = @$_POST['item_upgrade'];0 f: |% c2 P1 |: S9 Y
$ItemElement = @$_POST['item_element'];
1 R$ J2 O: ~0 o& B$ElementUpgrade = @$_POST['element_upgrade'];
  m( u) Q3 q' s0 v) [$ItemPierce = @$_POST['item_pierce'];
! g: n7 k+ |1 Z/ N4 ~- \% |################################; P" ]" l6 M" `9 ~& S9 k

% S2 c* O, j+ C. Z9 s. ]4 Z  W//Check both variables for empty value% |6 z, {0 [. \

% C+ ^+ E& I8 \- m9 x* \$ I& a3 mif (!empty($_POST['char'])){' r0 H; Y- d/ f
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
2 v/ ~( k6 k  @3 r  Q' V( ?
8 ~, ]6 y, I5 k+ l- sm_szName = '{$name}'");9 h$ i- i( k- A" y+ ~, c. L; Y' `
while ($row = mssql_fetch_object($find)){
1 j; S+ W: {& V+ _3 B" ?; cecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
" n7 S2 Y  ~. l$ k- J! Z: _$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], ; m% ^9 i" s, o2 `6 P: E

& Y7 C% m7 ?4 N! H8 e[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], ) L; ^* D" p# F- t

' t: ~. g+ \0 R, ?# `( e[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 8 x7 v0 z4 e: C3 u6 b

& D7 u; J& X" b% Q! fN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', 5 Y8 r- [+ Y/ n% @" i

! ]. ^1 W* ^6 Y, ~5 U1 H& h'{$ElementUpgrade}', '{$ItemPierce}');");
7 b) E* U2 U0 r* Q4 |5 B. X1 m# D}
6 x  b. e9 i( m- Q7 s. X2 x# X& ~; I1 b7 s- d: [4 w
}3 }* P( B% z2 B, Q' w% J( X+ _$ X
+ f" J- |# G* v; g/ F( I: U; d
}
( d# p( f2 O4 Y4 D6 H* `0 e4 u, R) U% [' o# L! C' {
$InitForm = InitForm();3 c! Y7 L+ i1 w  \
$Listener = PostListener();
1 M+ b4 g" B0 @% H# _6 j& J6 }3 `0 w4 x( C% B; E
?>
7 r8 |) Y4 }+ a; b& p1 n& N6 a9 o* i# n
2 Z0 v. o  g( B& Z% d5 I' \

) Z; ^7 ]9 R( L$ N( q
8 g4 m! B  C3 i0 s+ @7 m
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-5 13:20 , Processed in 0.061341 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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