飞飞世界论坛

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

作者: admin    时间: 2016-1-10 03:43
标题: 物品发送脚本
<?php# j$ p/ d7 R! T; q; {2 N. D# C1 N
function Connect () {
4 V; R% x9 \: j  i+ T9 S  s8 `mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
% s  f6 F0 H$ I& x: }  d! X! f2 u! c9 T3 f5 V! h" ]  E% K) e' h
Failed.');
' l' x2 x  B6 ^1 A/ |! q}
7 g5 {0 w: ^7 d- `Connect();
  }1 y8 j5 o1 p1 @# K  L6 h  X
! c5 n0 m% h  W8 W( i6 X! ^function InitForm(){
, g/ Q: h( L$ p0 z//layout for the form( `1 |# b/ _. Y) d
echo "<strong>Send Items.</strong>
8 k9 o: [$ L& i' p<form name='select' method='post'>3 ^5 O5 l, P* ?( @3 W
<lable>Character Name</lable><br/>  }9 Q8 ]" f% y8 c& V% `, G
<input type='text' name='char'/><br/>, h3 `$ B3 n, E: @1 P+ s) ^
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>. K9 o. ^% @" n7 l8 A
<input type='text' name='item_name'/><br/>
: h& B9 n1 X; K<lable>Item Amount</lable><br/>  o& p! A( _$ T+ I1 P/ V
<input type='text' name='item_amount'/><br/>. e5 v% w* e1 X; Q% g, ]* m7 z
<lable>Item Upgrade Amount</lable><br/>: Y, \' W+ p  b6 @9 p
<input type='text' name='item_upgrade'/><br/># E6 {  S. ]# v$ g! c
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
; \2 q3 `: M- p: u7 i0 o6 D* D8 `/ d. C: n$ }
</lable><br/>0 X8 V/ G6 I* s9 q  H
<input type='text' name='item_element'/><br/>5 W: i7 z& g5 \- V
<lable>Element Upgrade Amount</lable><br/>/ X) e/ F: D3 L5 O) [* O6 T
<input type='text' name='element_upgrade'/><br/>
2 u( F% Q2 M* k( i. \<lable>Pierced Amount</lable><br/>, \$ U2 i5 y% f  J; t9 g2 [+ n$ D
<input type='text' name='item_pierce'/><br/>
* z; ^& [  I8 [<input type='submit'/>
% }# h. C' X+ j, B</form>";& ?. _5 N1 c9 M9 V8 H. _6 U
}
7 c- I/ [0 ]( T& a/ y% Q
% e% [5 e/ }# p- Dfunction PostListener (){
' B: [. `9 a6 o//Add more post variables if needed and add them to initform() function aswell7 o4 B2 }6 r/ X+ X: N: K

% B( D+ O: L* f4 W+ C) C################################7 `% e  r( m+ }3 y* a1 ]. H
##### Connection and Post ######
; H/ C- m* D" p' u# k################################/ X, a3 [& e6 @! K, w
$name = @$_POST['char'];* w2 J1 L0 M7 C; ?. F
$ItemName = @$_POST['item_name'];
7 U) D6 v# |& a% _+ ~2 N$ItemAmount = @$_POST['item_amount'];7 }& q0 Y. n2 N
$ItemId = @$_POST['item_id'];
% f- f: ^2 P, M; h7 g$ItemUpgrade = @$_POST['item_upgrade'];
" w- x; o0 `5 Q1 ?2 \! P* J$ItemElement = @$_POST['item_element'];2 n5 H) ^5 a; \' N, [
$ElementUpgrade = @$_POST['element_upgrade'];
6 U  v' S) [% G2 d$ Q2 s( U" f$ItemPierce = @$_POST['item_pierce'];4 i% x5 T, i, S+ m% d  W
################################
- b4 i9 x) X" h5 `
8 Q- I/ u2 ?6 n3 I7 [* o//Check both variables for empty value( V" X7 T0 ], J3 N0 [* z4 X

. h# ]# n+ [/ R$ n) Zif (!empty($_POST['char'])){0 ~6 X* i( [8 F- d7 n6 c  ^7 q) P
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
+ S* @) Q5 D6 n% x: M
7 [) N) {7 Q- G7 `1 L5 sm_szName = '{$name}'");
9 }% }- [1 |, v: D* Mwhile ($row = mssql_fetch_object($find)){# D# y4 V+ t2 I. `* }: a. H
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
( [1 j  f; C" ], H& X$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 7 ?7 E: L8 z$ H5 Y4 t4 R

0 V$ I& j5 S0 p" I[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], : x# a3 |8 g4 L8 Q
- p1 |7 i% Z; k
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', + c* n- ]: E# A% T
7 n$ k, W/ ?. e2 D) b
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', " x$ p' r: x- G6 o0 b5 ^  R" Y" s
2 g2 A8 z* d3 U) m
'{$ElementUpgrade}', '{$ItemPierce}');");
: |8 \4 ^9 r; o, ~9 \' d}
; C$ N; b1 K$ ^" A6 c7 [
0 L- N: D, D: H}
: ]1 Q- Y( }7 ]" Q$ q' ^1 _) Q  A6 a$ F1 p, W+ q, Q
}* e# W% a# c: w( P
. i9 I* [4 F! c5 ?5 P9 c6 v
$InitForm = InitForm();+ ^+ V# W* G; `. V4 g! m$ d9 ]
$Listener = PostListener();
8 ?  B4 ~8 w; @+ `6 `  @2 a! Q8 U
?>
/ Z4 v* m: e3 z5 c+ D% d8 D. j  N: P0 v  K5 D& j. ~# Q4 T8 n4 k$ ]

* [4 ^! I. B6 a: e6 J8 [, X% @: r, g+ _' G7 D
0 z0 R9 w! y7 q





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