飞飞世界论坛
标题:
物品发送脚本
[打印本页]
作者:
admin
时间:
2016-1-10 03:43
标题:
物品发送脚本
<?php
0 \, W+ g; ~% L" W0 V }
function Connect () {
& m% E7 Q, r6 S0 Q% z8 a$ p
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
+ c1 w# z. u5 B% P
5 L* q3 ]9 k, U$ M8 h& i
Failed.');
* b4 K; H$ D" i5 U7 w# h
}
, G( W4 }, L1 P; ^; h
Connect();
1 q$ s, H! V [
2 P; v% b. V5 m0 X- I" {! S
function InitForm(){
% v# U) }# K9 f, H0 m$ e+ w8 T9 x
//layout for the form
% z. b/ d" E# k' `9 p
echo "<strong>Send Items.</strong>
- t1 Q- O4 b% k/ C, G& u! E
<form name='select' method='post'>
3 C5 u9 M* |! Y( b) W
<lable>Character Name</lable><br/>
! F6 T: L; S1 e, v5 M& }6 O, G
<input type='text' name='char'/><br/>
( M: H0 S# ~2 o. O, e
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
' O; [, `$ A* z2 R
<input type='text' name='item_name'/><br/>
. J; w' s+ G1 d3 X3 e
<lable>Item Amount</lable><br/>
/ y; E/ ~0 }4 v/ t Y" D! J! ~/ O
<input type='text' name='item_amount'/><br/>
+ s) U! H( t) M; v) g8 C" e! S$ s& S; Q
<lable>Item Upgrade Amount</lable><br/>
3 x6 s2 R( R% _- j
<input type='text' name='item_upgrade'/><br/>
' C, p: L; k* n0 P
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
' m! i% Q- `$ U" v% w/ s( X+ S. o) ^& I
: n2 r4 T: D2 Q1 K! C8 h% K
</lable><br/>
& l! W# U% b D3 o
<input type='text' name='item_element'/><br/>
" Q* ~8 r+ [/ K
<lable>Element Upgrade Amount</lable><br/>
m- b. M# S" @; x& R7 l1 e( D* k! k
<input type='text' name='element_upgrade'/><br/>
0 Z% y) {% U5 R' K D$ D
<lable>Pierced Amount</lable><br/>
1 m8 I6 K7 v. N- K) g, B
<input type='text' name='item_pierce'/><br/>
: a) o! z: i9 y, f8 J/ P$ M0 c
<input type='submit'/>
4 z. E) q; b% h& w1 S _
</form>";
- z U7 p9 h ^; Q
}
3 Z. m, q' m+ k3 [ q" a7 i6 N2 O. k
2 b) c, r$ E# Q# n4 Z0 @ X, N
function PostListener (){
n4 a3 f% ~5 Z& ]7 x
//Add more post variables if needed and add them to initform() function aswell
# H) ^3 y7 \& F1 J8 d
/ U5 q0 C3 U+ [" {* x
################################
+ @5 X' x/ q) |
##### Connection and Post ######
l* d: v$ t# b2 E6 A/ P
################################
I: U# N/ ^9 [( Y
$name = @$_POST['char'];
+ t- w8 m' r4 x# q! R9 m. W
$ItemName = @$_POST['item_name'];
/ ]. p$ y; A2 _5 Z
$ItemAmount = @$_POST['item_amount'];
7 f6 ` I0 r! \0 U
$ItemId = @$_POST['item_id'];
4 O; T3 \ \5 s( w) w' }% `9 H1 x
$ItemUpgrade = @$_POST['item_upgrade'];
/ E9 q% f7 A/ p+ J o: ~0 S7 F
$ItemElement = @$_POST['item_element'];
: A! a, a$ c) }" E8 D) g: N
$ElementUpgrade = @$_POST['element_upgrade'];
' X, k# h Z E; P
$ItemPierce = @$_POST['item_pierce'];
( Q/ S2 o* V$ w2 [# ^3 b
################################
. a7 i2 U. ? R
8 Y& d: t# l3 e& Q
//Check both variables for empty value
. k& H2 L$ b% G2 q; y6 S
' Z/ b6 e" T! a1 q1 C
if (!empty($_POST['char'])){
Y, |* ]+ V. _0 c* A+ [( l
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
4 A2 A; T! Y3 O& @
% X) K) T- s- B4 E
m_szName = '{$name}'");
# `3 R) z. w& `% [. f/ F
while ($row = mssql_fetch_object($find)){
" w8 S* @/ o# [' Y8 {
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
! l4 S) `. M* h: Q4 _
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
1 y+ o7 N5 e! x" T) ?
: e# ], ?4 s; P$ M# s2 L( A2 [
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
' R. ~5 j) x. a( ~6 M4 e
( n) F; j k5 ^7 \; n5 U
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
8 z5 i. V& ?$ d( c3 j& @* ?
+ r( ~; v. X$ \" s% d5 c+ W
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
' e" f( D- ]3 A
* u# d5 y- O- D
'{$ElementUpgrade}', '{$ItemPierce}');");
1 _# L, z6 l2 B# ~% y/ R
}
( b, o& ?* h0 o" o6 N$ Q
0 b5 n2 v W( V8 T3 u8 }
}
$ y: l+ I( K5 Q; t0 ^! a
' {7 L$ H+ T, S2 ~$ s4 c
}
- n( ?/ r! p a3 n$ }
$ [3 O0 u7 J A) b; F0 k: R9 D3 |4 b
$InitForm = InitForm();
+ x$ D" S, t* d5 U5 d5 z* q
$Listener = PostListener();
+ l+ o- m: U$ Q" ^3 G
6 C# O0 L* s A$ K7 R0 U. `, M
?>
" Z( N0 H# v) k" A
! H1 T1 ]" n+ g! h0 o$ ?
# y2 e6 l3 P& r3 J5 }8 w6 ]
3 g i% ~- G) C
4 P$ s: @$ ]5 n, F: g I. l
欢迎光临 飞飞世界论坛 (http://www.ffwold.com/)
Powered by Discuz! X3.2