飞飞世界论坛
标题:
物品发送脚本
[打印本页]
作者:
admin
时间:
2016-1-10 03:43
标题:
物品发送脚本
<?php
; i- Q$ T a; q) w1 ?
function Connect () {
8 K3 g4 K- A0 s Q
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
: q1 ~+ \5 Z5 J! ?& u* c3 d: i1 I4 V
- f% q2 S4 n7 ^* G0 K' j& H+ B
Failed.');
* y1 g3 a4 O" u' `5 d/ P& L D- {
}
# h! N5 n( o& K0 `2 @2 B
Connect();
! J" b" a$ e, ?0 @3 }6 ]7 q: v
# K9 S! t. s: \2 `" w
function InitForm(){
% q3 n' K8 g& T2 y$ ~
//layout for the form
, W% w( N! b6 n2 p: E1 e3 o. q
echo "<strong>Send Items.</strong>
; D5 W. S2 S& k
<form name='select' method='post'>
# m; j; S. t' v, M7 O7 j
<lable>Character Name</lable><br/>
" B) P/ |# V/ w1 I4 |( H
<input type='text' name='char'/><br/>
0 O5 U1 N, m g* M9 F! g
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
" Q. x- H0 G/ K' v% [3 y' h
<input type='text' name='item_name'/><br/>
/ C3 E, \+ J! b8 m3 ]! Q
<lable>Item Amount</lable><br/>
$ i4 q( `! i+ U- N2 Q; b6 o: q
<input type='text' name='item_amount'/><br/>
2 E* Y' Z: L5 l5 g
<lable>Item Upgrade Amount</lable><br/>
# H) c H R% C; \4 o
<input type='text' name='item_upgrade'/><br/>
~( E6 M! M @, A
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
$ R6 G+ T( F9 ~/ C5 @- m
2 _5 x6 ^1 i0 x# a. i0 g6 U/ M
</lable><br/>
8 l ~5 X) ~, _" B. C
<input type='text' name='item_element'/><br/>
3 F" @3 \& o) c5 b, {# S! ~/ p
<lable>Element Upgrade Amount</lable><br/>
6 j# q/ q v( p) L+ T2 p
<input type='text' name='element_upgrade'/><br/>
" i' P5 |' Y1 c" b* f4 Z
<lable>Pierced Amount</lable><br/>
0 m: x1 c( B. @$ S
<input type='text' name='item_pierce'/><br/>
' b( Z3 f! M8 `$ F/ Z* R! w
<input type='submit'/>
9 m; b) X( y) @
</form>";
- h, Q% l# L: d4 N
}
: Z) B* E8 t# h4 t5 M) d
( O% A! }- S; F# S( N2 [' w
function PostListener (){
6 W8 I8 b' w, X: o) @4 |. o
//Add more post variables if needed and add them to initform() function aswell
" J2 }1 T) \- p n; f; ?, A
$ m. M. T. \/ K7 \5 l- w3 U
################################
7 I5 P0 t! O$ |- F6 ?
##### Connection and Post ######
0 f/ M6 z$ X3 c& |/ k) b
################################
; _. e+ I* Q- M ^6 Z
$name = @$_POST['char'];
) \' y$ |8 @; }- G) H
$ItemName = @$_POST['item_name'];
9 J- m( T2 c7 W9 m
$ItemAmount = @$_POST['item_amount'];
' g ^1 X4 J. n, P
$ItemId = @$_POST['item_id'];
- w; x6 C* f- i/ r% N- X
$ItemUpgrade = @$_POST['item_upgrade'];
# V: Z* E) Z7 F
$ItemElement = @$_POST['item_element'];
% ^8 a3 a# A) i% L9 T
$ElementUpgrade = @$_POST['element_upgrade'];
, k, e& k" @8 M1 O
$ItemPierce = @$_POST['item_pierce'];
7 G5 I8 y) ?1 C. s' f! k/ B4 R& R
################################
: X3 W; ]' @" [$ x! X( v) C# U' Z
" K5 l4 _& D* D0 W! V4 n3 K
//Check both variables for empty value
; A% N2 ^$ |, u* F+ Y9 Y
: w+ }# I# D) @& _, K; g
if (!empty($_POST['char'])){
9 d& e m' L/ J, ?- {% a# E
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
- |/ o* c% G9 k- O
% b% M& Z4 ^, ~+ W% D
m_szName = '{$name}'");
& e P+ J9 ~. ~9 p
while ($row = mssql_fetch_object($find)){
2 V* G% L u9 g, ?- m0 [/ v
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
0 h/ a" C0 F i3 q/ O7 G
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
. x& v( D) s9 U/ o+ e& V
: h" ^) n9 g' ]- {9 C
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
* e# O! k P4 D9 |2 B
$ Z1 x7 `: V7 ]' a! y+ `$ |
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
( l( A8 ]+ T7 S% F" l8 }5 u
: [5 z- i; K3 x
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
; `7 B5 t) [* K; C$ S+ u3 Z2 S
' \* h T" Z- W5 ?- T; m: r1 {# y; Q
'{$ElementUpgrade}', '{$ItemPierce}');");
5 p4 R6 l- n" b' I. w
}
4 @' O! o& u* `; E
( g7 \$ q/ ~" b0 s# D' l
}
* A5 E4 V7 p9 P) W
0 e+ {9 R' M; v- v, h( P+ {+ o
}
, ~/ D$ T0 w/ V/ T% {/ w
5 o5 ]% b4 E! A
$InitForm = InitForm();
7 f5 x6 S( Q! o! q. o" x2 A
$Listener = PostListener();
& Y B. d- m& Q5 X2 ~/ n
0 H6 g6 k) W/ I1 D) R) I
?>
4 r, n! B4 t& M& m; x+ f
; ]* r: N# ]$ v0 n8 W3 c
1 g% \7 W# P; [2 y1 d# y5 \- D
" W) a7 P1 G: Q* G3 ?% n
' g2 o/ j I$ P4 w% ?
欢迎光临 飞飞世界论坛 (http://www.ffwold.com/)
Powered by Discuz! X3.2