飞飞世界论坛

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

作者: admin    时间: 2016-1-10 03:43
标题: 物品发送脚本
<?php
  u# U. _, G; _# `) ofunction Connect () {
+ Z7 _! g- m2 o* t, kmssql_connect('Server','UserName','Password') or die('Error: Connection to DB # \9 ^3 I% t% q9 D
0 q: D4 `% Z5 d! y' a1 q
Failed.');
  z1 P+ V. Y" |) W}; l& M) z4 c$ m6 Y/ M- p8 D, j
Connect();: y' O9 K- @# k9 Y; y# R# ^+ Q

& O2 A' z) V% D7 Q* ]) S* ~function InitForm(){
/ ?/ A+ H: h8 @- O  y( {0 s//layout for the form# j5 e! m! A( ^! Z$ [4 U' H3 c
echo "<strong>Send Items.</strong>
' q# H3 z" I/ w$ R: B: n0 ^1 J, v<form name='select' method='post'>5 Q3 d0 \* E' k' F$ R7 c
<lable>Character Name</lable><br/># u; Z, \  z: v" c0 j) h8 t
<input type='text' name='char'/><br/>
3 i9 ~; Q$ d% U, D* z3 E1 e<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
) h/ u& n6 d+ U" i& Y; E5 r<input type='text' name='item_name'/><br/>/ e; }, P6 r) [  Q3 y7 y" j. f1 {
<lable>Item Amount</lable><br/>
( c& d4 P" J( E2 }8 _- l9 D7 f( v6 o<input type='text' name='item_amount'/><br/>
4 c2 }! J: V4 Y<lable>Item Upgrade Amount</lable><br/>/ W9 h. F  D- _5 N9 \
<input type='text' name='item_upgrade'/><br/>, Q0 v9 Q  t# [8 l8 L4 P  s
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
% m' n# [: U1 N& N  T2 D* a
6 [; f+ K* O6 I</lable><br/>
. D/ q6 L' \" P# T$ h6 j# m<input type='text' name='item_element'/><br/>5 a8 A+ P" p$ _5 K7 I/ e
<lable>Element Upgrade Amount</lable><br/>
5 @; f4 ~: s( F8 z<input type='text' name='element_upgrade'/><br/>3 f- e3 \  O  g: Q% Y, Q
<lable>Pierced Amount</lable><br/>
( f8 B* |; }- I3 T7 n, I- V) R<input type='text' name='item_pierce'/><br/>
7 i3 }! F* J) [) Z1 u! Q8 i<input type='submit'/>2 Q: e- b( |8 h: J
</form>";
. E1 N2 B! H. b# V}1 `( g1 i9 [0 |* }* |, I  p( z$ [

. M; @6 q4 i7 \' W. ]$ ], Y8 p9 ]function PostListener (){' _9 j; y. N0 J) N2 G
//Add more post variables if needed and add them to initform() function aswell7 i* E' p& t6 S- Y! e6 X) v

1 d* @5 a7 r4 D/ ^8 R/ U. n################################  s- W; `7 S9 v
##### Connection and Post ######
3 D7 e) j7 _$ B' c################################" H2 I7 B( K; j9 q/ |' e
$name = @$_POST['char'];
8 x& A# _2 n. O9 Y2 e; c$ItemName = @$_POST['item_name'];
0 G# v* n& Z) Y  ?( y$ItemAmount = @$_POST['item_amount'];( a6 R3 R, j8 c; i
$ItemId = @$_POST['item_id'];' J, E6 B# U4 }( T* A" C5 N  q& v
$ItemUpgrade = @$_POST['item_upgrade'];5 {4 F% h+ P. \
$ItemElement = @$_POST['item_element'];
  h' V+ ?+ v% B5 M0 X: w$ElementUpgrade = @$_POST['element_upgrade'];
3 g& C0 A% Q1 C$ItemPierce = @$_POST['item_pierce'];0 s. i. b% P' r2 B# Z
################################0 r. V0 V/ p/ \

' d" q; u( S& N6 u//Check both variables for empty value
, v; _* R/ ^. U% u
: z6 a' V. @1 Cif (!empty($_POST['char'])){
5 [; x+ u# Q/ `/ I% w/ k$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where 0 V* r# u) Q' }8 O6 r( X1 b

# x0 x. i: p- jm_szName = '{$name}'");
& J3 n* B& n- h* Awhile ($row = mssql_fetch_object($find)){
! N" s4 O4 d( {4 I+ K  Pecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
1 M. }) P$ A  ~* k9 Y- S$ a- f$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], % H! v; e4 X$ @! y" y
4 I# |7 I$ D: S. y  x
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 1 l4 y9 I# M( W

, T- d/ j1 Y" K; E. V- S: p7 |[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
1 @9 i% M3 X2 P2 E5 i7 b6 f/ F0 U: p' ?
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
5 i5 C7 H! ~! x/ c3 C! q' L, F4 K8 p! U/ q
'{$ElementUpgrade}', '{$ItemPierce}');");% [4 v% W5 ]8 A/ y. o% F: ]6 V
}* [2 }) c% Y+ S! p8 X1 A  z
$ I( x1 a) I- m* t8 B- X6 Z( H
}
- T9 x: y/ |, H% O2 F- F3 d9 ]' c5 X" A) S+ Y
}
# |. Q# V: m1 Q" j" @6 \% Y
% ]6 n: \/ N0 p- }9 `$InitForm = InitForm();
6 j! G4 v% _. o% Z( X' e$Listener = PostListener();2 p4 e( u4 s' {5 Y* F
- J/ Z$ u( ], K/ x; Z9 [
?>& |" \2 J/ M( n( n. G1 K$ T" a

  n& }9 \, o, Q. j  e# I/ I& H* k3 [: E" s" V# o. F8 R+ \/ y* A

$ Q' t6 b  Y$ z& r7 T% f( w6 P( j" \





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