飞飞世界论坛
标题:
物品发送脚本
[打印本页]
作者:
admin
时间:
2016-1-10 03:43
标题:
物品发送脚本
<?php
& y6 S5 g6 C$ @$ g6 z7 j: N+ ~% C
function Connect () {
, c) Y; _* \* q9 c. t4 w
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
5 E0 ~% b/ C* h
6 o- d/ v7 t# e8 h0 Z
Failed.');
3 _0 c" j# z3 ?" @( T
}
7 T9 g% C# c- ~3 Q3 x$ \' Y9 C
Connect();
% {6 c `, o8 t7 H+ l: z' ]
3 ]( m# v7 S: r# i) z8 ^
function InitForm(){
. g$ \5 C7 ]3 @! S4 ?; _
//layout for the form
6 @) F+ p* {$ L' @ J( l
echo "<strong>Send Items.</strong>
9 v. L. G* i$ V. B7 M
<form name='select' method='post'>
# L8 n) T) }5 K
<lable>Character Name</lable><br/>
1 j" s$ J5 s& D1 X. L# R
<input type='text' name='char'/><br/>
6 y. n8 b& {/ X' N, k1 u6 A
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
/ V* C5 ^' c) @! C3 y( }! r
<input type='text' name='item_name'/><br/>
" @1 E, s0 D& G+ G- q9 q
<lable>Item Amount</lable><br/>
4 i# {1 | F, V! e( A5 d8 _. Z
<input type='text' name='item_amount'/><br/>
4 |' \" V$ S8 q1 o9 ]% g
<lable>Item Upgrade Amount</lable><br/>
) b4 X/ ~1 k, I' A0 k
<input type='text' name='item_upgrade'/><br/>
1 ?( n( e& T% G. l3 Z- H* i
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
, H4 E* v O8 F* A
$ ?* i: c2 g* t1 J
</lable><br/>
7 H' _+ ]3 Q" u. }7 G/ _3 L! p l
<input type='text' name='item_element'/><br/>
) ~+ m+ }* l8 U
<lable>Element Upgrade Amount</lable><br/>
! v/ a7 S3 h4 v, h: J
<input type='text' name='element_upgrade'/><br/>
5 v8 D0 A+ d( V1 S- A
<lable>Pierced Amount</lable><br/>
! ?7 w/ n0 M6 O5 C* r0 g2 {
<input type='text' name='item_pierce'/><br/>
% Q0 k L$ Z( |
<input type='submit'/>
+ f0 B l+ ?+ {6 Q* u% ^
</form>";
- q& n5 r# }* f0 w0 E; p
}
! h8 z6 I) s" U' S$ \6 R3 l6 f
# I+ J* ]! Q% }, V% _" H% Z6 J1 l9 |
function PostListener (){
2 A1 |, [# D8 n! H7 _2 X
//Add more post variables if needed and add them to initform() function aswell
& w! d# m" q1 N. O t
8 H2 V) u/ c+ L( j8 o
################################
7 W' f2 N( i4 H: _/ F
##### Connection and Post ######
2 K- J) y2 j9 x& X* P
################################
2 R3 k( L/ v# M/ z& O- _
$name = @$_POST['char'];
1 E V" y5 Z' K0 i4 G
$ItemName = @$_POST['item_name'];
$ g& L3 p8 | \ }/ }) j: ]
$ItemAmount = @$_POST['item_amount'];
/ b/ f8 Z, i- y7 V# Q" |+ k, y$ y
$ItemId = @$_POST['item_id'];
; d- ^& c$ L% x& _ m2 Z
$ItemUpgrade = @$_POST['item_upgrade'];
& a' B- h& \2 L, ~
$ItemElement = @$_POST['item_element'];
7 J' }9 N! H- {9 ^% N' D4 D
$ElementUpgrade = @$_POST['element_upgrade'];
) f% ~0 C- F0 l8 ?' z9 J% A! b4 C0 X
$ItemPierce = @$_POST['item_pierce'];
/ q" k5 x( b* m: h, z
################################
4 b% J, Y8 U) F& T& ?6 W- B2 C* ]7 s
) \1 T- K1 B5 l+ f8 x4 G' S3 R5 A
//Check both variables for empty value
2 I1 x& T- f7 x" o3 x$ b+ w: G
* p- i ~) J( C8 ?9 y3 {
if (!empty($_POST['char'])){
0 T- o ^ U$ w* Y2 j$ a" |8 ?% ?% R4 O
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
5 G1 e6 U& T. }* ^; M
2 Y, ~5 A) [5 c- W
m_szName = '{$name}'");
+ w/ k4 s: `1 l1 V" J! P& L
while ($row = mssql_fetch_object($find)){
; j9 V# ]) F3 v3 c. c
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
% k' g9 E" G* i9 V+ o! M: _8 Y* J
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
! C- ^* K# V0 x( L) f- E
# G) y2 T, v6 F- \' S" A% d
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
* T0 v' C' {$ |! p/ J8 |. J
+ d Q4 j; b* ^7 S$ a) N/ L6 \/ y
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
5 u0 V3 s6 o: H- Z' m! @( ~
5 J8 H. `* | a
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
; i; u P% D: N5 e3 g4 ^ h
" _3 y# ^8 B6 E1 n. L
'{$ElementUpgrade}', '{$ItemPierce}');");
5 H" w1 ]; K! q `
}
6 P7 |# z$ @2 s S
- P& i6 u! @# x
}
$ X1 b8 z8 Q/ X& G ~
1 M5 T! D9 \ c8 [
}
1 y5 o- j, j( x
# l0 G3 Q6 c' R6 s) [
$InitForm = InitForm();
, |; A. E7 k2 L. k
$Listener = PostListener();
# q; G. Y/ i1 C, X0 N# Z/ v6 o
9 ^4 |9 f1 D1 {& p) i2 Z
?>
6 W* h* Q6 j1 a5 `, J' ^, u# i9 y* v
; m. x: `: A# Q- i
( }) M' N% d9 Q; V7 N- g8 P
: \1 c; j% g# x) T. ]
* ^' ~" N. p% F& B
欢迎光临 飞飞世界论坛 (http://www.ffwold.com/)
Powered by Discuz! X3.2