飞飞世界论坛

标题: 物品发送脚本 [打印本页]

作者: admin    时间: 2016-1-10 03:43
标题: 物品发送脚本
<?php
% F! G$ q- u( c3 ~' _function Connect () {
' i( D) g5 |+ @0 [$ c7 j: J5 Tmssql_connect('Server','UserName','Password') or die('Error: Connection to DB
8 ^8 G5 Q3 o7 H# }/ d. {: u; y- J4 w4 p" H: b
Failed.');
) N+ |( Y  l9 d1 q9 Y}! x; s6 m/ V$ E( J
Connect();
+ h/ g9 b% t4 L8 X9 s* `* y1 L
  G; ^7 f( F5 o4 d+ B; c5 _function InitForm(){+ V! ~& t7 Y; c
//layout for the form" }4 |$ @/ G# Z# X% }* j1 k
echo "<strong>Send Items.</strong>% K, }8 H9 k' N5 F" s. L' ]# l+ f
<form name='select' method='post'>
0 ?, E! H% M. @9 ?: W<lable>Character Name</lable><br/>8 e+ Q& U; {9 v) o
<input type='text' name='char'/><br/>1 G3 U- c. }: J
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
8 o( e% p: L' M+ H6 v! f! @8 v<input type='text' name='item_name'/><br/>3 s. o" K/ B) j. n- n% {6 M
<lable>Item Amount</lable><br/>
; u: E9 d* [/ y7 a4 ^0 \+ P8 C<input type='text' name='item_amount'/><br/>
, H+ k: [8 w. b7 e6 l+ p+ ]<lable>Item Upgrade Amount</lable><br/>, |4 _+ F, M7 G3 W+ V9 k
<input type='text' name='item_upgrade'/><br/>
4 h. A+ j3 O6 k% q8 ]<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)0 E+ E9 H0 k# U& \

- c, m* V( V' C& k4 Q7 f</lable><br/>
2 }) \- {+ {  H% C9 d; E: V0 J- H# b<input type='text' name='item_element'/><br/>+ A' W. O; b. L8 K7 B' N
<lable>Element Upgrade Amount</lable><br/>
& b3 Z! ?5 w9 {" C- ~- z  q+ E<input type='text' name='element_upgrade'/><br/>+ f6 E8 o8 n1 f$ }/ F9 h5 W5 d
<lable>Pierced Amount</lable><br/>$ l( P; x  l4 \  c2 T3 P/ E4 v
<input type='text' name='item_pierce'/><br/>) n& e7 o- D% x9 D9 h
<input type='submit'/>5 F2 K8 }  Q% e
</form>";
, T8 n3 a0 S& ~}3 B  x% `; o7 ~5 o+ O1 y
8 f3 B/ W& L+ S& ~
function PostListener (){
3 J3 {* _' S* R, r+ m+ @! t6 B//Add more post variables if needed and add them to initform() function aswell
5 D! S8 Q7 P6 r# |$ P
# \6 V& v0 G; O9 C" R################################( ~* k' {2 H- g$ n! l9 i
##### Connection and Post ######
* n- Q3 I9 J; f# D" k1 `/ d" a& x################################' q$ P' n) b  j% a" b$ W$ D
$name = @$_POST['char'];
! V; H! _" r, F. i2 n$ItemName = @$_POST['item_name'];
$ B  e" l: k8 e! n. Q- q: M& k# v$ItemAmount = @$_POST['item_amount'];
* U4 z& r8 H% Z. B$ItemId = @$_POST['item_id'];
3 I; y% E8 H2 ]  U7 h4 ^% [, \$ItemUpgrade = @$_POST['item_upgrade'];5 z7 x7 w8 V; T3 r: i0 ^
$ItemElement = @$_POST['item_element'];
$ s& v6 H1 C5 v: X9 p8 ~. `  V" X$ElementUpgrade = @$_POST['element_upgrade'];
% T( w" @. b, P$ItemPierce = @$_POST['item_pierce'];4 @7 V. Z( i2 n" r. X' ]
################################. T; b$ j; N* x. ]+ {* p3 u
0 |! S* c: s, Y8 h3 O
//Check both variables for empty value
3 s: S# h6 \- l8 r  M5 b% m/ K. C' M
if (!empty($_POST['char'])){
% X8 J. m. C+ b2 s  d5 a$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where 2 k; s  J+ b; z
, g: |/ B) M. Y2 h/ F6 c
m_szName = '{$name}'");+ @6 |3 P7 S  w0 ]7 F+ f
while ($row = mssql_fetch_object($find)){( B  t2 t. p# {8 H! j% k: N
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";, e+ N. c+ x/ z  v, o+ a
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 4 w  c4 e3 t" i  W! h( h) J5 {
6 Y( f9 R+ b% Z1 g# D7 ?
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 9 i. o6 R5 J' E3 @7 I8 }' v; r
3 g% j; B0 s6 e& X6 F
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
9 `+ r& r% ~; _2 ~6 s6 w% n  a4 b  b( H- W
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
8 H7 W$ }+ c) V; V1 H/ X
; j/ ?: U. q5 K0 Q( U1 q* K+ f'{$ElementUpgrade}', '{$ItemPierce}');");; ^1 J3 e6 y  r) [, X
}1 M- F; f' Y2 v& p( T
5 F/ U- f' a! B: k( a. \! C- _( l
}. M4 y# L7 t: I" S+ f
0 F3 _( R; i' X: @# C$ K" M3 J
}: U/ n$ {, @: f, V  D

6 ~. h  h4 a* \$InitForm = InitForm();
3 T- H% n+ b+ V2 H1 v$Listener = PostListener();
% E+ O; s- t) b  X
3 Z4 p* t+ _2 V/ y( L* @5 w?>
8 Q% p3 K/ V2 w+ |  f( l+ Y" }- Q/ ^3 S

3 n7 c  K! k: J. }7 g; E- k$ @2 l+ k
' I+ Q3 Z. W. X5 D1 W6 R" R5 _3 m





欢迎光临 飞飞世界论坛 (http://www.ffwold.com/) Powered by Discuz! X3.2