飞飞世界论坛

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

作者: admin    时间: 2016-1-10 03:43
标题: 物品发送脚本
<?php
. v$ y0 T3 [/ |/ s$ O7 cfunction Connect () {1 s0 N7 C0 y* |! b
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
; u+ V) N- N! _% c1 n! O. N% Q3 Q. r; n! d/ O
Failed.');  L: \; n+ g* b: w) L4 `0 I' W
}
- P- n9 r7 W$ q9 d& m$ cConnect();
3 Q8 u5 [. d' u' \6 E0 Q4 m  E, Q. \# {
function InitForm(){. |8 Q# P) {8 o) O& k) l
//layout for the form, A8 n+ N8 |% r4 F7 f- ^
echo "<strong>Send Items.</strong>
, ?  R+ K9 l; J- p<form name='select' method='post'>
7 q" E  E! |/ |% f( x( u" M/ s<lable>Character Name</lable><br/>
" v9 P% T" X4 _- D0 R, k4 t<input type='text' name='char'/><br/>( [' f1 R4 m0 e, d; ^$ w; y2 p
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>! O6 q0 @2 k$ N
<input type='text' name='item_name'/><br/>6 X2 H: t3 z& `* F; ^
<lable>Item Amount</lable><br/>; B/ E# }# @& @# I' u+ Y: S
<input type='text' name='item_amount'/><br/>
+ E8 l# w/ U, ~$ P0 x6 m<lable>Item Upgrade Amount</lable><br/>
, B1 J' v- C, }<input type='text' name='item_upgrade'/><br/>* M5 g2 ?8 O% b: {' N% L
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)5 v5 G3 |) y6 X7 [" U5 i
( P( X5 G+ [1 h
</lable><br/>: B) k& I5 \6 V# G7 i
<input type='text' name='item_element'/><br/>, A6 \+ V  A8 j9 }$ @4 [
<lable>Element Upgrade Amount</lable><br/>
: y; v/ N* [0 I- t6 V' }<input type='text' name='element_upgrade'/><br/>
! j( v) b& k- R+ x<lable>Pierced Amount</lable><br/>
5 B) U, p/ g) g) P1 F<input type='text' name='item_pierce'/><br/>7 B9 _/ T) w5 E0 F5 R! g
<input type='submit'/>
" K  }0 [! o* s1 V, g3 i</form>";. c0 ~0 l2 l% U9 Q  S+ ^$ T/ }
}
8 W: y" w1 v4 u7 `
0 E! k" q" {5 p* K9 G: Mfunction PostListener (){
3 ?1 w: s9 y' g. {  ?6 n" z0 }, f" F//Add more post variables if needed and add them to initform() function aswell1 H0 r  O7 x# c# l
+ g+ C$ u" C, Y7 J% {3 n
################################
  C. E' @# L+ o/ k& f$ W& ]$ b##### Connection and Post ######
6 A: w* X. l( ?. S! v2 w( p################################% i: j* v' P( o' a- u/ L
$name = @$_POST['char'];# R* B& S8 g, j, c" G) S
$ItemName = @$_POST['item_name'];
/ E6 h* ~- m3 \: W/ p& ~$ItemAmount = @$_POST['item_amount'];
+ y0 u& L9 ]) q$ItemId = @$_POST['item_id'];; {" y; _' K$ q; ~9 s5 p9 E
$ItemUpgrade = @$_POST['item_upgrade'];
, O, }/ q6 Q  D8 v! u2 g$ItemElement = @$_POST['item_element'];
! z7 S+ f( F$ X% V$ElementUpgrade = @$_POST['element_upgrade'];
3 P7 L- Z6 s6 o3 Q6 |$ItemPierce = @$_POST['item_pierce'];# W2 u9 r& q, j. G  _% M. k
################################
( D- s8 a- H2 c- _$ R6 g4 U, U' U; E7 s3 X, b7 A
//Check both variables for empty value2 u6 J3 n* D0 q6 Z4 N% J( y: w
% Q$ y# h" ?% N2 c, J/ }- ^$ F
if (!empty($_POST['char'])){
- j( s5 g3 O$ i  ~/ R; r: A! F$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where ) V8 m5 F1 C, l) {# Q4 o" I- O" M

3 _! E$ n0 W8 j( n4 V2 G' O/ sm_szName = '{$name}'");
5 D: t+ g7 h+ Lwhile ($row = mssql_fetch_object($find)){
) a  ^& O* `& s# o' x% q7 }& [echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
0 x# H6 f  f' i& l, Z/ Y* a) \$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
1 A$ Z- {6 x' Y/ L) L7 K6 i! X' A- i, [
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], / B/ t5 `+ `; h

0 P7 V% n" z, E$ l[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', - `" w+ ?3 Q6 ?" V' w

* O. v( ]6 s4 X( i$ C) ^9 iN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
* q' S; @! m1 N  j
8 S! r2 n, a  y/ _9 D'{$ElementUpgrade}', '{$ItemPierce}');");" e) C7 i. k% p) V; ]
}
$ k8 T5 [( _5 A( `/ [, B1 z
2 S8 l) s2 E# |( ^) g: L7 |, m}; I: r1 e: O+ o; d3 o6 ^
6 D" F6 I' _- G7 a  w
}1 n' w8 Z5 B0 ]! v3 H! w( B

/ Z0 }5 {7 Y& }/ U; f/ q' m$InitForm = InitForm();) B$ l2 N: {5 E, D2 b( [1 Y
$Listener = PostListener();: a8 C" I. |& u4 L/ z+ t/ m# d9 }
4 @1 e" j5 m7 m3 M6 F0 U* c4 ]
?>6 }0 U7 K( y/ \/ Z9 M
# g2 x# A. G% j+ Q' e, r; f3 l! y
; U8 s6 v; t' D) ?3 C
9 D. A! _5 _9 Z1 S: V* s( C
* L/ @$ S2 W8 |5 P1 z





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