飞飞世界论坛
标题:
物品发送脚本
[打印本页]
作者:
admin
时间:
2016-1-10 03:43
标题:
物品发送脚本
<?php
) T* u9 m" z# q. O ^% V
function Connect () {
C) L* w/ o! V. W" x3 V7 ]* D" o
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
% F7 N( |5 H+ Z/ b) u
6 J# i* z; s, f: R3 f
Failed.');
0 V: T- Q* C3 l& N8 `( {0 f$ W/ j" q
}
) @; Z5 G' c5 C" l: R* O6 ]
Connect();
( X' G7 D9 b" M! `# a) f
; f' `+ o4 C5 q
function InitForm(){
* \' R6 f, d5 D' b- x2 t6 v
//layout for the form
# L% h# L# w6 D: D- ?8 ^8 R1 S( M$ q
echo "<strong>Send Items.</strong>
. U3 R; K1 R- t C: V/ i2 o1 b
<form name='select' method='post'>
; U( k2 G& }' w: ~/ r; p) n- s! A
<lable>Character Name</lable><br/>
1 @1 y% D k# u# b \
<input type='text' name='char'/><br/>
0 a: D/ X2 x: Q" v& j
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
: @2 H! o7 u- F0 m7 _0 a
<input type='text' name='item_name'/><br/>
* S2 p6 l2 k% O$ B+ }# M
<lable>Item Amount</lable><br/>
, A- H! T) |+ g1 ?1 V9 W! z
<input type='text' name='item_amount'/><br/>
3 g% H- ^8 X, y) t7 q; G
<lable>Item Upgrade Amount</lable><br/>
0 \7 a5 C0 Z5 [; M u
<input type='text' name='item_upgrade'/><br/>
* U" r3 z7 r, U
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
7 Y9 ~. G P( T$ a0 M
7 F5 V+ ^) s& i) v2 ~; |: I
</lable><br/>
$ Y& _) i9 R& E; c. P' Y; H1 ~
<input type='text' name='item_element'/><br/>
- ~/ ?7 G( m2 k) b( y% e
<lable>Element Upgrade Amount</lable><br/>
: M7 ^9 f( U9 a6 K% ^+ D0 ~
<input type='text' name='element_upgrade'/><br/>
( [ G! Z( r0 v* j5 ~
<lable>Pierced Amount</lable><br/>
( C* z" \7 L. p, n
<input type='text' name='item_pierce'/><br/>
% p7 V. ^1 z) g2 E$ A2 H# y7 T' z
<input type='submit'/>
. O! I, M' L7 P. H
</form>";
. v: s( S4 f; M: r! G
}
O3 g5 g2 s" X' s e
5 _* n+ k L+ e0 Y9 F
function PostListener (){
4 I: i8 ?1 i, E
//Add more post variables if needed and add them to initform() function aswell
" P4 n& f- d( M
$ d9 i2 Y: I I7 Q" j B
################################
; \8 N% E) ~$ j+ z( {6 I1 k" W
##### Connection and Post ######
- a2 C& D& [; E8 H% ]5 d7 F9 `
################################
5 }+ u# v3 m @$ m
$name = @$_POST['char'];
$ ^" z! i+ C3 k8 a }
$ItemName = @$_POST['item_name'];
3 u4 ~" o8 A1 E6 [% q# I2 L
$ItemAmount = @$_POST['item_amount'];
& r7 ~1 j/ e7 |' U g, d c
$ItemId = @$_POST['item_id'];
& m. _3 x1 Y2 G! V/ x( F3 o1 K0 i
$ItemUpgrade = @$_POST['item_upgrade'];
! t! V0 b& y$ w1 k! ?1 T
$ItemElement = @$_POST['item_element'];
& Q8 r7 p. {, A/ U5 {
$ElementUpgrade = @$_POST['element_upgrade'];
( w# Z: b F3 z9 q' @3 w [5 H) {
$ItemPierce = @$_POST['item_pierce'];
. T# V; D/ w) v; \
################################
( R. |9 S8 w2 _( r$ \1 a
2 f. {2 h+ n4 G5 a' V4 a% U4 R
//Check both variables for empty value
: }. j: T- O5 I! ?9 Q2 c3 @
4 F; V1 W8 y9 x2 e/ I; U0 P& ?5 x
if (!empty($_POST['char'])){
% o0 R; D( P2 I+ }6 r' x
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
$ {: ~7 U I+ n2 n9 P# ]7 \
' u! p; Z7 O$ i7 i# o3 R
m_szName = '{$name}'");
" }9 N2 [ Z M% Q+ ?* k
while ($row = mssql_fetch_object($find)){
' }, K; R: r, e9 G. a! A5 N' w
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
: g+ [9 B3 Z8 h
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
. [4 B1 m* ]# M: X
% {0 R7 b. v! ^0 U; \( s0 \
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
6 j4 F. Q! U# |& A& I8 S6 s
" x4 `4 J9 |6 p( [# c
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
3 X) D# Q; A& C! Y5 W
1 I; d( A# L2 V3 o
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
% n! R3 l1 X$ \8 ?
( L( J% p( n; ]6 t
'{$ElementUpgrade}', '{$ItemPierce}');");
K% p. y3 [" E4 b( {! F
}
5 D7 v3 B$ H+ v* b: ~8 j. U
f$ e/ i' w* q) G# M- u
}
* U+ F" n, R* z& P$ y. @0 v5 r5 z, Q
$ O7 L* V: k0 c4 k. R* b5 a% \
}
" r: D2 b. r5 p7 W5 O: Y
5 R+ z k6 G7 _- ~
$InitForm = InitForm();
: D: {, }% O9 i' ^: P
$Listener = PostListener();
4 a- P5 V% Y a- _2 `
4 _5 j6 i& U1 x
?>
) |, S3 t6 N3 d, `9 J
; }8 f7 y# |1 Y9 W. [, q
6 G" W0 V0 m& G& f+ @
% U. q( a: S$ S
2 ^* c4 R, U8 t" z7 P
欢迎光临 飞飞世界论坛 (http://www.ffwold.com/)
Powered by Discuz! X3.2