飞飞世界论坛

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

作者: admin    时间: 2016-1-10 03:43
标题: 物品发送脚本
<?php
, R  W! i3 _3 Q  ?) Wfunction Connect () {
( K9 W+ T9 b6 omssql_connect('Server','UserName','Password') or die('Error: Connection to DB & W4 Q$ h, {! o: w0 |* m. y
+ P; }5 u5 H: v) l
Failed.');! l; O. W4 @: o- @8 {
}' \- O& n7 ^, s
Connect();# S5 Q. B0 I$ ^  |( m( t( ?
* h6 U2 O; w2 y
function InitForm(){  {( r& h% V$ [& O8 E
//layout for the form7 e6 `) @# ^' [' M8 G; v! I8 v# |
echo "<strong>Send Items.</strong>
0 W4 |9 Z4 l$ [1 f( [( e0 H<form name='select' method='post'>
. E4 g. ^5 u" G/ ^% k/ D6 u<lable>Character Name</lable><br/>7 R! r! J# J  |2 V0 {' u8 A$ B
<input type='text' name='char'/><br/>
- S: M2 E( R/ ~9 i$ ^<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
0 D, s6 ]0 c% Z$ s, d<input type='text' name='item_name'/><br/>
* @  W& [9 A5 G<lable>Item Amount</lable><br/>) r* y/ S" U% B/ n
<input type='text' name='item_amount'/><br/>! l+ y* L5 U2 P! n# Y
<lable>Item Upgrade Amount</lable><br/>: M* G2 S$ [* u0 p; g, \
<input type='text' name='item_upgrade'/><br/>
* B/ Q9 f& \4 B5 ?3 Q<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)2 g. v" |, E0 h' z& C$ N+ w1 Y
  [% \- R+ n/ T% n% ~
</lable><br/>; H$ k6 Y2 A' K
<input type='text' name='item_element'/><br/>
0 V$ n) ]" s  U<lable>Element Upgrade Amount</lable><br/>
( v. g$ k; p( s, Q$ d+ M$ a1 Y: ]. f$ n<input type='text' name='element_upgrade'/><br/>; q2 B6 k9 L8 t7 u: ?8 n/ c, i
<lable>Pierced Amount</lable><br/>, X$ S5 p. R5 M# K% `; T2 }) r
<input type='text' name='item_pierce'/><br/>6 B8 m: ~! M3 e* x& ]$ S
<input type='submit'/>5 [  ]; g0 S0 f* b( T' k) p- R$ G# t2 t
</form>";
" u9 ?) D% i& m. J! H4 q) J}. h1 }5 z2 R0 c1 q2 P; f1 A+ H0 h

. C0 f8 U# o9 Dfunction PostListener (){
6 q2 V, `( y! |( v3 }//Add more post variables if needed and add them to initform() function aswell
5 _! B0 x1 Q6 }4 s/ K+ d  ~2 Q/ b* U7 J8 o
################################& r! N% n1 ~5 v) A* A
##### Connection and Post ######/ H7 x& b! |& O7 }4 x/ U! A4 R
################################
- w# K2 ~6 l+ K4 M1 P$name = @$_POST['char'];
" o3 _! _8 w6 Q, V' R3 V5 u$ItemName = @$_POST['item_name'];1 v+ F& f: z7 Z4 O  J" k
$ItemAmount = @$_POST['item_amount'];! A  ?1 I3 |0 v4 _! [) i$ x1 l
$ItemId = @$_POST['item_id'];
% z4 S( O/ m. d; h* P) G$ItemUpgrade = @$_POST['item_upgrade'];
/ I; @, c- V4 D' a9 T7 k( v: k$ItemElement = @$_POST['item_element'];8 L/ U/ P& }5 x( ]: U6 ]
$ElementUpgrade = @$_POST['element_upgrade'];
$ ?, s2 x/ Y" ~$ItemPierce = @$_POST['item_pierce'];4 Z/ f( c; L4 V" @  a' y8 C5 B% \
################################' f" t5 `2 M# V+ I: A8 {- J
0 a0 n: ?* d7 q% Z6 x
//Check both variables for empty value& [) o1 I5 t5 [/ R4 I. w. v8 |

- o7 v; s: q2 }) H  P$ |if (!empty($_POST['char'])){1 f- b( u3 G8 {
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where # T. a5 k! A$ m1 z. J$ U2 L$ L
% f7 R6 ^, U' S/ ~3 Y' P
m_szName = '{$name}'");
: ]8 ~1 ^3 O2 Zwhile ($row = mssql_fetch_object($find)){# b" S) r" _) h5 g. g
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";' Z$ D* g9 J" E9 L
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
- Y! `* O; G) @$ @! j6 _7 z. [$ Y
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], ( g# X/ V- D1 F5 C$ K/ J

! q- T6 s6 s6 e$ Y[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', . x6 L( Z  y9 C7 x* v$ y; t

' U# c' V' S0 |" o/ X8 ?! _& v$ pN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
! ]( p/ ^3 ]8 Y" \
( D6 b! K: h) x+ i'{$ElementUpgrade}', '{$ItemPierce}');");% T5 u, D& ^! E- G
}. O" p3 X& W: e
- ^, A: n4 r3 C4 {
}6 D% O, u( [, b% J/ |
/ w, H4 d; A" ?4 ^. f% w
}
% H; C" `2 i& d3 {
( H) n( Q4 M( @/ M6 W$InitForm = InitForm();6 H7 G1 ~! m3 y) k: g! }0 [4 h
$Listener = PostListener();: d/ t+ v' @! n/ b% x+ }* W% S2 A
" m* Y5 t% H5 t
?>
$ K; a' U8 X* S
  q/ H  @  ~; v/ z8 S: ~
) B+ y" d) X( H& z3 c( t! Y0 Y8 W9 y3 b1 R, p

1 w4 q1 F* B& [! {/ |, }7 @




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