飞飞世界论坛
标题:
物品发送脚本
[打印本页]
作者:
admin
时间:
2016-1-10 03:43
标题:
物品发送脚本
<?php
; }. E0 W: F9 s& B/ V
function Connect () {
7 K- V0 u' e# B' ]* [; t
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
: d) S# H; Z3 S4 N
* o2 x# e$ @7 y) Y
Failed.');
& E; e: N, u+ i1 ^) J
}
5 R4 ]- r# J' P& h+ J9 y$ c! `
Connect();
* |/ F0 M; H4 i& i! G/ Q6 h
* w- n7 d& H0 M8 B3 D8 y
function InitForm(){
( F. B! B* B2 M5 H& a1 U: k
//layout for the form
5 f+ J; Y, T' o# r v9 c; u
echo "<strong>Send Items.</strong>
" Y) y7 H, R* M' k- O: e
<form name='select' method='post'>
- k2 x1 a( b" w9 q5 g4 ?' U. R
<lable>Character Name</lable><br/>
! p1 l& A y5 `
<input type='text' name='char'/><br/>
3 f8 h# ~) u9 b+ G
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
+ l: N1 H6 @6 i/ @) {: D) f
<input type='text' name='item_name'/><br/>
* U5 o9 x+ C% [+ w( r1 F1 D9 H
<lable>Item Amount</lable><br/>
7 e, z7 E H- ?5 b6 e. _
<input type='text' name='item_amount'/><br/>
! [ n+ x' y8 A. b" ]9 B
<lable>Item Upgrade Amount</lable><br/>
3 H5 Z! t! J4 |0 a
<input type='text' name='item_upgrade'/><br/>
" q& L+ e1 ^( _( H9 m7 g
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
8 T5 S! u: F8 L# d
# M8 Q6 | v1 Q9 }7 g) c% f
</lable><br/>
* ]; y5 k- G; F2 }
<input type='text' name='item_element'/><br/>
3 ~; K' ]* \ B$ T+ ]# }4 A. B
<lable>Element Upgrade Amount</lable><br/>
/ X. @7 Z0 a4 Y* e( L
<input type='text' name='element_upgrade'/><br/>
/ \% Q% m8 h _' ]" M6 X4 N
<lable>Pierced Amount</lable><br/>
2 F# \3 u) k- [0 t6 z
<input type='text' name='item_pierce'/><br/>
& j) G A4 r+ t
<input type='submit'/>
1 y r4 r5 R3 k# B
</form>";
8 p1 q- P3 l/ E4 y
}
) Q# a9 H# L/ k( n& h# y) `' @- p
+ t. B/ o" Y5 W: X5 [
function PostListener (){
+ ~0 [ I7 L3 H* ^
//Add more post variables if needed and add them to initform() function aswell
1 j: } ?- Q X4 z* t% Y
, H- ?! v. V6 ]( C& |" K" J
################################
: q0 S* c- v7 N- l3 J
##### Connection and Post ######
$ p# E; t, T4 ]3 W9 a/ |2 w
################################
+ I* d" ?2 S8 \
$name = @$_POST['char'];
0 P6 I1 I" j2 S# V. O9 F$ {( }
$ItemName = @$_POST['item_name'];
- Y; W3 u3 i0 J$ o; Z8 L1 G
$ItemAmount = @$_POST['item_amount'];
' F) C0 N, g3 `5 ~7 V
$ItemId = @$_POST['item_id'];
; j$ k. B2 W# e/ N8 w% h3 X% _2 L
$ItemUpgrade = @$_POST['item_upgrade'];
. c9 q$ w" f( O9 t1 u
$ItemElement = @$_POST['item_element'];
. R- b W' S- E2 N& `* e
$ElementUpgrade = @$_POST['element_upgrade'];
2 v" R( q7 A) u8 h- D- y" o5 a
$ItemPierce = @$_POST['item_pierce'];
% r( y; i6 S0 v* d; `- O. O
################################
( `+ O+ q2 P$ z0 e% H+ b
. [9 Y! C+ n& ~# D* `- h
//Check both variables for empty value
- H2 a+ h3 M1 h* g3 ?
! L! d( s/ S; u8 b- ^
if (!empty($_POST['char'])){
5 Z$ v/ _( s0 T8 X9 h3 Z
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
, n6 o- Q* d- d% e
: E' `2 T, W5 j: C% I, J
m_szName = '{$name}'");
+ m: L6 M9 ~; W# J
while ($row = mssql_fetch_object($find)){
7 q F) f* ^8 P7 B
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
3 e& o) f8 _0 z% T7 j" _
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
# H7 i% S3 d$ g9 w. S/ Z2 y
3 P( h3 O2 B( Y5 ~" v
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
8 l0 f+ x a1 s, J" A% J/ U8 S# O
( u' S0 o/ b6 w1 y
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
. {5 C. F [2 e* R) c1 Q3 U
0 H9 D7 x* s2 d# h. c7 d& Q
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
& I7 {6 _0 n0 n% g
2 I2 ?" t) X9 H% O) {& c
'{$ElementUpgrade}', '{$ItemPierce}');");
; u2 U/ S* q9 s4 {. V& h/ F: y( J3 t
}
. s" ?3 T: t( N# A0 P
* I" r2 m+ k; Y: g2 u
}
{1 _3 l' ~/ }7 C$ X( R
/ i. H" {+ o3 h- P9 o( [
}
. j: q' W! Q2 C8 B# a
5 E$ J0 O: v' `& T3 H
$InitForm = InitForm();
& |2 ]/ e- e3 {' E* o- j
$Listener = PostListener();
+ F1 T- G3 f: ]+ L5 [' \
7 j7 n- T. T/ X; L- W2 y
?>
- ~1 c6 q8 T# T9 R7 \
$ G/ O* r4 y' _7 _8 N# _/ ^1 ?
) s% ?$ Y) L' V L8 v9 T
- B5 y& L. C d. l- R& _: A1 z; o
6 Y( \9 E) {' t# R: s7 A5 e* l
欢迎光临 飞飞世界论坛 (http://www.ffwold.com/)
Powered by Discuz! X3.2