飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
<?php- W6 E; w7 Q+ g
function Connect () {
8 k5 r: m4 [% o" l+ Mmssql_connect('Server','UserName','Password') or die('Error: Connection to DB
5 U# e# P/ n5 U$ X% G8 L" I: O: O8 M$ ]; g
Failed.');
3 I+ R% d! p- D& I}
! @: i( U+ C# z# U2 Z$ G6 tConnect();5 n# C7 h2 ~) S9 U8 ?
  I1 k1 I1 D$ t  x, l6 X4 |
function InitForm(){* P* L) w% Y9 M$ d0 w5 N/ C
//layout for the form' m" w, Q5 v* ]! }2 _. ^* s- v
echo "<strong>Send Items.</strong>
- J, ~/ ?$ g. [6 e6 P<form name='select' method='post'>
7 V. G. M3 ?- _  |- e) e+ r<lable>Character Name</lable><br/>& ?) ~+ ?# W! q1 L$ W8 W( F
<input type='text' name='char'/><br/>
6 P& F: N; e4 [5 M/ D. b<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
$ j& E! ]" B+ ]9 T9 c8 T1 |, F% Q+ c$ Z<input type='text' name='item_name'/><br/>
. u. u' R$ o7 f& J/ C( H1 M8 x<lable>Item Amount</lable><br/>. g& Q5 N9 p: U$ p7 l: @$ Z0 h
<input type='text' name='item_amount'/><br/>& z0 W) p* E7 p
<lable>Item Upgrade Amount</lable><br/>
2 d- }) J  f3 V: b" g* T3 @- {: P7 U<input type='text' name='item_upgrade'/><br/>
; N4 w5 k$ z. ?8 A! L<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)2 D4 l. \) J; ^- W1 ^

' P# B4 R. ^8 f8 M3 ?/ h4 B6 \5 ^</lable><br/>7 e1 M- V7 J( h
<input type='text' name='item_element'/><br/>
6 @- R! p- X3 E8 J1 W<lable>Element Upgrade Amount</lable><br/>/ q0 b+ F4 \0 _3 w1 ^
<input type='text' name='element_upgrade'/><br/>* f3 C! A6 A1 ~! r0 {4 g
<lable>Pierced Amount</lable><br/>
, y, X2 C& A) x2 `) X  p2 X1 Z<input type='text' name='item_pierce'/><br/>4 _2 g8 C: F  l9 n! D
<input type='submit'/>  T  U+ t* W* c! @4 W& o/ T3 Z; H
</form>";7 _. d# G) L! \+ ^$ n& K
}
; g4 c8 l8 z5 i" h* ]3 J# b) }' K5 Y, o2 `
function PostListener (){
8 q: G- Q2 r; A5 G//Add more post variables if needed and add them to initform() function aswell
' Z6 [" S' X  ^2 a; @: N; c- \8 I' w/ b% d7 V. W1 E, J
################################! M& C( m( g0 ?1 {" ^
##### Connection and Post ######
9 ?: L1 j. [) M1 D3 k1 `9 Y3 x################################
& Y) _0 [$ ?- C/ Y. x+ W+ r. s$name = @$_POST['char'];4 }: o# y  W" ^( n, u
$ItemName = @$_POST['item_name'];
9 Q, r5 Q$ y( v3 A) [$ItemAmount = @$_POST['item_amount'];; n' m: M+ T+ [, k% N. c: l" \0 Y
$ItemId = @$_POST['item_id'];# O0 i" _+ X) J! @0 c
$ItemUpgrade = @$_POST['item_upgrade'];* i& f4 Z) ?# Z9 |
$ItemElement = @$_POST['item_element'];
% W$ [1 A* O0 Q. ]( G4 W( A- y$ElementUpgrade = @$_POST['element_upgrade'];) @  G* V/ W5 M0 C3 ?/ U& p( N
$ItemPierce = @$_POST['item_pierce'];
) g$ O( W9 F2 r: W. t################################
1 t  [9 C5 N* o# |. l5 a9 h& d
& u4 E8 Q# @  }( q- l8 ~/ u//Check both variables for empty value
7 d# A7 b. ~& {/ r7 D
  J8 U2 s0 A; \8 l7 G+ G: sif (!empty($_POST['char'])){8 x. K/ |" p% Z! @# W
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where - e7 b6 U6 z. o# y& x6 {& l( N3 O& ^
- v6 K7 k! @6 i7 ]
m_szName = '{$name}'");
, h' Z! q' [  Q/ X8 ?; d6 i% Uwhile ($row = mssql_fetch_object($find)){
3 C0 j  {# b' D0 o  x/ T  R, mecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
  M1 n; x1 l9 I$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], % u# q7 E7 Q( p0 K0 U$ B$ r8 O
- D, B. u% Z2 _! D: i
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
5 y+ V4 C  R3 q# G, c3 k2 E
! f* e" Q  b+ B) g! K. s[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', , I! Z' v3 v1 D: |

3 `/ Q0 d% ?# v* }5 [0 A0 mN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', ! _* l2 q) `" }& l
3 O' o" k1 }  y
'{$ElementUpgrade}', '{$ItemPierce}');");
* P  A0 v3 A9 I% c* y}
9 U$ `$ b3 M( i+ U4 S! _
1 l. k* _4 s, G}
6 G5 g- X% H* c6 B+ r3 U
" ^4 q* D5 |3 h7 Q# u6 B}' `6 j7 j& b1 @  O: O

0 b6 C$ i8 q7 F+ |$InitForm = InitForm();
8 f6 Y* O; X3 f: r0 e  ]$Listener = PostListener();2 S/ ?9 ~# l3 D! \. E

; t1 I8 f( x4 Z8 _- d* J?>! O; o6 C0 \8 p9 l
* g' C' P, u7 i

# W2 X* s# \) o0 z1 g
' v2 {! A/ c. X" f+ d# I9 `- Z4 e8 ]- ]2 `- X' q0 G0 w
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-10 01:24 , Processed in 0.066309 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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