飞飞世界论坛

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 13939|回复: 0
打印 上一主题 下一主题

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
/ a5 d$ Y. ^) ~, i2 vfunction Connect () {
& g2 Z, k, ]8 ?mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
/ G5 k  {- W2 A
& j0 n* H) L3 l  c( `9 XFailed.');0 t* A- a# Q* O! _1 k. F. W
}: Y+ f, ^1 c; v3 q" c5 {4 h* n
Connect();
/ Y& p' x+ T9 H+ ?
" |. I" v6 `3 F/ C! q  Kfunction InitForm(){) H3 @! Z; A/ w% a, w9 u, a
//layout for the form, H* M! K* Z- v, |) z; n
echo "<strong>Send Items.</strong>  j- A5 l1 o3 V3 X+ T  f
<form name='select' method='post'>% R+ w8 ~4 X. Z2 `
<lable>Character Name</lable><br/>
  v; f9 Q1 ?1 `# w<input type='text' name='char'/><br/>
% S- e% o3 w% w  M* x<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>& P# \4 x! u' f
<input type='text' name='item_name'/><br/>6 e. h  s$ M" t% C2 R. i; R5 ?
<lable>Item Amount</lable><br/>- f, p$ ~: C) i0 |/ u: Z1 t- D
<input type='text' name='item_amount'/><br/>- C* ~/ n" r7 [$ y# D
<lable>Item Upgrade Amount</lable><br/>
& Y  A9 Q. _/ L& `<input type='text' name='item_upgrade'/><br/>8 o4 z8 H8 W; j( [* x
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)1 r0 L6 ^" S8 X! G9 R' w* {+ Y
! G0 D3 n/ d. z6 Z) ?1 w# O3 w
</lable><br/>
8 m" W" G; _8 G2 q<input type='text' name='item_element'/><br/>
, x- m' W$ c1 V0 y; u' S+ A' U1 j<lable>Element Upgrade Amount</lable><br/>7 }3 f. z! V2 T+ u4 N2 c4 u/ f
<input type='text' name='element_upgrade'/><br/>
0 n$ d8 q8 |6 t<lable>Pierced Amount</lable><br/>
) c/ b5 `. K) Y+ B% L<input type='text' name='item_pierce'/><br/>( i; v, A5 B+ R  g, [
<input type='submit'/>
4 Z, {4 |+ d6 N) `& k9 F3 w! Z</form>";) P: N# r/ s0 z
}
+ [, {* g# S9 C. {( w2 E0 y" P( g$ V
8 N8 s( B% q6 o/ d+ G8 c8 [) Y6 pfunction PostListener (){. e+ A  N3 l& }
//Add more post variables if needed and add them to initform() function aswell/ y+ ]2 r. D$ ?4 |

4 p# s2 v0 z6 C################################8 f+ N5 b- P* q( ?
##### Connection and Post ######
7 q/ h& R7 b% K; x% l################################
6 G- x* W' T7 T' m/ s1 Q$name = @$_POST['char'];# V! ]7 Y3 Z6 L" k5 B5 @& t
$ItemName = @$_POST['item_name'];
% P: V5 m. w  x5 G' i1 K8 }) z$ItemAmount = @$_POST['item_amount'];0 H: S' ^/ D+ a  e
$ItemId = @$_POST['item_id'];
. z* C- n/ L1 L, s& d$ k" i$ItemUpgrade = @$_POST['item_upgrade'];) X0 r1 M9 N- ^1 D+ m  `
$ItemElement = @$_POST['item_element'];
6 b6 Z/ z" ]  B$ R. Y/ O6 Y2 D! A$ElementUpgrade = @$_POST['element_upgrade'];
% D. v3 f, F) g! P( i& R) S8 q$ItemPierce = @$_POST['item_pierce'];' t/ ?1 _) p/ v& P" S& ]; r- W
################################
: q7 A# p: e! _- ^( g( e0 [
9 M' o) ]8 j4 ], r9 y4 }+ s//Check both variables for empty value
) }7 \$ }$ j  X3 C3 w3 c8 N$ c- P) d
5 @4 a7 i1 E. r  z+ t$ U7 Cif (!empty($_POST['char'])){" f5 v; @  ?% j9 g8 G3 Y, r
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
8 k; S+ a. [% G5 X1 D- P5 A: C+ d  W7 w6 Z% Y' Z
m_szName = '{$name}'");
+ \/ F8 W2 ]: Y! f7 j- gwhile ($row = mssql_fetch_object($find)){
: M( b6 t* o# v$ z! M. aecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";# d% Q" p& J+ Q
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], ) @4 o2 u3 @, D4 ^! h1 b

9 @. P$ p: O% w[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], . `  Y9 m+ _; }  U0 X
6 d$ H! D& `/ V
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', # N! M' m7 @1 k! a0 M; X3 t: X

8 }/ H7 m1 q: S3 u! O2 x1 ?' |N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
& L; E% I. W( A8 l) [3 T
. \  x; M, O0 l9 W8 g'{$ElementUpgrade}', '{$ItemPierce}');");, R( ?$ x; x: y) A1 P
}. }6 X: u, p$ |1 W6 S% C% ^: F

+ K$ V. h% w! ]1 L  a- N5 C}# \" R0 |! Y& L3 C

: Z, O2 _% k$ ~) o; A* B# a- W7 P}
" R7 t9 E8 J2 `- [/ `3 X. ~: U5 G1 I
$InitForm = InitForm();7 e% t/ d* [8 j' S
$Listener = PostListener();
0 M, F# q4 ~9 ^8 u4 V
7 o9 F7 m% C% F0 a% v$ F- Y. E0 J?>) S% L, y) e- B4 g
, P+ c; G; _5 m3 P# X& @' Z' d
+ t  h% h, N& P/ |* j) Y
3 i) Y) U9 h3 r) S* Z: T3 O

; y! `9 x2 _5 I, L' Q1 G* {
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|飞飞世界技术论坛  

GMT+8, 2025-12-4 11:01 , Processed in 0.057680 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表