飞飞世界论坛
标题:
物品发送脚本
[打印本页]
作者:
admin
时间:
2016-1-10 03:43
标题:
物品发送脚本
<?php
8 v2 N4 q& {5 I1 y2 x
function Connect () {
$ y t5 r. J, @5 k& {0 D* t
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
8 R3 }+ q1 ` G% d6 ?
; L) x. s& r! A9 Q1 M& e
Failed.');
* R U- X, g9 I8 r7 x' {, H
}
+ z& p8 V, K, R8 ?, W; p# @
Connect();
+ K+ n. {2 t e2 r+ }
* v& K+ y# Y5 C4 z: @2 ?
function InitForm(){
1 S6 E4 |% [8 N4 X) I% c9 o! B8 M
//layout for the form
3 g% ?/ w+ |5 o0 I) e |6 N
echo "<strong>Send Items.</strong>
% x+ L; S7 ]( m) f/ J" a) r* f
<form name='select' method='post'>
/ q; A' Y* H' x2 V
<lable>Character Name</lable><br/>
! x3 { ]* x2 V+ q8 \& M
<input type='text' name='char'/><br/>
A3 |" J" F! Z t
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
- f6 x: N. ]- u( N
<input type='text' name='item_name'/><br/>
* b9 C, P" W$ M! y l; V+ K* o) e
<lable>Item Amount</lable><br/>
9 j% I7 H% l$ s, q0 {) D! E, m* J6 k
<input type='text' name='item_amount'/><br/>
1 }4 m/ F0 X$ q5 K+ R; O
<lable>Item Upgrade Amount</lable><br/>
8 }* f: j' G9 c( p
<input type='text' name='item_upgrade'/><br/>
! ]2 Q" Y, d* n5 ` I9 [' }
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
- S" L K' N3 ?% c% z, H
7 g; \! D* ]0 w4 H. c
</lable><br/>
4 P) R' Y; A/ b, n! I3 \' ^- [
<input type='text' name='item_element'/><br/>
2 O8 G3 Q7 h F; |1 t7 {, e
<lable>Element Upgrade Amount</lable><br/>
. G, Y9 z r: U$ T) R& V
<input type='text' name='element_upgrade'/><br/>
# p% _8 X3 l: e. V
<lable>Pierced Amount</lable><br/>
4 F* U+ Y2 z0 U+ ^4 @6 U5 J2 t
<input type='text' name='item_pierce'/><br/>
* l/ \) G, d9 v' h8 H) U, L/ ]$ B
<input type='submit'/>
1 o3 Y: L# B/ @' N" U" k% [4 A4 q
</form>";
) C0 H8 k m2 }3 v2 t0 C
}
( G6 Y- s, j% N \( y. Z
3 a9 ^! ~" @: Q$ h6 A( ?! W
function PostListener (){
! W! n; V% E- c: a' h
//Add more post variables if needed and add them to initform() function aswell
9 b# K u' R) Y1 V9 W$ l
/ x( v# r% y6 M+ n% b
################################
* Z7 R+ D& }2 i' A
##### Connection and Post ######
6 J9 j, S5 k" x6 m0 ^
################################
6 P9 v& `% J- m) k* F7 }
$name = @$_POST['char'];
# S5 O& |1 {4 Q9 u7 ~
$ItemName = @$_POST['item_name'];
' l3 c! d1 @9 a: Z
$ItemAmount = @$_POST['item_amount'];
6 _2 W0 ?5 V% K
$ItemId = @$_POST['item_id'];
9 |8 k2 Z, R, A! m. D9 y; Y
$ItemUpgrade = @$_POST['item_upgrade'];
4 O: K5 k- t, m% R# q
$ItemElement = @$_POST['item_element'];
7 a- w6 N; a5 o! a4 f+ v
$ElementUpgrade = @$_POST['element_upgrade'];
" H; H. E* D9 d0 g- j( k1 Y
$ItemPierce = @$_POST['item_pierce'];
, u, K# Z' ?! e: q
################################
4 Q: O3 m( C& O. V2 S% j; P& X
/ l9 ?5 H% l5 z+ ^/ @
//Check both variables for empty value
7 @- A$ ^+ }. v4 G3 B" V, }
: h1 t* J8 S: {2 y! J6 Q+ X
if (!empty($_POST['char'])){
% F2 |( e* b$ r$ l5 |
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
5 k m) n+ ^( Z( Y D! |
, e: a- h+ @/ f. s7 N
m_szName = '{$name}'");
, I- t1 `' ?! Z" t
while ($row = mssql_fetch_object($find)){
4 B6 Q- E' h2 J) T. K# u: Q* @
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
: e$ {3 O" P, w1 u: u6 _% W
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
; c# C0 n; ^3 p3 |
$ a( D: o( w1 D- Z1 p
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
i9 ~7 v+ }7 q; ?' i8 L% S, }
: G, C Y# c2 [1 q* \1 X$ ]
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
, h, l8 Q) z. u w+ Y1 @
: ]5 G5 t" W G0 R9 F
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
5 M% Q8 J6 L' q7 u* B7 y
0 R& I9 c/ C$ t
'{$ElementUpgrade}', '{$ItemPierce}');");
9 m. j9 T5 A4 u; {1 [% _ f
}
7 \ p; m) a* F2 L% {9 k. ~
! F; C8 ]2 K4 Q
}
4 R2 N' q7 ?* v9 \9 P
4 ?) O B5 F, x9 M9 d
}
% v( _5 |' Q: L6 k
2 q+ ~' j% } m! n; N
$InitForm = InitForm();
4 w4 j! v2 _( R/ x5 T P1 n
$Listener = PostListener();
, t, k7 n% p% l+ w& H( `1 x
+ `! [. _. }1 o: w/ w) Z
?>
7 b, p) E; E2 H; c2 N6 j9 b$ I5 z
) p1 N4 c; L9 L( E7 u; |
0 V( n% `6 y. N- |
$ t/ [! I# s" ?) K! ]6 r ?, q
p8 W1 b5 p8 p' t2 W
欢迎光临 飞飞世界论坛 (http://www.ffwold.com/)
Powered by Discuz! X3.2