飞飞世界论坛

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

作者: admin    时间: 2016-1-10 03:43
标题: 物品发送脚本
<?php" `( u5 S8 b. d0 c8 Y2 I% v3 A
function Connect () {2 U$ n6 p% w' D( H* p
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB ( I6 Q& O7 a; O' u3 S
6 L9 W! J4 b( W% z& g4 X9 I
Failed.');7 e* o* A2 {  `0 P$ J% A
}4 K1 {5 x+ F. J; J* ]2 Q/ E
Connect();
  m0 t# S$ j2 U" `/ ^. L4 T' ]$ ]  }$ V  z6 f6 h% v8 E. s& k
function InitForm(){
( D0 m# a- b$ c1 e; k4 _8 G' [, n//layout for the form
! ~5 O1 U% r$ Wecho "<strong>Send Items.</strong>
. L: r6 u+ U1 j$ s( e' Y<form name='select' method='post'>* v- b/ A0 a& W: {
<lable>Character Name</lable><br/>6 q! D4 z2 B9 l8 d6 }
<input type='text' name='char'/><br/>( U' m" y# g' W) ~( \
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
& n9 d/ F! n" P; P. C<input type='text' name='item_name'/><br/>
5 m4 _% o) \- i9 o: @<lable>Item Amount</lable><br/>; S% c: H) ~  Z' U7 ], e
<input type='text' name='item_amount'/><br/>: d& @+ R6 Y3 X2 N
<lable>Item Upgrade Amount</lable><br/>
" V2 _9 S2 V: j<input type='text' name='item_upgrade'/><br/>3 P  v6 ^. J  Z+ p  }
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
" J- O5 f4 x( }6 J0 b9 s" L4 a8 A  h( Q
</lable><br/>4 M9 e( M; o, h  e
<input type='text' name='item_element'/><br/>2 u* g" s* k" z4 w' T- ^
<lable>Element Upgrade Amount</lable><br/>9 m. I4 ]& H# b8 a
<input type='text' name='element_upgrade'/><br/>" J* U5 K# b# O! z, V: a, v
<lable>Pierced Amount</lable><br/>0 p2 A1 G/ B% m$ [6 O
<input type='text' name='item_pierce'/><br/>4 d3 L5 I" x& m. v" B
<input type='submit'/>
5 ~' `* N3 c8 }4 l</form>";
" h0 X  ?. t) I' }; K1 ]}5 {  f/ i8 M4 T" Y0 {
" p: v" N- u# m: K
function PostListener (){
' ?4 n& w8 E2 D% E6 g3 R6 u5 M//Add more post variables if needed and add them to initform() function aswell
% M4 F3 h+ h% W$ ^
- \" c2 f  |* E################################7 e* p8 l, j. x: p
##### Connection and Post ######
' i2 R* l) a/ c8 ]5 i( J################################( {0 S# `- [( a: G
$name = @$_POST['char'];
* h. U, X2 `7 B( q$ItemName = @$_POST['item_name'];4 x6 O5 Y  G! B( t
$ItemAmount = @$_POST['item_amount'];; m7 |& Q2 I2 U/ w* D" J
$ItemId = @$_POST['item_id'];
  _! L4 w0 M3 N) ^) C- s( d1 {$ItemUpgrade = @$_POST['item_upgrade'];
$ d9 d; ?8 Y2 q$ItemElement = @$_POST['item_element'];
6 W* C, V& H, u5 q; V. T9 |, \$ElementUpgrade = @$_POST['element_upgrade'];
, X& T% q. ]2 m5 ~1 `$ItemPierce = @$_POST['item_pierce'];# s, X- X8 n7 ^6 ]' b: a- P
################################
+ W7 a0 K$ i$ ]' `0 ]
" {  N7 D- y+ Y0 n6 _* G" Y//Check both variables for empty value$ t9 N6 e: b2 T5 O
* a6 ]7 P/ [6 m) E/ _6 W
if (!empty($_POST['char'])){
" ]" B- x6 ^4 k* ^  K! N$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where 2 m8 M* ~; |4 C& I# J

* a' S1 @8 Y. K1 Hm_szName = '{$name}'");
( ?2 A5 @' N: r. s/ a6 s% qwhile ($row = mssql_fetch_object($find)){
% N- F9 x$ c' x) R9 I; k+ [, Iecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
2 L* E# h0 ]8 v+ @/ `. p" F$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
* P/ z  M' J& g6 H4 D# m. Z
$ @4 y  B/ {* ^2 j6 a4 m[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], - B( B+ I5 G8 g0 Z

5 a+ q2 H# @: B% T+ b[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', - L" \: [* G  e3 q
% n+ _3 n9 z% r/ G
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', ; }- N) d. ]+ I6 g( t4 {& i
. j" B8 A6 a1 B3 z+ {+ P
'{$ElementUpgrade}', '{$ItemPierce}');");
. r( j0 ~1 h8 I7 R+ s# y4 y2 n}, L& ~- D& b  L+ _& V" A/ B8 _

  R& q+ g/ f* `- Y) w/ {0 W, V}! c7 `: y, |9 Q, n

, Y0 M* E7 F- e+ u- u}
+ ^) x: k2 |: S6 Q' K& k3 Z& F# \0 P( e, M! o& O
$InitForm = InitForm();+ G: ]7 h& b, N/ T% z
$Listener = PostListener();9 o3 b, d7 S, S0 \
2 _; ~4 W# U$ H. [. s5 z. m% ~
?>
3 g9 C3 F" [2 \  L
  l; F8 _& c( [& o- w  g* i" G3 ~" t  r: G6 z) a6 v

. |7 r* G: Z5 g3 N1 u
  z* ^1 n& m" x1 e4 u, \( r




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