飞飞世界论坛

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

作者: admin    时间: 2016-1-10 03:43
标题: 物品发送脚本
<?php
5 E3 \' }* `; |- `/ V, hfunction Connect () {
2 c/ R% D9 a/ @2 m$ w$ a6 }9 `9 zmssql_connect('Server','UserName','Password') or die('Error: Connection to DB * I3 K# t' i6 ?8 N: {+ K
* q, A- n/ F. N& X, D$ N
Failed.');
( p& D* G2 y' X# e, x& _}6 l, p8 g+ N( Y$ L4 k; l, E, G& Y' k, j
Connect();
& x* q( l) Q8 s0 K, P4 B& q, l8 x0 \; N* O
function InitForm(){" l1 R5 g. v, \0 H# r% W, S
//layout for the form
* t5 ?6 T( U7 oecho "<strong>Send Items.</strong>; u, c* V* N7 H) K2 n! `3 m
<form name='select' method='post'>
# z( l2 ^5 U) P) ^<lable>Character Name</lable><br/>
% \" v+ w, C. @- p<input type='text' name='char'/><br/>
5 v1 G. ^0 m6 P# n5 U5 h<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>9 f: x7 R% \: I4 O- V
<input type='text' name='item_name'/><br/>0 b0 y& r( O  V0 t* e$ m
<lable>Item Amount</lable><br/>
  A( b4 i0 M  x2 A7 W<input type='text' name='item_amount'/><br/>7 k! E0 a6 N/ g
<lable>Item Upgrade Amount</lable><br/># ?3 Y5 D4 S4 {* t, ?' @
<input type='text' name='item_upgrade'/><br/>. a. m' x3 \& s4 l' x# v" t
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
9 n. T9 h, C$ F# Z2 _
' d. Z; {3 s! W  q# ]7 j</lable><br/>% e2 ]9 H- m' b& }& a4 q1 f- l: r
<input type='text' name='item_element'/><br/>
9 b8 Y# L$ _8 [) W8 W8 j8 X4 ?" b<lable>Element Upgrade Amount</lable><br/>, B# L1 b( `; N3 S% n0 c' ^. v
<input type='text' name='element_upgrade'/><br/>
+ R2 n2 w* X" I9 T! K+ n8 M" V2 ?8 X<lable>Pierced Amount</lable><br/>
% V, O, Q0 p  ]- @' K. e: `8 F$ |, U<input type='text' name='item_pierce'/><br/>
9 ?8 ]' i+ J, v<input type='submit'/>
  L  v+ [& `$ Z: d6 I</form>";
  {8 M9 [8 B! _) f# ?}& K  S: A# [3 x+ S* f3 t9 I
4 _, j( y2 d: H$ |& p; A# B+ \
function PostListener (){/ O: P" |+ {; V* d$ {0 z
//Add more post variables if needed and add them to initform() function aswell$ {' _2 w1 r8 S" n( b, C5 S  @. @

, f9 D, n- }( V/ |; d################################! p. A, n. H0 F3 C( C5 i; t; |+ ^
##### Connection and Post ######- ~8 }2 U: N7 v" d
################################/ o. X7 F2 y5 g* l; h
$name = @$_POST['char'];$ s/ Q' u# j. e$ n5 v$ [3 \% g  M
$ItemName = @$_POST['item_name'];
7 k: h3 _- S# ^$ItemAmount = @$_POST['item_amount'];) S6 g5 S9 o! Y% ]" N
$ItemId = @$_POST['item_id'];
, O' s' J: C6 K: i* A) j2 C$ItemUpgrade = @$_POST['item_upgrade'];3 M8 m* x, l, s# `9 Y! d& ?3 K
$ItemElement = @$_POST['item_element'];
& _* Z! o* H1 f, l$ {/ T$ElementUpgrade = @$_POST['element_upgrade'];1 r; Q3 U; D1 {! T/ O% v) h
$ItemPierce = @$_POST['item_pierce'];
0 {% p' f+ g4 }+ C################################
$ ~6 Z& [% n- L9 ]1 H- j1 {2 v7 F9 d) B: G  w1 }9 B
//Check both variables for empty value
; G! q  @  y: v3 R) z/ [( g, u9 P' p; a  e0 y9 p( a
if (!empty($_POST['char'])){
9 p8 r! g/ M$ g3 q9 B" }4 O$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where 4 A1 h! P6 M9 l( n$ s# Q
( A, y- `: n& C' c' t6 x
m_szName = '{$name}'");
0 A' }. w* L/ a% ^; ~+ q* c0 A. |# Mwhile ($row = mssql_fetch_object($find)){
: M6 {1 S- `! ^8 G  F- eecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";- K6 b/ s$ F+ B$ N2 \) K
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], . Y3 n) T; N9 J, Z
; i: a% M  D* m2 ]: M1 l% Z
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], ' ^) u2 w3 e( v3 c5 h4 _* Z

& q! I; g6 `: M$ \& H5 m[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', / T8 }; l$ y) T3 z1 y$ d2 e! @

* w. o( m: B: `N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
. I, {* @& H+ K2 {$ }. s5 ]5 b/ O; {) M+ l$ T
'{$ElementUpgrade}', '{$ItemPierce}');");
4 {- u6 `$ O) W8 D$ G* l8 R}0 |2 D# l9 p0 k. |. d+ Y
! U1 v( h. j6 e( E6 v2 c8 z! I
}
4 C3 B$ H" a. G7 i" r  S
0 [! J; W5 q' \  [" o1 f' v}3 W+ N+ f% P' e! f3 x- t6 w
* K3 c! [; S  m0 }( p
$InitForm = InitForm();4 E9 [  e/ v. p) b2 X$ L, ~4 T
$Listener = PostListener();3 K0 \* }9 h/ v) U) R! M# c- P# @' A

. z' W% X( q4 F  \# `?>* \; x6 U5 T" C% J7 o; _

& i) g* s- \3 a( i, h! f( X5 S* O7 j6 d9 E) w5 X  W6 Z

# v) [. ]! A* C, T! N* z9 s' c8 n/ g$ [8 C7 `% U* T+ C! F





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