飞飞世界论坛

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

作者: admin    时间: 2016-1-10 03:43
标题: 物品发送脚本
<?php
2 m4 @3 K' E  [" n$ b  L& Z# a- Sfunction Connect () {
( y* t7 J$ o; |# |, q- t( u& ^mssql_connect('Server','UserName','Password') or die('Error: Connection to DB 7 R" S: b! T! r% [4 J

# [- ^. j- l/ H: d  Q( V0 EFailed.');
! E) b: w' B" b& F# s}3 g5 _; Q' |- U
Connect();
! X3 o& b8 G. d" Y/ \/ q7 _
3 g+ ?" }4 F" A$ ~# m! C+ Ifunction InitForm(){1 Z7 f% X2 U* _2 [4 e4 p9 T
//layout for the form: _8 l4 y* w7 I
echo "<strong>Send Items.</strong>
# W$ T  R3 V- ~3 \; w, _<form name='select' method='post'>
3 P, y% R5 b7 J( u<lable>Character Name</lable><br/>
8 Q" i0 q% B* Z<input type='text' name='char'/><br/>* g& d" \, E% y/ T0 ^, H) I. z
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
( f& c5 `9 q& f; J+ K/ I7 g<input type='text' name='item_name'/><br/>
6 T7 v) Y# [" R% |. k  Y<lable>Item Amount</lable><br/>% @& Y& u9 n  _; @7 `, C1 B* s: y! a
<input type='text' name='item_amount'/><br/>
. H7 L) n5 N, z  W, j( p<lable>Item Upgrade Amount</lable><br/>4 {/ h9 i- M5 G) ^
<input type='text' name='item_upgrade'/><br/>' L3 B+ W/ B" y# y3 ?
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
6 `& ?# M) ]) v: k) G/ e
0 K% A5 L5 n1 c- I</lable><br/>: d9 U9 j5 G0 S2 D9 ?: j* y+ Q
<input type='text' name='item_element'/><br/>( t0 ~1 U$ o# h, D/ ]# b
<lable>Element Upgrade Amount</lable><br/>4 M1 V/ r7 j# g; h. k+ ^
<input type='text' name='element_upgrade'/><br/>
/ r$ C; l1 B' g4 \, z<lable>Pierced Amount</lable><br/>: P4 ]( p5 k; \
<input type='text' name='item_pierce'/><br/>4 `9 W5 H% h2 u: }% ~. s- q
<input type='submit'/>* x6 w" o6 T$ y, T/ }8 L
</form>";- I1 h9 ~! h2 h4 @0 w  `& t
}
2 e) C  M9 c) @0 Z
7 Y( z* Y/ m, E+ n7 S- nfunction PostListener (){
5 w7 N4 w2 ^$ I5 ?( l$ K//Add more post variables if needed and add them to initform() function aswell
2 R! E3 X, r( r. j" q  Y: Z+ Y( }; @$ t: q( f; [& g
################################) A* @3 s4 J. X: d7 y) Q5 O
##### Connection and Post ######) U! S" ?; c' X* e8 h
################################1 v# E' x3 D; p0 I. R0 E  A
$name = @$_POST['char'];- U/ b) D4 f1 ^
$ItemName = @$_POST['item_name'];
- e5 V- m( {& K& a1 a$ItemAmount = @$_POST['item_amount'];% k$ L: e! x0 I8 s4 s& K, U
$ItemId = @$_POST['item_id'];; \, M6 S. v9 m
$ItemUpgrade = @$_POST['item_upgrade'];7 p% f( B( C$ R& d/ d
$ItemElement = @$_POST['item_element'];# s' l7 x' Q0 n7 ^
$ElementUpgrade = @$_POST['element_upgrade'];' ^$ J# b( x; l1 P* \
$ItemPierce = @$_POST['item_pierce'];* B0 C( x: n2 T7 J9 a5 b
################################* l$ d* |: H1 q. j4 F5 v

  `0 a# L; w. v# q//Check both variables for empty value
# u6 I# ?% I9 ]; n7 o+ \! z
( s& N: Y4 x2 j6 k0 `3 B3 |8 H* Bif (!empty($_POST['char'])){
2 n5 j  X! W# Q. j+ B5 M$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where . W6 S' M$ E$ d( K8 Y, ?; D5 P

( S/ M" G: V& O( |* gm_szName = '{$name}'");/ R8 C! m* m# x2 N
while ($row = mssql_fetch_object($find)){
( k9 z" x6 E+ t7 o+ N) {' P, ?echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
+ P: v. g  a! ~9 I* a  r$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], / v- \% D3 H2 {, D+ n
7 k2 r# R1 x$ L% e% r- T
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
2 E: q7 W: Z) G8 A; ]- e
3 F* o! @  m) ^8 j3 T[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', , o6 h8 a; H$ e) t
  l2 @' {' a3 p( W9 {' O9 c
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', , y( I4 ~' [* H$ v. G! }; |

& z0 p( c' C! U4 u( t; e1 ^. F'{$ElementUpgrade}', '{$ItemPierce}');");7 {8 v) k* }+ L+ y" V; S% L* d
}9 u0 u! v' o( Q# ~: v9 `4 G
" T, f6 [2 v" Y0 F' F* U7 u+ @3 Y
}
; b& ]2 m8 b. X3 g0 H" d1 U- p9 x( c* r) J# e' `7 f- E
}" o+ i# U, y% K$ n. B: C

: Z5 Q) G9 u& j+ V: b; J+ D( \' N$InitForm = InitForm();
( t$ V, H: j) A* ?$Listener = PostListener();
* a) l3 N$ B. n4 S+ b6 m4 n" M! x/ ^3 e2 y! v5 r" @
?>
5 Y7 {- h1 S4 q! Y& B4 r* I& b" Y0 D5 @4 |' y* [1 w  C
* o6 C$ J$ S' L* K2 c
. \- ~. U3 k& T# ~

$ Q/ Q$ x+ Z/ q; g




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