飞飞世界论坛

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

作者: admin    时间: 2016-1-10 03:43
标题: 物品发送脚本
<?php
* ^7 }! s9 m5 ^9 {: nfunction Connect () {
9 o) n; A) ^% {6 u8 K/ Kmssql_connect('Server','UserName','Password') or die('Error: Connection to DB
* b. f+ \. e: w9 d" c' Q: r  x: a3 X+ f* X
Failed.');
- V6 S; ?1 p0 \2 c; l* J}
; ]7 r! \  `( uConnect();' L1 P, h8 I9 B! Q
) V3 X- A  ~- s. x
function InitForm(){) m" g: n3 ?' @( s" v/ t7 o
//layout for the form
4 A; K( U: C1 {, m2 |$ Q. secho "<strong>Send Items.</strong>$ ]$ G2 {& E7 z% j
<form name='select' method='post'>
* i  M; K1 j# C8 k# |- Z<lable>Character Name</lable><br/>) R0 b' Q# c: S8 p$ Z
<input type='text' name='char'/><br/>) _- \; j4 t& w+ A6 B+ I+ U
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>9 ^7 @+ _4 R) F6 }+ r* {; t5 b: g+ M) y
<input type='text' name='item_name'/><br/>
7 J+ j) m- S, d/ a2 d- u" w& j& [<lable>Item Amount</lable><br/>1 {( c  M# S; l: k5 O6 J. G: @
<input type='text' name='item_amount'/><br/>
; G8 S. z: u" r" E$ F<lable>Item Upgrade Amount</lable><br/>
3 o# T! ?5 A8 G' G, t<input type='text' name='item_upgrade'/><br/>
; a) h. E- u8 n/ u# [1 z. u0 w<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)# z; i: R: a% O9 i3 A' E4 j

, `2 ?# ?8 W9 b  o& Z</lable><br/>
" B( e  c3 g8 w, D0 P7 c, o. z% {% J<input type='text' name='item_element'/><br/>
: k# ]4 _5 D8 i+ v8 ^<lable>Element Upgrade Amount</lable><br/>2 H, {; ]: @! y+ K* C4 S8 M
<input type='text' name='element_upgrade'/><br/>
- P3 P& [& t% l6 h3 C: c! E" L<lable>Pierced Amount</lable><br/>
) b) `$ W7 s$ C8 d0 U7 c<input type='text' name='item_pierce'/><br/>
. Z* H+ z! G' G  e<input type='submit'/>- C  i: \# q3 I
</form>";4 S7 u& t8 d% f* r  B
}0 t; w$ {  b! v5 x, ~, k/ J

/ m2 d: q* ]- `6 i8 A& vfunction PostListener (){
" m0 E( I: _5 F. I//Add more post variables if needed and add them to initform() function aswell+ @; m; M, y; f2 e# @( h: ~

, c" V% t9 p& A# }# y. y' n" Q################################+ W7 k7 F# L0 }0 U2 z
##### Connection and Post ######( s* g' J3 M" e8 J8 w
################################" i# U3 ?+ v6 d2 ^) H
$name = @$_POST['char'];
% J6 D4 }* f' D1 L+ `9 u$ItemName = @$_POST['item_name'];# \) g& p8 s$ l" u& e, E6 m1 M
$ItemAmount = @$_POST['item_amount'];
2 B% ^& `! T. Z+ W" N$ItemId = @$_POST['item_id'];4 H( t  i% L  h- @8 I
$ItemUpgrade = @$_POST['item_upgrade'];
: g3 u8 v( T- x% c0 e$ItemElement = @$_POST['item_element'];
# i$ a! p9 P' J1 X7 V0 ^$ElementUpgrade = @$_POST['element_upgrade'];
: d8 W% q- [) g. a8 s% {$ItemPierce = @$_POST['item_pierce'];
/ T  Z5 p6 G8 u( V4 S################################- K0 q' w2 }& \4 n' F
' |0 Z/ k: N" H  `7 {
//Check both variables for empty value8 l6 l: j4 h0 G; s5 r! U3 Q

. n/ M! Y# C* T/ @+ U2 P% h, pif (!empty($_POST['char'])){0 E7 ~1 y! B7 b, v0 G7 \
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
! p% K% c* I1 {: _) M4 Y5 Q& r+ n4 W, F
m_szName = '{$name}'");4 t# o/ e3 b, [: b( ?$ Y6 S
while ($row = mssql_fetch_object($find)){
9 k, G9 a3 \6 {# hecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";8 s' o7 P. D' p. H/ e
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], ' Y( F3 r" s! c8 N% d

4 m9 A* }# M" L: j# i" l[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
' k9 j+ G1 [0 z3 B8 ?  w0 M0 j! I  u/ J( A
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 8 r4 W6 i; z, l* G% {- l

, a  \7 t* S, ^/ C" p0 GN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', 0 }* ?: ~, D3 R

1 n+ a% g2 c+ C'{$ElementUpgrade}', '{$ItemPierce}');");
* |% B1 }3 F0 }9 ]- ~- v}: I* z) l# T% Z7 b8 y

" L/ Z3 C" s2 D3 @4 `}2 ]! z! `& n; b/ D
- Y5 L, B. l: v- M$ T! ?
}  h1 F! S1 T/ ^
( D  P3 {3 ^# a- K3 ?/ P5 E
$InitForm = InitForm();0 w; B- Z- k2 a5 }0 h
$Listener = PostListener();
% ^: r6 _& C6 Z) q& t  d: }1 v* q4 B+ j( J- S& @" u
?>
9 ]) z% B, P+ y1 F9 b% q5 R: O9 d4 {7 ?$ c5 }0 U+ F5 E6 x

; B& X0 c$ E1 U6 f: R
2 F" S! J0 A5 Q5 R9 D2 o7 \( e! A
3 c. Z9 |, B) f




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