飞飞世界论坛

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

作者: admin    时间: 2016-1-10 03:43
标题: 物品发送脚本
<?php
, G2 M% w3 t8 i) zfunction Connect () {; Z& a7 ]. \  R* x! E" L0 C8 Q
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
, z  j3 l- W( C8 s+ Y: P
: V, [; |$ S  g+ O9 {Failed.');2 [, n3 E' v; U- p
}- F3 ^- K5 x5 W9 U1 v7 _5 @' i6 L( U
Connect();" F" E0 H& a# t5 Y& Z
9 f2 Q' E4 v$ Y
function InitForm(){* T2 U% A- ^, v! @, N9 L1 k7 ~$ Y
//layout for the form
* d- d! M  z  ~echo "<strong>Send Items.</strong>
' I* g# R6 l4 A* v& s6 q9 m<form name='select' method='post'>
/ l1 U9 t2 V! f' e: c5 a<lable>Character Name</lable><br/>: R" W: @7 _% k! R$ z( k! ]2 R8 N
<input type='text' name='char'/><br/>
" T/ R. R) Q- e: Y9 D+ S) N$ e& k<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>' L. N3 [& n% {* V
<input type='text' name='item_name'/><br/>+ F; x' @% P% h! i- T$ T
<lable>Item Amount</lable><br/>
0 d( l. k1 W6 ]: {<input type='text' name='item_amount'/><br/>
2 |/ T& P: L3 `9 S<lable>Item Upgrade Amount</lable><br/>( I) d% Z8 L6 q* b" S
<input type='text' name='item_upgrade'/><br/>
7 \5 I9 F/ d! Q0 [) Q: k<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)- m; k2 C3 h+ V

5 n  K7 K: L6 W/ v7 t</lable><br/>9 S7 e) B3 {3 g
<input type='text' name='item_element'/><br/>
: i2 H7 l  |; C  J7 J<lable>Element Upgrade Amount</lable><br/>
* L9 c. T8 n0 O7 }# G- v<input type='text' name='element_upgrade'/><br/>3 D" W& w/ ]# r1 i4 p
<lable>Pierced Amount</lable><br/>
3 n0 O, ]( F% _+ D% W$ ]; _<input type='text' name='item_pierce'/><br/>. O, r( @4 g7 ~, Z/ ^4 b% k
<input type='submit'/>
, [2 [/ X7 M3 |8 w' D: c! \</form>";
4 W. v% \0 q- C& _/ z6 l  Z& h}' v. K1 F6 ^4 m9 _8 `
5 S0 D7 x; P+ z$ T# a: V! l
function PostListener (){: `+ j+ W5 c% `6 _. X; `8 v2 e& ?
//Add more post variables if needed and add them to initform() function aswell
% Q  T! @7 D( L3 ?2 f6 ]: t; T
- V" u. ]# _1 P& o: u0 L/ I. [4 b! i################################" O" g! p7 W2 x' Z2 F5 |( B2 Z
##### Connection and Post ######" R' t9 d; k( a; t+ x
################################
6 Y- A0 @/ s; w$ S1 L$name = @$_POST['char'];
! E- f- k5 k* {. Y& @& r; v% R) @$ItemName = @$_POST['item_name'];
; I& ]( U9 L2 @3 a2 J; ^* O$ItemAmount = @$_POST['item_amount'];$ n! l4 w# a9 Q% \& b5 T
$ItemId = @$_POST['item_id'];
+ U4 _; Y) l( T$ItemUpgrade = @$_POST['item_upgrade'];  m% \6 S2 H* K: ]. B
$ItemElement = @$_POST['item_element'];
/ Y4 t5 e! }- U9 ?6 R: ~$ElementUpgrade = @$_POST['element_upgrade'];- ^* q( V" ]! B# w" u
$ItemPierce = @$_POST['item_pierce'];
2 @9 R+ f6 p5 d  f8 W" D% A( t; G################################  V- W! Q2 t4 r1 Q" @) T" l1 N  m

1 c7 [1 z/ N; ?//Check both variables for empty value, ]- b+ x8 v9 x  m
7 ^+ Z3 O2 J* d& J) r& j/ t' Y- a
if (!empty($_POST['char'])){
" l$ X$ d' G# Q+ G$ X; ]- I8 T* V! q* U$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
8 z' ]8 z, y, q) K8 D* `9 n$ J( s# I$ e  Q
m_szName = '{$name}'");! K9 C! J$ C& P" g
while ($row = mssql_fetch_object($find)){0 o7 s3 w; i! y# F& d/ H
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";2 n+ d" E  v# C/ @9 B5 ]1 X9 m
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], + Z$ ^# \6 i# `, \2 ]  X0 e

0 Y4 L# n0 J5 @# R$ g0 G[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
/ V( _& U* S& r- @8 Z+ X  L. v- J2 c7 l0 u
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', * O/ h2 Y, X( r( R2 |
! o0 `% m4 j3 c4 Y
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', - V9 m; ?9 X8 y3 N# |
4 @8 u7 v* n& F3 ^% r/ x
'{$ElementUpgrade}', '{$ItemPierce}');");5 d2 D% f. ~% ~" q+ o6 o
}0 u* |. b- D& v$ s" a. D

2 I! S  E2 j' |3 S( R* B( n}
6 S& k/ y  E& V; g1 q- P( \% u8 W- U' i% M' c  j8 ?2 H
}
* d8 a/ t% g0 C) O4 S$ J3 ~1 {
$InitForm = InitForm();
7 F. V8 l  j8 d& f" M$Listener = PostListener();
8 b; y; Z6 m" Y3 C  T& D6 G* a
9 h8 I. }. V  \3 W7 F$ o?>
6 V) A. d2 d$ n7 x
( l9 p9 E4 M, V% o
) v1 i( d9 K2 o2 M8 ]3 ]: W4 L" u+ ?2 `# I
  h0 m9 X5 d, j& ?9 ~' B





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