飞飞世界论坛

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

作者: admin    时间: 2016-1-10 03:43
标题: 物品发送脚本
<?php0 T) D/ Z5 @! \6 z! @7 ^
function Connect () {0 f' M& [9 ?6 ]9 n) T
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB $ r( V7 v' q$ X9 D6 s- _

4 q& X, `( x8 @) a+ e3 q: ]Failed.');
8 f* |6 C8 g. e" W}
# J9 E5 j% i; s5 m# B! m8 Q: ]) X) bConnect();
; {. \' ^# ~: n& X; u# F, s  M, l* L5 O1 p* H9 M; _( m
function InitForm(){# U0 b+ |2 s- m2 m
//layout for the form- f  B) Q: ~# |" X) r
echo "<strong>Send Items.</strong>
' J0 o2 I: z# Q0 R3 @; M<form name='select' method='post'>
+ l' `( O" v8 W2 T  a: W<lable>Character Name</lable><br/>, g* M' d! H& M! ~! P
<input type='text' name='char'/><br/>
( v0 ~3 \3 g% Q9 a1 k<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>+ x( Q# V6 o# x$ {5 Z7 u% }0 ?
<input type='text' name='item_name'/><br/>
$ `: ?" o. t" N<lable>Item Amount</lable><br/>7 R0 k$ s( w$ g
<input type='text' name='item_amount'/><br/>6 ?" b) n$ }+ y- d8 _+ T
<lable>Item Upgrade Amount</lable><br/>
- ]  U2 _3 {# S( f<input type='text' name='item_upgrade'/><br/>0 t* ~; G7 n% p! e  `3 `
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)+ S/ ]! z8 n* x4 i1 H$ B

% s  U. U. N  g% t. I( \. ^</lable><br/>
: K/ s6 x9 y" U' {# e<input type='text' name='item_element'/><br/>
3 l+ V/ G+ ~4 j. k2 g1 z<lable>Element Upgrade Amount</lable><br/>
  h) I# `' Y( Q2 G: J0 E" i) f<input type='text' name='element_upgrade'/><br/>
. G  |8 h: [6 D' Q<lable>Pierced Amount</lable><br/>
, r* L) [7 [5 b1 y2 r<input type='text' name='item_pierce'/><br/>
& @" z: D" a3 B' K6 M0 ^<input type='submit'/>
  s8 `* o, `. S# i</form>";2 H+ R" R' Q# k2 ^/ B$ b: K+ F
}
+ g; W) u# U2 ^
4 X6 Z# k( m2 _9 A+ d, P6 bfunction PostListener (){
$ b1 S, D9 h0 t3 U' u//Add more post variables if needed and add them to initform() function aswell- d/ \( f. s5 k1 {" }
3 c0 i9 _2 g( N; M
################################
1 U5 A4 L! B9 @& G##### Connection and Post ######
' i3 F/ g& R9 |################################; g; I; {. t( N! z) U* A
$name = @$_POST['char'];3 P# K/ g% I  B& w
$ItemName = @$_POST['item_name'];
' b  S, C; E/ U' \3 C, a$ItemAmount = @$_POST['item_amount'];
; U6 s! F6 H4 k3 {( a& l9 V2 b$ItemId = @$_POST['item_id'];7 _0 k5 S2 a# V9 d) p# A6 o2 p
$ItemUpgrade = @$_POST['item_upgrade'];/ p8 s' k5 E4 h. R
$ItemElement = @$_POST['item_element'];! O2 [5 p! M, u7 g, b8 Y. n$ ^
$ElementUpgrade = @$_POST['element_upgrade'];/ e' b3 n6 l/ H4 o! Z
$ItemPierce = @$_POST['item_pierce'];
8 n! I! k/ Y( [) Q9 u7 L/ ?1 Y. F################################
8 A5 j2 b9 j, R$ e/ l' D; H) u; R; r5 Z5 _( ?: v8 K
//Check both variables for empty value
  p$ o" u) v6 ?) h) G& `9 h0 a2 h. y4 m; J8 A
if (!empty($_POST['char'])){
" N& |/ W& @( r4 k9 x0 R$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
$ _/ ^" P- e4 m& y4 o
4 M0 Z+ K8 v* J/ I; Pm_szName = '{$name}'");3 o! N# D/ @! S2 m6 L2 A
while ($row = mssql_fetch_object($find)){4 ], q- `7 D2 s. ?0 K5 U- c
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
) b9 T% R# d: n3 D# b$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], . l) h. M: f% i  M. \$ I
  x3 I$ B5 q  I& L
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], + m) u& \" a* G& g
# C: @" C5 k1 {( J
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', , s" f' R, A, d- o) A6 h) B7 [

1 C( l6 s0 f* f( Z2 L0 L9 H: K% TN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', : r8 E$ [2 U5 B; s
# J6 `+ ?: i9 k, c  z% N% R$ m
'{$ElementUpgrade}', '{$ItemPierce}');");) o( v" |! l! u
}( c# P' N' d" h" x0 o

; a: ~- R" }* p. l}
' I  ^' m' }# g1 E& ]7 B
% t+ d  x( v( A6 h1 f. b( N. D}) a" W& V6 o: p* {& q
, m" Q$ s+ O- X2 a/ L
$InitForm = InitForm();4 s# I0 {1 y6 ]
$Listener = PostListener();- f5 M; ^; a: r; p3 ]8 I: W
0 F1 L, A8 ~2 b( _
?>+ @, h2 u  O& B1 v$ a& m
' s7 v4 a+ R; S+ T& ?9 l% H7 Q
, z5 w) p/ j4 U# j" s$ i

  X  u$ u* U6 n
# r& [$ ]  D6 b+ l" f




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