飞飞世界论坛

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

作者: admin    时间: 2016-1-10 03:43
标题: 物品发送脚本
<?php
% q3 e' H. ]$ j& K! q8 efunction Connect () {
# E  ~; }4 P: G4 J3 `( M9 Vmssql_connect('Server','UserName','Password') or die('Error: Connection to DB : H% T! Q4 \# W7 e5 O2 B
  O2 t/ }; r$ i- L
Failed.');
2 C# j0 O0 z- z1 b1 ~5 b}
2 R" ?, e! U, {6 Q% p8 {5 s) aConnect();
- f& h6 g1 v: j' J% n4 s$ ~0 M3 h* n% B, e( ^
function InitForm(){2 T: c( Q* b% R0 ?7 p' t8 t
//layout for the form
. B' i7 d  b9 q( Aecho "<strong>Send Items.</strong>
9 n3 A/ M7 q6 G: V& T* X' b<form name='select' method='post'>- r3 o9 }$ O: j' A6 _% i+ v. g
<lable>Character Name</lable><br/>; ~$ ]" v" Y' S8 i3 l9 z* [7 t
<input type='text' name='char'/><br/>. Q: |' L2 |( y
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>+ x6 D: L7 w8 x0 f& P* j1 Q
<input type='text' name='item_name'/><br/>
6 Z# B) N( g! p; {4 u% h8 W, u<lable>Item Amount</lable><br/>, I7 T+ {( o0 v+ t. O6 Z, l
<input type='text' name='item_amount'/><br/>% n0 ~& g' [: B* c! g
<lable>Item Upgrade Amount</lable><br/>
& q2 l) U  e. Y- e& D: Z<input type='text' name='item_upgrade'/><br/>5 |" B6 l3 x. F+ K1 G
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)- L# A" Y" A  C$ W: O/ M: e

- r: J/ }; o, K1 s) ?+ M</lable><br/>
1 s2 H+ X0 S/ r3 p" T" s3 w2 q<input type='text' name='item_element'/><br/># i  p7 V9 ~) a% T7 q) x& W" ^4 m
<lable>Element Upgrade Amount</lable><br/>4 ^: Q& d% d% S* I' s
<input type='text' name='element_upgrade'/><br/>$ \$ Q. V5 `0 x5 t! g; M) z
<lable>Pierced Amount</lable><br/>6 Q7 R) e) W3 C0 q/ n; ^& y
<input type='text' name='item_pierce'/><br/>7 L3 r/ c: L6 y' a$ ], |
<input type='submit'/>
5 c- I8 r. P' k$ c</form>";
$ e) R) b6 P1 l, o( n2 \* J( L}: W, e2 r. Q0 G

5 ^- U. _) o- t/ N# H$ ffunction PostListener (){. U) }( R- V+ k( ^
//Add more post variables if needed and add them to initform() function aswell
" n6 o' o; l0 v( Y1 ~- v1 m7 T: }; H; G, b9 K2 d; j" s& [& ~
################################1 I4 c# |7 [8 Y% f0 z- D
##### Connection and Post ######3 G2 u* v: |( g6 D! `5 @1 ]* ]
################################
' s' `9 Q( o# T$name = @$_POST['char'];
* Y# r- B% s7 ]. q; u$ItemName = @$_POST['item_name'];9 [1 I  e- N( U8 S# R- l! E8 V
$ItemAmount = @$_POST['item_amount'];
' r5 D1 Y( C* A0 W/ U+ N$ItemId = @$_POST['item_id'];
0 }$ o% W9 t5 U$ItemUpgrade = @$_POST['item_upgrade'];
! t7 j' \7 `. r3 g$ItemElement = @$_POST['item_element'];1 t3 O* d6 U/ q$ j" x" }6 A
$ElementUpgrade = @$_POST['element_upgrade'];
& W) t3 J8 K2 _. \) p$ItemPierce = @$_POST['item_pierce'];, g5 p; `9 k' _$ e$ [# j) t
################################0 U5 w$ l0 L' m$ Z+ |6 u8 s

5 @8 {+ y% V" s  x: R$ K4 I* n2 \//Check both variables for empty value
4 u' L1 d/ i0 ~2 y+ Z
/ A- I- j+ G- q* v/ s, pif (!empty($_POST['char'])){
; @8 d$ `- }( t7 L4 S3 \$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where 0 W3 ?0 T3 O! p6 e2 z* U" t3 P3 n

2 W' h7 n6 W6 o, t# d+ @- ?m_szName = '{$name}'");* W3 w4 D; Q0 b. b: W
while ($row = mssql_fetch_object($find)){
9 ]9 v8 h. m4 F- g- R+ J8 zecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";/ d$ R- ?: z! u; b$ ^
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], # C2 a9 h6 ^/ P

& @) d  D6 V- |[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 7 D0 R6 G, D' H" N
% {2 A+ ]) z" T6 \
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
1 N- }, \2 {% B' E3 M1 W7 T+ T  Q9 V' r1 u7 k
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
$ m9 v- V+ U' L" E; m
2 K/ B! j; V& c( i9 T- Y'{$ElementUpgrade}', '{$ItemPierce}');");
7 }5 I5 K7 c' e7 i+ t- ~}' o3 I. T& ~, [! V

6 W9 |3 s. s6 S4 e  Y}8 ^- C9 E: W2 r
( h2 @" I6 h! N
}
% i. n5 G* e+ L
# m. m2 x1 u% k0 H6 a$InitForm = InitForm();/ f8 |9 _" h& e/ [
$Listener = PostListener();& H# s2 F0 I2 q# i$ I9 F
8 e- h! V& H, V; R+ L- b. Z
?>
5 r, [/ i+ T# p# y8 V
/ y; W: r& X# e9 `! D6 ~
+ {8 a" D/ I% }- a% V
. D% C4 Z' r% ^, a% ]+ u
. H& ^7 {0 m3 h, M& ~* h  n




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