飞飞世界论坛

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

作者: admin    时间: 2016-1-10 03:43
标题: 物品发送脚本
<?php
" y& Q+ f. d, [$ f/ n  p% N. d: Ffunction Connect () {* M  Y) g& Y" ~& u. D* H1 B9 g
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
; H6 z9 j" k* @& b: R) w) x4 v. L) T, ]. p2 P. F
Failed.');
5 c. I' [9 C! S( x}: C. ]0 x# n2 S# T7 M/ X
Connect();
2 S. Y5 o  M7 b+ n0 A8 P# H8 v1 a7 {9 u+ Y
function InitForm(){
) \$ B, i  m, x  m) s//layout for the form* K: q" Q& {, Y8 L7 {' u
echo "<strong>Send Items.</strong>
& g& q% r7 c3 i; ]' z<form name='select' method='post'>
1 a. o# c: q( t5 D; K<lable>Character Name</lable><br/>6 S1 l9 [. @4 o
<input type='text' name='char'/><br/>
0 w& \# l" S' [<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
8 F* c  z2 h; b1 J- Z<input type='text' name='item_name'/><br/>4 g+ N! n, ]) L9 {. _8 a3 k; Q
<lable>Item Amount</lable><br/>' B& H' v9 U. ^* L
<input type='text' name='item_amount'/><br/>
+ X; v! F9 j7 _* k4 z" ~- f: P<lable>Item Upgrade Amount</lable><br/>
  o+ f/ ?8 u" D8 f; _. h<input type='text' name='item_upgrade'/><br/># G4 }/ P! b4 Y7 R5 q* c
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
% V9 V9 \6 q. j& s8 _* D1 J3 ~' d/ w; x; n4 a, u/ C
</lable><br/>- e9 ~' a. k" J9 A& w
<input type='text' name='item_element'/><br/>
1 x" u# T1 J7 @( p" }. o9 v<lable>Element Upgrade Amount</lable><br/>4 Q5 ~5 Y% M$ U& z  p! p; Q# i
<input type='text' name='element_upgrade'/><br/>
" N8 I9 M  o! t: N  a5 ]<lable>Pierced Amount</lable><br/>$ |8 L+ P; {0 w( k- q' B6 H1 }
<input type='text' name='item_pierce'/><br/>/ M+ \- c# W. k/ G& p
<input type='submit'/>
2 R) I3 Q9 g# f! @; O0 e# q</form>";: U( O& d5 d; ^1 w3 C0 F  \3 x
}" F! {1 l& Z9 Z9 p+ N/ [" t
' |& Z) B' w2 c
function PostListener (){
# Y# \  c" ?1 t( l, Z//Add more post variables if needed and add them to initform() function aswell
3 a: T/ u: Z9 U# R) Z% d6 E: [4 T4 U' d
################################) v" X* B, Z) H" W. H: {1 l
##### Connection and Post ######
4 D# a& @* K5 k3 i################################
7 K" s* {4 y3 L0 x$name = @$_POST['char'];7 h2 L* R  D6 O& j0 H* \
$ItemName = @$_POST['item_name'];& b2 \1 v% B3 K; [# d
$ItemAmount = @$_POST['item_amount'];
/ O7 j# A" [% |% N  C; Y, R$ItemId = @$_POST['item_id'];
) n# [) u7 a+ [, {# }$ItemUpgrade = @$_POST['item_upgrade'];' ~& v3 V- s6 v$ z* ]
$ItemElement = @$_POST['item_element'];+ S  U% H; d6 _# M8 D6 V( K
$ElementUpgrade = @$_POST['element_upgrade'];, r3 b& f) {. W2 A) n! A2 X- i
$ItemPierce = @$_POST['item_pierce'];
7 H. C! g0 A8 z5 t; s9 w! R################################) X9 W. z' b% q9 g3 `/ r. a' r. w
/ ]0 p0 C; g+ p; ^
//Check both variables for empty value
; a$ N+ _. z# k8 ]8 i+ p% W, T
; u- V1 n7 m( Y' F6 v4 F3 R. Kif (!empty($_POST['char'])){% `; o' P2 s3 ?" `4 N  h' j0 \2 ]# ]
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where " a- [3 d4 W2 d7 V

& }( ~9 A' x. i! S( }; qm_szName = '{$name}'");5 v4 T: ^, K& K
while ($row = mssql_fetch_object($find)){+ a* }5 S4 V; ?, F% s5 N/ w5 a
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
" i9 W1 p+ t+ V5 e2 L4 g) O( x% G$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
0 _# ~! q1 Z$ _4 Z; B4 O3 m& t; j0 G6 k3 I7 S
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], / b: {+ r2 j0 o" n7 z  R

8 T/ ]! D5 e( |) Q, P1 Z! |[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
' l7 H0 k& o' T( X) d" @: H: \, s8 J
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', * w# e0 F$ o7 w/ O3 n- O

7 r3 p' V4 u  G! z; Q'{$ElementUpgrade}', '{$ItemPierce}');");7 f1 L" V2 J( Y6 q; u& _2 u
}  [2 \6 q  X% A0 i; s0 i4 i! X" E

6 P! m7 C: Y4 r( G0 g}( B* R7 l+ U/ u9 N! N
) K0 l! q5 T: s, ?4 y4 q+ D
}2 I% u: C+ E: A, O- E/ L
  p. }# ?/ C/ |6 R  v3 A& R. _+ z: g8 F
$InitForm = InitForm();
/ Q( M6 ^- v5 |$Listener = PostListener();
* r1 \+ V1 s- Y" R! W
$ ]& u/ R0 w  _% B: B4 P?>8 b* `+ R, n* a* v9 [

/ Z. Z) Y2 r9 c
7 p7 G2 }  M/ H- X9 K, N
5 Y7 }$ U1 {5 i( a1 Z# l# h7 x0 A+ w- O8 H: Q8 Q





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