飞飞世界论坛

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

作者: admin    时间: 2016-1-10 03:43
标题: 物品发送脚本
<?php4 W3 @3 `. }/ G" m. o2 {, \
function Connect () {
! g3 o5 n) ^5 ?mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
$ W$ `& j% r4 X# J. A9 M. I9 [* a( V6 G9 d& L* Y- |
Failed.');4 o! Y- U+ E: M& v0 D. P
}
) f# M# e6 @0 x" B; V  B1 _Connect();+ K" L% X) C  I( \. N. v  b& G( v/ ?
0 I0 M- g: h$ R' x1 {6 C
function InitForm(){. F  B4 v5 N' {/ V) s5 y
//layout for the form8 C3 X4 }$ N/ V" @7 }- U
echo "<strong>Send Items.</strong>; e- M4 Q& ~: G( n) Z0 |' V
<form name='select' method='post'>( v# z) s+ j2 c- F
<lable>Character Name</lable><br/>
1 G8 w; s! L8 T2 f- e2 [<input type='text' name='char'/><br/>  X+ r$ a! e& O+ T5 v/ D- ]/ I
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
' O9 A. W7 V, m7 O. \; _" V$ ~<input type='text' name='item_name'/><br/>
) O# Y0 s9 I* U" o<lable>Item Amount</lable><br/>
; d3 K4 r. [5 c1 H<input type='text' name='item_amount'/><br/>1 |+ C+ J3 n+ G' ~4 ^* |2 \' N
<lable>Item Upgrade Amount</lable><br/>1 o& W9 B  O5 R4 n7 D
<input type='text' name='item_upgrade'/><br/>
" Y& x2 ~4 x, S<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
5 S) ]7 x  b7 [% V8 M" j, L  b! |
2 I. Q+ c/ d( O. K/ ]* X</lable><br/>  t, H5 |, Y; P- A4 }" l
<input type='text' name='item_element'/><br/>! Z  P6 `! p' {7 D, N
<lable>Element Upgrade Amount</lable><br/>
$ F& S/ j) ]6 v. a<input type='text' name='element_upgrade'/><br/>
1 N9 I. k; c; U' g3 ?<lable>Pierced Amount</lable><br/>' F, P/ q' L. i" U7 D* ?# g
<input type='text' name='item_pierce'/><br/>% M3 h) o! f  ^
<input type='submit'/>
0 e/ O8 l/ Y* z' ]</form>";
; B5 Y$ w; {- r8 e2 N}
6 _+ g& j6 F+ r
% W, z2 a) J8 m7 Dfunction PostListener (){
% ~; I% s5 }! l- [9 a0 @//Add more post variables if needed and add them to initform() function aswell
: u; i/ e. H: \' a1 w0 M2 @
' s: Z3 B3 j. u# v# S- Z################################" x- x  w& z0 y" `- b0 T* R
##### Connection and Post ######
: x% |$ _! U: ~7 X' ?. ~################################
# l( F- }, ~, m7 g6 H$name = @$_POST['char'];
. s1 ]0 U& z9 C( y2 G$ItemName = @$_POST['item_name'];
( V5 f* @' d0 Y& ~& h1 j! y& f$ItemAmount = @$_POST['item_amount'];
8 S7 i' u- q0 X$ItemId = @$_POST['item_id'];
: _: ~  i  r9 B' G: P; F$ItemUpgrade = @$_POST['item_upgrade'];
7 e: G1 I& J- |# K3 w5 J- b$ItemElement = @$_POST['item_element'];" K5 K+ x  z' o- j: M; L
$ElementUpgrade = @$_POST['element_upgrade'];) b6 h; g6 \4 C0 A6 K
$ItemPierce = @$_POST['item_pierce'];
  C# @0 Q% D2 K################################
" j3 L# O3 m- P  N# Y
/ w8 m' S: A0 H  q/ S5 C//Check both variables for empty value
6 {8 H# H" [( q6 o
/ I$ m0 j, d: C8 {& k1 [8 Uif (!empty($_POST['char'])){
: q) Z3 u* z5 c. \, _& V0 k# H$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where " H% y" A  y0 P& Y2 g

* v: p$ M9 ~% A9 h. @+ fm_szName = '{$name}'");" r7 \! L+ t: ^# T* t
while ($row = mssql_fetch_object($find)){
  N' O( X+ D1 [" M9 @" Q) L9 @echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";* F/ f0 a5 z3 y: Z: F- U
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 4 _' a; z  M. @4 ^' }- x' ^

2 x: t4 G. }# ]9 |6 M+ ?5 R# J( B[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
* `: p- t- N4 _! k4 L8 @* T/ a. J7 k. f5 H1 x1 k3 X' z
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 2 q6 {7 ^! o2 h) k3 ?

$ Y0 N; H- ?' G+ ZN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', 2 J( y% {' I! [9 }4 M" k
6 j/ A) J8 f- g$ P  @9 B' s" m. s) w
'{$ElementUpgrade}', '{$ItemPierce}');");; }  D# z. }- l8 d- h. F  k4 @7 f" B
}4 T0 b  r" v: r9 h9 S
' T$ y; u  t7 h0 f1 U
}# P1 F6 Y' f  ]& X& w

6 k7 f& Z+ @; n0 c- I. q5 M}" T" i- r, [0 f7 P5 m- I. n
9 {- R( A* [8 X: V$ c
$InitForm = InitForm();
# Z* ?: Q" f- n$Listener = PostListener();
4 q/ d/ B# z8 ?+ ~# Q5 O! A
( Q: Z  Q" n; r5 @' s?>. A; \* L, i. j, w

/ C5 t. U0 Q2 Z) q$ Q6 J$ P7 i  n
- N# ^- [; c. j! }, z3 G, L4 X5 D+ h5 m* f

) `; N$ Q! ]; t8 ]0 w9 W: o




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