飞飞世界论坛

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

作者: admin    时间: 2016-1-10 03:43
标题: 物品发送脚本
<?php
7 u) `4 Q& b/ x- Ifunction Connect () {5 |9 l: f7 H3 N4 I4 T4 k
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB + _( ~. G3 L% T% R" E1 |* s
& h# F1 K6 O9 _
Failed.');
9 E" }+ N8 J+ ^% t) K}
' {* z, n3 o) H7 t: L, [Connect();
& k: _/ ~! v6 ?6 d" M+ U; a2 S; q* V" n" K/ h
function InitForm(){
7 Y) o' _( F: R- {; N( q' A/ U' P5 E//layout for the form
4 R3 x) X* t/ ~$ b: J2 eecho "<strong>Send Items.</strong>
( W/ y) n$ ~4 w<form name='select' method='post'>' y1 x$ b3 }1 ]/ m$ `7 N9 v% c( s
<lable>Character Name</lable><br/>
% v; l# [$ ^, U<input type='text' name='char'/><br/>
5 s& C: ^! q1 N  ?/ C+ ~4 C<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>" z4 N  E6 L; C
<input type='text' name='item_name'/><br/>
' v$ D# _5 ^" ?2 G+ u# {<lable>Item Amount</lable><br/>
/ Z1 A* i3 e, w/ {<input type='text' name='item_amount'/><br/>
, ~& \: w. C* P# d8 \* t<lable>Item Upgrade Amount</lable><br/>$ Q0 a+ \" [9 J- p
<input type='text' name='item_upgrade'/><br/>" h; `, F5 I' R4 X+ Y, f
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.). W' w0 |, X" r' f1 Z

3 L8 |) x- x- i</lable><br/>
  x3 l  A8 J  r, y# f6 g<input type='text' name='item_element'/><br/>+ t5 R3 c/ \% ]5 Q& D
<lable>Element Upgrade Amount</lable><br/>. u  b% j$ T2 n+ L- g  ?- F' a
<input type='text' name='element_upgrade'/><br/>
5 c6 d3 Y! h5 l<lable>Pierced Amount</lable><br/>  V, k" w8 z, y. i  {$ j8 ~
<input type='text' name='item_pierce'/><br/>" N% j" _7 A1 v" ^( O
<input type='submit'/>. K* B* _9 N. |# e: x6 J* ]
</form>";7 h. x: N7 z6 y5 L$ c# z: G1 Y
}3 m* y- B* @$ Q$ |# C& ?6 T2 }

. y* e. L6 f* a) n& c* V" Y' Nfunction PostListener (){  a0 ?  P1 P% {( I2 ]0 H5 |3 _
//Add more post variables if needed and add them to initform() function aswell, e0 b& m- `% d+ i
  |/ G; H9 b2 }' f# E& m
################################
  U" J9 _! h  z- v##### Connection and Post ######3 k: F( W* }/ {3 z# @
################################
% l' m; e2 ]. L" T6 P$name = @$_POST['char'];3 ?7 Z: c$ P* A2 _
$ItemName = @$_POST['item_name'];
$ k8 `4 P* u- ?$ItemAmount = @$_POST['item_amount'];; `. d1 _( r1 b. O9 \! c
$ItemId = @$_POST['item_id'];6 Q7 \6 I$ ]$ a
$ItemUpgrade = @$_POST['item_upgrade'];
1 p  N7 v1 W- n6 c$ItemElement = @$_POST['item_element'];
" V# g, k3 ~" q8 i. X7 k$ElementUpgrade = @$_POST['element_upgrade'];
7 m8 d1 o% R$ p$ItemPierce = @$_POST['item_pierce'];2 }+ }' t5 U7 o8 h4 P! P! j' k
################################
9 U7 k0 a: H# c: v3 i  D5 R+ S$ a/ U& C+ T
//Check both variables for empty value- V' A- c4 x7 l1 J$ {
! f! n! K1 x% k0 l7 s
if (!empty($_POST['char'])){3 F6 n4 D4 b" M- G. R* Z3 I* e
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
/ g7 b- i$ s+ V+ `9 G5 O( B/ R4 r7 C& K) Y7 X! n
m_szName = '{$name}'");/ ]9 T1 T) U$ m7 b. u
while ($row = mssql_fetch_object($find)){, d5 I8 O5 M& k( ?+ C
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";1 n# z1 [  D! I2 K- N8 @0 s1 h
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 4 }# R: J0 }/ C. }# ~8 e/ E

$ X; g( @+ l4 v3 P[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], + |5 x$ `/ I7 B( m
) G) [6 M2 i$ u5 V9 ?5 g, y0 a
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', ' E  a% k2 M2 `% c) Z, m: I% o
' l( q! L# K3 |9 w( `2 [
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', . ?1 R7 r5 A) x( L

% Q: d9 K. E: {9 c$ X'{$ElementUpgrade}', '{$ItemPierce}');");
9 S- N2 y+ c% X+ U4 ^}
/ c) ?  K. ?/ k# l" \4 Q  \" X9 d* O( o0 S8 C
}
& C# E) i! C( x3 ]0 W) F  w3 o! u% R% v* _& }% Q
}
" ^! p  ]" O8 f$ d! I! V* D$ ~9 s& ^  _5 ]1 Y# U1 {& A1 v
$InitForm = InitForm();
- Y- w& ^3 ?* W$ f/ H$Listener = PostListener();
: G5 I& ^- f. s: p$ @5 e
+ K- }6 E5 W+ Y1 a8 C?>; [* Y8 G+ {& e  n

- T1 J0 U+ I. @7 h& m7 t3 k& u1 q, o! J0 S3 [, \/ w0 Q
( K: Q5 u; n0 o% c+ R0 H3 Y

9 p5 r9 K, ~9 l1 B




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