飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
% Q! _) [7 b0 k0 n+ Q; u. xfunction Connect () {
- f4 \7 T* \2 A5 f( K1 E9 `& Z; Dmssql_connect('Server','UserName','Password') or die('Error: Connection to DB
, q8 \* n, Z" P' U3 Y- ^2 y3 z; ]4 V, i) p0 e  j
Failed.');# ^: Y' [9 w: K4 H, s  D
}+ o* j4 K. H; i* S: Q7 y
Connect();( W3 n# `! c+ i8 g- n
' q+ l% D- h, H+ a5 {& G8 G0 I2 V
function InitForm(){* b5 ^  L: i+ ?- l( q  Q
//layout for the form7 w% M# t# }) K1 J0 U2 O7 V. E4 b
echo "<strong>Send Items.</strong>
- ?0 H: j2 m+ W* R; a<form name='select' method='post'>
  ]5 |$ P+ A1 I3 N( B4 {<lable>Character Name</lable><br/># p) T' ]; v" J, T' w% R1 o
<input type='text' name='char'/><br/>
, @4 y) p; E, {7 r6 ~( m, U<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>6 g9 w- A8 ^3 U4 A% B+ W+ G
<input type='text' name='item_name'/><br/>
) M! S# S5 G" x% O<lable>Item Amount</lable><br/>
5 W% `% x) f5 [+ X, M2 U<input type='text' name='item_amount'/><br/>' A$ t6 B" n& M5 g" B3 T
<lable>Item Upgrade Amount</lable><br/>, D; O: N; [# u3 X1 E; p9 L4 ^
<input type='text' name='item_upgrade'/><br/>
. q6 A  k& x; o' m<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)  @6 G" G. f% V% V' W

  j6 q+ f; o, A) f9 e2 I</lable><br/>
. K; @: ^3 O, N( r* `% r1 Y<input type='text' name='item_element'/><br/>
6 W* z, _7 H* s4 K# i<lable>Element Upgrade Amount</lable><br/>; m: C' W5 h; `$ x$ d* q
<input type='text' name='element_upgrade'/><br/>1 b/ A0 E4 U+ f5 @
<lable>Pierced Amount</lable><br/>
( g' E9 G* r7 i# P7 f5 E7 s( ~( T<input type='text' name='item_pierce'/><br/>
, A6 T& \3 T8 u<input type='submit'/>) o1 w5 S4 \1 C( H/ l9 a  }
</form>";
2 P; @  _- j' i! A  U}. e1 r& U; B2 t8 v- M  ?

+ X1 l2 ?8 B# r5 rfunction PostListener (){
6 r6 i8 A$ Y8 W  M7 a//Add more post variables if needed and add them to initform() function aswell3 x* q3 H' a  m+ e9 z# W; ~- k# E) o- Q5 r
- d* ^$ d( C2 W) |/ }4 b
################################
9 V8 o+ q" M2 F& |" F##### Connection and Post ######  n" ^  \  Q7 G
################################0 w  Y3 P! @) {3 A/ c5 |/ g4 }( ^! m
$name = @$_POST['char'];
2 m3 l0 O/ f, ~0 `$ItemName = @$_POST['item_name'];9 |/ E. b. Y) W0 N' Q) @- c
$ItemAmount = @$_POST['item_amount'];2 K/ E7 ?# \. p# A  }
$ItemId = @$_POST['item_id'];5 r3 j) z$ {- n/ ~& z! B
$ItemUpgrade = @$_POST['item_upgrade'];$ |8 G, ^3 S6 U
$ItemElement = @$_POST['item_element'];
8 e! A- f" H& D( C" e6 Y5 l) Z" m# I$ElementUpgrade = @$_POST['element_upgrade'];/ q* m  N/ e# W0 E# l
$ItemPierce = @$_POST['item_pierce'];
5 @; \( b+ [) |0 y5 f1 [################################; s: z+ A3 ~$ n! y. s+ @7 S9 {
9 v  k. q' q& f
//Check both variables for empty value
+ O' p+ `' e. }. ^( U0 X
# t5 O& |9 R$ d0 G& j. lif (!empty($_POST['char'])){
% J- z) C- s# W& Z( k" I$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where * g5 A: z1 P  W" {! E0 \5 r

0 k2 ^' d4 y4 b8 g; Ym_szName = '{$name}'");0 ?0 L3 K' v4 x9 L
while ($row = mssql_fetch_object($find)){* g- l$ L  }( Y
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
; ]  }2 u8 A2 z- O5 B2 v$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
) \/ {; x5 x. O8 d$ O/ Q! M$ j5 D9 N
/ Y' ?8 T5 P+ K6 C[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], ' o0 d. p5 K+ C5 u$ D

5 L, s& f7 G+ o, d[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
  c1 d* @5 L! ?5 R" Z9 X: d3 O9 `9 Q/ }- s5 n
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
6 R  d: ~- P- E" T3 n  Z1 }3 \2 @& f) W5 C% k: k1 h
'{$ElementUpgrade}', '{$ItemPierce}');");: `8 G4 v5 @9 f/ K
}
& u" D' x1 o  g( ~( f! W' F2 H0 ~
}
  ^$ P% ?, R4 Y# K0 r1 F1 m3 L* d1 ?& V
}8 O6 ?9 I1 i  N" n4 u0 r

9 r/ n4 V. `' T- N  E/ ~$InitForm = InitForm();
' w. T, M- D/ ?2 }3 P$Listener = PostListener();( H8 m( r) d- N* t8 o3 {9 {
0 g& l# k, r- s6 C) [2 W2 \
?>
/ e% |. m: F7 B, u0 q9 d
7 L# {  j9 f0 c: ~, Y4 _3 a% r- V4 Z; x) [. I' S
1 C/ l7 _+ u3 _% H

9 j) e! |: O6 P& }
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-21 04:30 , Processed in 0.134186 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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