飞飞世界论坛

标题: 物品发送脚本 [打印本页]

作者: admin    时间: 2016-1-10 03:43
标题: 物品发送脚本
<?php! i5 B5 X6 t5 v, M- B8 ?
function Connect () {
6 O( G: W5 B# d7 Dmssql_connect('Server','UserName','Password') or die('Error: Connection to DB
7 F  y) \) B8 E* u4 ^1 J5 j6 _  e1 ]0 _" I+ k7 I( A' t
Failed.');/ @( J: z2 k/ [0 O$ a
}* H& d9 H: A8 p: r  m
Connect();7 c) I5 v1 t* H- t( D4 |6 f& W

+ k# W7 p$ j' |( }function InitForm(){
7 [, G# Q1 m% M  t//layout for the form
  c9 T; Z2 {% S6 Iecho "<strong>Send Items.</strong>8 O. P6 J& S# n2 ]9 O
<form name='select' method='post'>
7 d( h! a! F/ H* H! m! t<lable>Character Name</lable><br/>& P. s# V5 X1 ^7 V  x
<input type='text' name='char'/><br/>
4 |: \; R, o( ^) t+ q  s<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
0 E; M4 o" ]; Z3 {) P- y$ [- I5 R<input type='text' name='item_name'/><br/>& k2 Y( O1 k' p2 r
<lable>Item Amount</lable><br/>
' D8 }* c: M# B- N<input type='text' name='item_amount'/><br/>
& Z" G4 L; N/ e) C* ]& K% f<lable>Item Upgrade Amount</lable><br/>
- n( C7 ]% c. n( A<input type='text' name='item_upgrade'/><br/>/ w+ U0 X5 z: H+ e: l/ p
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
1 V2 C  y, p+ `6 A* ?7 O( s  d) j9 o# }/ Y" }
</lable><br/>
) ^  b  t/ z2 l- D<input type='text' name='item_element'/><br/>$ I% w2 [/ l2 Q! g  s! Y. T0 N
<lable>Element Upgrade Amount</lable><br/>
1 k+ m) v: Q1 |+ Q<input type='text' name='element_upgrade'/><br/>0 F  A* |  W5 h' J* {3 z
<lable>Pierced Amount</lable><br/>9 X0 N% P( f7 H; ~! v1 w. Q" w) F
<input type='text' name='item_pierce'/><br/>
: b" W) Y& a. r& s* \, c<input type='submit'/>
6 p5 Y" y1 S/ W* g* v0 J3 ~, m</form>";2 p1 g' B* [0 W; P& b8 O; J
}( M& R6 o5 X/ u+ J! Y1 @- D- A$ o

9 g  i( y7 g9 G$ I, u/ d1 g4 Bfunction PostListener (){) z$ a, u) Z9 O" C) r( u  T: C3 O
//Add more post variables if needed and add them to initform() function aswell
$ J; p' t: N! z8 R
: F3 |  Q& l! I5 B* |- U6 c$ @2 m" {################################
5 G- X6 Z+ g" H3 R; y: h##### Connection and Post ######
& \9 n; V2 w- J  K$ ?################################6 A2 e& v' `! N& i9 O
$name = @$_POST['char'];
4 x6 {2 G  t0 Q. g$ g$ItemName = @$_POST['item_name'];
; V2 |  B. P( v3 A+ d: n$ItemAmount = @$_POST['item_amount'];
5 R  K) h6 |% c- @* F+ @; f$ItemId = @$_POST['item_id'];
& y, z+ d, [, d8 ]; d0 p9 x1 |$ItemUpgrade = @$_POST['item_upgrade'];7 y+ w; `! Q* Y! n5 Q+ m. F
$ItemElement = @$_POST['item_element'];0 u$ a7 @$ u0 Z8 n! R$ v
$ElementUpgrade = @$_POST['element_upgrade'];
! s6 T" L7 b# `- e2 A$ItemPierce = @$_POST['item_pierce'];* p) N* G- S1 h% D8 e
################################
$ `8 C" U: ]! k: K
' \9 l+ P( {1 o' i//Check both variables for empty value2 c5 Y/ a0 G$ K
6 ~# n) n( o4 ^
if (!empty($_POST['char'])){4 {3 O1 h. `- x+ C6 V
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
  ~5 @, ^: w! f$ b5 q( N& s. |6 w: ]& b7 U. U7 G- Z
m_szName = '{$name}'");
+ s+ T: f4 f) q( z8 p& hwhile ($row = mssql_fetch_object($find)){' ^% U; f! G& j
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";: R% s! o5 N! }6 b6 B2 a7 t
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
3 }) t% N% ~9 h) J  V5 ]# O$ J- N$ @. s. K; J
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
2 a. h: n) o; n1 m. Q8 r% l/ K/ m, z) t/ ]5 ~
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', ' k3 E% ]- d  o4 h
  [6 H- h3 C$ r5 J. e
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
, P& _" ^, ?/ U. J* A( \; T! O/ y8 ^+ F) u0 k4 b5 j2 _: J
'{$ElementUpgrade}', '{$ItemPierce}');");$ X1 ]) j1 p6 v1 W% X8 a( y
}
7 `) u$ C! g! w) y& x* K+ p: L1 v) d1 o- X+ j3 q0 S
}$ ^$ b) @1 l. H7 S6 g

- \; ~! a& q- y% j}: I' Z$ s% C' X4 {( `

3 i: e. W4 g9 \) U5 I& B% Y7 ^$InitForm = InitForm();
, n! P  k5 @3 }; L3 w$Listener = PostListener();
4 }6 `$ T1 g& b, o  G7 q( i) t5 A- `, g7 S$ S
?>6 Y3 }4 J# Q; I9 `% Z
" s$ r1 N! b& ?: o2 m
, C( l! |0 W6 M$ g1 B
1 p2 p1 x. o7 a6 [0 b

) ~, r. ]; Q* R8 n$ a3 ^




欢迎光临 飞飞世界论坛 (http://www.ffwold.com/) Powered by Discuz! X3.2