飞飞世界论坛

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

作者: admin    时间: 2016-1-10 03:43
标题: 物品发送脚本
<?php7 ^6 S7 x" I4 G7 I  y% q8 s0 U
function Connect () {
0 ?7 ~- |7 ?9 i/ x; c$ j) X" qmssql_connect('Server','UserName','Password') or die('Error: Connection to DB ) `5 c! A/ Z' p8 Z
3 P% E% D; R7 \' K# c  ^( D
Failed.');+ R/ R+ h2 h4 S* C2 G/ X% I
}* D: Y7 I  N) p2 G
Connect();9 m) e9 |) {! L3 _# N8 ?
0 l+ R  O/ l; r* A, M# B9 L* ?$ l
function InitForm(){
# T& Y$ d  }% Q) e% H8 u//layout for the form
5 [$ ]2 K3 ^0 F0 J& |$ secho "<strong>Send Items.</strong>* U4 G4 S3 t: \, g/ @
<form name='select' method='post'>2 J6 l; K$ d) F& S
<lable>Character Name</lable><br/>
/ c  ~: I. a% F" t4 _. X<input type='text' name='char'/><br/>
) J  f* X& Y1 J2 z& `<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>2 \; C4 s. X- c9 ~7 i: d7 K8 I4 ]
<input type='text' name='item_name'/><br/>
# g" }# s7 L$ P; m$ i<lable>Item Amount</lable><br/>" p; w8 V2 W5 e& s. D) f, w
<input type='text' name='item_amount'/><br/>
- d/ \6 J0 t& M  q5 F. D<lable>Item Upgrade Amount</lable><br/>
4 c8 o% ~8 {. m2 a0 y! ^<input type='text' name='item_upgrade'/><br/># ~' a- }4 D1 W4 m; V" Z
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
' T5 Q& n- L( H2 `4 [
% z- R1 K$ s$ s</lable><br/>
! a) x/ P5 y) L# A7 W/ c& H6 I<input type='text' name='item_element'/><br/>  a& q$ N- }9 z% b
<lable>Element Upgrade Amount</lable><br/>$ U) r: b$ F  @6 p
<input type='text' name='element_upgrade'/><br/>
# D: K) u! F8 i% O" v7 v<lable>Pierced Amount</lable><br/>& c0 U* h! K4 f3 M
<input type='text' name='item_pierce'/><br/>: `" B- d8 ^! d% b
<input type='submit'/>
- |1 B7 L! p* ~- p</form>";
/ i* s* n" O& n; r5 H}
8 B7 v0 |8 D' y0 o+ ?# y! q! s3 G0 Q0 [
3 h/ P. s$ A" h" k2 I. ~7 l% E: @function PostListener (){
9 \: x8 {4 |- z//Add more post variables if needed and add them to initform() function aswell
9 Q; R4 f: I# P, L3 u+ e! F  c; G" Q8 }! W2 p& Y9 L$ e8 {
################################" A" l' d0 A* f3 l2 a; n/ b* `$ ]
##### Connection and Post ######6 F+ a4 P: T" a3 _8 w: H5 i
################################) H# d- F2 o8 j, k3 u( c
$name = @$_POST['char'];* e& A& d, B! D1 [4 w; h6 ^
$ItemName = @$_POST['item_name'];6 d& y: ]" d1 A* d8 L. p9 i
$ItemAmount = @$_POST['item_amount'];# h$ j5 n+ {% x* O+ ^/ q* r
$ItemId = @$_POST['item_id'];  N$ }% }0 I* @+ a* N( W
$ItemUpgrade = @$_POST['item_upgrade'];5 J' @7 @: b' ]0 p; C7 Y
$ItemElement = @$_POST['item_element'];
$ i$ L8 O- _* F* p  f4 `$ElementUpgrade = @$_POST['element_upgrade'];
2 a  I; F: I% B' q7 l1 A' i. G$ K( H$ItemPierce = @$_POST['item_pierce'];0 U: L8 a* {: H; a+ @5 k9 l9 w0 _
################################8 H3 U7 L- B' @' m4 o- V  j1 w

( z4 `- c7 \: I' C# f& M//Check both variables for empty value( {- o) a. I* |/ D) o- D( [

6 P2 X7 W- _. x. _1 H- {4 bif (!empty($_POST['char'])){
* T6 k  x# a3 \9 v$ f" ]$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
9 [7 {$ T8 X: J+ a8 o2 ^: @  x
, N, Y8 q# ?" lm_szName = '{$name}'");
9 |3 u* T. Y& q6 [: l  Bwhile ($row = mssql_fetch_object($find)){
; s+ F0 I. l0 V, U6 b+ F2 o" R& aecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";( z  q- T4 [7 I6 s0 j. }
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 1 X  M. D1 N8 y" u5 u
, ?2 F/ c- d$ z- d1 }
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], - T/ s% L2 m8 T7 t* }- l7 M

$ V# k8 S2 F8 N" Z! L* |0 q[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', ! l1 y; Y3 ?4 p& W: v( P0 T$ Z

. U7 P! W+ i" I. b8 k  cN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
7 \3 U) b  W' M) A9 W$ m8 \3 m
8 i% W0 q/ R( U1 T! @3 v3 Y2 N'{$ElementUpgrade}', '{$ItemPierce}');");* y7 ~) \7 P8 I
}
( w4 v: \. a3 Q0 w8 Y
0 s1 u5 y7 i8 N. e}
0 Q/ Q, C/ w# T% z2 l+ C4 }
! @6 z% |3 z  ~9 \}
( Z9 C+ M* i; v; {& D) U6 ]: V" u+ Q$ r
$InitForm = InitForm();
# L9 @  _1 P) I$Listener = PostListener();6 k7 m2 r  M1 f  q% i) S
/ n% O/ u6 t) M( Q8 Z2 e) {" k
?>
/ E- i% r8 F' e4 {8 k1 j7 V1 E. m% k# s1 U
+ T& J4 k  P0 f9 x
/ O, U$ A- q6 e) D  y, q

( j% `1 z" F% e  _% G( ?$ Z4 E




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