飞飞世界论坛

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

作者: admin    时间: 2016-1-10 03:43
标题: 物品发送脚本
<?php* ]/ u7 ~4 C% {( N
function Connect () {3 u7 i5 p; Z9 S) u: y$ g% A. D9 C
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB 8 c. i) l% [: @6 W& j, @
, \+ [. d8 v; E# `2 x2 q( J- |+ {3 w
Failed.');
$ J; A: c- _5 L& T+ W; b; O}: h( R' J2 ^0 d
Connect();
+ e, [: ^* L% G7 S$ ]5 n: p0 U
0 {# K, j; ~- }' }! G: ~( I+ ufunction InitForm(){) }7 `; t5 S3 R% {. G8 O9 h
//layout for the form# r& Z- G1 `2 d
echo "<strong>Send Items.</strong>/ Y2 W  ]  }7 o% \& G; m$ a/ J3 H
<form name='select' method='post'>
  v* ~$ Z; h0 r3 \4 @. z. M8 @<lable>Character Name</lable><br/>
# l. l, @- e2 R0 A: Y<input type='text' name='char'/><br/>7 {& l, E7 O: l0 @: x/ R
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>* ?4 i* N8 A; x& k
<input type='text' name='item_name'/><br/>) J" o$ a8 w0 B' w; P& j
<lable>Item Amount</lable><br/>' x; e' U! L1 B% j
<input type='text' name='item_amount'/><br/>; `# r. U( t+ M1 U# p
<lable>Item Upgrade Amount</lable><br/>
; |% f/ _" i* t+ `<input type='text' name='item_upgrade'/><br/>
# Z* |0 i; ^; B2 W& F  W<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.): R/ K! Q! c6 m$ c
1 S. j8 `5 {* K( C
</lable><br/>
# f+ A8 ?6 n- v; B<input type='text' name='item_element'/><br/>$ k6 Q6 S! `) c5 _
<lable>Element Upgrade Amount</lable><br/>
6 N6 q7 q6 @2 L<input type='text' name='element_upgrade'/><br/>0 V+ _$ Q2 {) x9 i7 v
<lable>Pierced Amount</lable><br/>' R. m( p) U1 Q: m0 Y
<input type='text' name='item_pierce'/><br/>
" u* {4 z6 r$ ]6 o<input type='submit'/>
4 |# L% _& x' ^  x</form>";& N6 [  K4 R1 o  |
}- F1 Y" }* u8 W6 l( d2 q. w- V

0 \: \7 j7 D0 d8 jfunction PostListener (){% e5 ?" t0 p0 v
//Add more post variables if needed and add them to initform() function aswell% I1 L) {& B! M: O7 M- x7 I
; M3 j2 X$ [/ N; Y& ^7 y2 o: A
################################
: S' e) ^, i. s8 M7 L) _' ~##### Connection and Post ######
# \6 l" I' _, z, G& x+ J################################
" v6 O6 B8 l! t6 ~' g$name = @$_POST['char'];6 Y- l9 ?# s1 ?: h
$ItemName = @$_POST['item_name'];
) j3 k/ X, P/ Z2 Z' y- n; F; z$ItemAmount = @$_POST['item_amount'];" U* G, d8 C0 S
$ItemId = @$_POST['item_id'];
6 ]9 K; z8 T+ h& H- j2 V9 `) N$ItemUpgrade = @$_POST['item_upgrade'];' l' U; Y$ z0 ~
$ItemElement = @$_POST['item_element'];2 R) _) g6 n/ t& P1 r# U: ~% P
$ElementUpgrade = @$_POST['element_upgrade'];
' C3 Z- f! ~" l! t: L4 @9 K) p$ItemPierce = @$_POST['item_pierce'];
+ P0 i5 J; o+ r, `+ j: K/ R+ {################################
1 ~8 B- z! }2 I4 `0 `9 V/ N% j3 `& M" T% H$ X4 d
//Check both variables for empty value
' B, T$ C3 U/ c: p  Y
7 g2 q7 X: B, C" {2 dif (!empty($_POST['char'])){
& k6 }1 D6 m: C3 L  x$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
* x# o5 b& l2 }, A" E, q2 b3 a
8 }9 T, `9 u  g! r9 N/ gm_szName = '{$name}'");
# l. L7 M' I/ M( S) ^2 ]. `% Swhile ($row = mssql_fetch_object($find)){" Y, k6 b3 U' ]0 W9 i# [7 L
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
$ g: \, E: Y& a+ q$ s: G3 J$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
/ M6 L, u5 ]; g$ D
0 K9 R% X3 |, J6 R[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], / C/ b  x1 U# d2 f9 M3 c

/ S, E$ y/ \8 L* P' V[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 2 J$ f- i2 G; Y: Z) Z

+ f( T% V* q5 V/ \: EN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', . ?# l/ K& B$ h+ e

& [& l# e, A+ I, d& K- V'{$ElementUpgrade}', '{$ItemPierce}');");$ c+ @6 Q! C- x! X' u, r
}5 u9 y" @% l7 p( A' V8 c
1 V( `% _# _6 i
}% p( F0 p: _* f3 s

, X/ O1 E4 a0 k, m3 D. T" G) w}7 d3 @1 q9 n- e

' a9 e* n1 R0 @; c$ j$InitForm = InitForm();. w# W9 E& [9 [, w" l# X" w, w/ ]
$Listener = PostListener();
: o3 G8 }6 h$ o: _
. G% C; m* n$ `; }5 `?>
5 z) \) J4 o6 h" Q* V+ u  F9 G2 t/ c! ]. N. G, G
) N- D9 _. m# ]) f6 g

: a: a" A: D$ b6 h/ k. r6 i! k3 b8 ~





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