飞飞世界论坛

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

作者: admin    时间: 2016-1-10 03:43
标题: 物品发送脚本
<?php& g% q# r7 j7 {9 ~8 _  n
function Connect () {
  `! B7 y( v$ |& \7 umssql_connect('Server','UserName','Password') or die('Error: Connection to DB 6 _  _, G; N3 {% H0 C0 S

* ^1 t5 G/ ~3 {- JFailed.');
' j+ x4 }. h! \/ [4 i}. \6 P- h5 a" n" J
Connect();; @1 @* `  H% x0 Z2 p% c6 K

7 P0 t) P4 d: @* p$ m1 ~6 Ffunction InitForm(){
& Q3 S6 P+ m2 }$ |+ e6 I" ~. X0 |//layout for the form: {3 q) D6 w' z; G  p  j) W
echo "<strong>Send Items.</strong>$ A1 U4 _/ l- C- T
<form name='select' method='post'>6 V$ _, I+ t, \) d& g! P
<lable>Character Name</lable><br/># S( g) T9 P  k$ T/ C; [$ [! D
<input type='text' name='char'/><br/>. s% I' T2 s8 M3 \7 o6 K, D  y
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>0 b3 S5 E- r; M0 r( x- G- E' d
<input type='text' name='item_name'/><br/>
% g: f5 @& e9 Z2 e0 D<lable>Item Amount</lable><br/>
) B1 J( [! T" F# s0 X<input type='text' name='item_amount'/><br/>
9 b* C: |+ B+ `1 P$ W4 A<lable>Item Upgrade Amount</lable><br/>1 a, _+ Z1 `8 u6 G
<input type='text' name='item_upgrade'/><br/>
# g* g4 B; b# N, r5 I3 ^4 ~4 a<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)( D: K. r# k; ?4 W
' a& d$ p, u4 _
</lable><br/>5 z# v' w6 i2 R6 k: y
<input type='text' name='item_element'/><br/>
) j' ^& J: s  C8 D<lable>Element Upgrade Amount</lable><br/>! r; M% ?/ @; f8 h/ c
<input type='text' name='element_upgrade'/><br/>+ M0 \1 a7 {# b6 [9 ?
<lable>Pierced Amount</lable><br/>
3 Q3 g9 o8 q3 h' z6 Y/ ^+ b5 S<input type='text' name='item_pierce'/><br/>
' F- w7 H! R+ z& F* p5 W3 K6 ]<input type='submit'/>. M# B" i" q  t/ D
</form>";
. K+ f3 I3 m% H}6 ?: B  A4 f. T2 W! E6 S7 E- ^

7 \! i  e# {/ r( }- W/ @- E& Gfunction PostListener (){; ]) I  m# K  b) h8 C% S
//Add more post variables if needed and add them to initform() function aswell8 p# L8 T8 ]0 K" X0 K" e

( ?( Z7 \* N9 U. f' \  j################################3 h  {- C6 C* e7 H+ ?
##### Connection and Post ######  H, g+ {; W, V  x
################################3 `, `  ]$ K$ r( ^
$name = @$_POST['char'];0 f) x3 J( {6 R$ X3 h+ ^( X9 C
$ItemName = @$_POST['item_name'];8 M* ]+ g! U$ W/ ^% s3 Y+ P
$ItemAmount = @$_POST['item_amount'];
8 u2 u! |1 B) W4 {& y/ W9 B( N$ItemId = @$_POST['item_id'];
2 i' ~, T! Q7 x2 p% ~3 B6 B$ItemUpgrade = @$_POST['item_upgrade'];) C3 D- o5 e, ^; G% ?
$ItemElement = @$_POST['item_element'];2 ~0 w% q+ Q+ i
$ElementUpgrade = @$_POST['element_upgrade'];2 s3 L' [# y' z6 a, u- P
$ItemPierce = @$_POST['item_pierce'];& s* ?- }: b# U  `, T
################################
5 g0 C" m& U" g6 J9 X1 @- X$ E9 p0 K# O4 t3 M' @1 B
//Check both variables for empty value
' Q* K7 P9 _4 b5 x9 z
- m1 C6 n$ {& f7 ?# U3 kif (!empty($_POST['char'])){
  `5 O; @, [$ s8 J$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
! W' B; m/ f" B/ X+ w5 I2 x+ O
( b- l) a$ R" D1 z# Y" Om_szName = '{$name}'");
$ _; x6 _" v7 O( p$ u. l8 Xwhile ($row = mssql_fetch_object($find)){& a' V2 f) i* E% x: ~
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
3 v9 A5 X) X, {4 t; Z$ k! ]  c" e$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], , _3 ], Z& i0 ]# X' l& J7 P; Y+ H2 \$ y
- Q! r, x' Q) S+ a# `* I/ a, [
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], & d4 L2 S6 ~: Y  _2 p+ v- a

' M3 }) N6 j% o' @: b# T[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', * N+ ]6 i! c7 A% K8 y
; [% B3 Y+ J: y: l9 D" H
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
7 n6 {. u+ ~& O9 j  m0 H- y% L3 o0 E" R* i8 G; }. V6 A. e$ \
'{$ElementUpgrade}', '{$ItemPierce}');");
5 p% N2 v% s" t) O% F}; }' ^, ], \$ r$ H1 w+ n
, u7 T$ h7 X( a# u5 L5 j% V7 g
}" R+ F: Q$ Z/ e8 [# S
0 W" i# }" [1 c4 ], H- l" j
}
) e0 q' a5 n7 l1 F, c* J' S
8 f4 k+ Q' W1 N) `4 b1 l$InitForm = InitForm();
3 W2 h6 b4 i( J+ q$ ~4 E$Listener = PostListener();
$ V/ c, B; W% k, u8 h
- P. d$ q- M7 N6 F3 L* n9 a?>
* l6 G! _+ f9 }0 u2 _9 L  x* t, C  U2 `+ X' D/ i6 c, ^

" X. ^+ i9 I& w5 J2 l1 Y+ V7 F2 `+ `
. v* Q# X1 U: \- q. z, {





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