飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1090

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1090
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php8 c0 H. V* H8 W5 W8 d9 Y5 ?, s
function Connect () {
' ^0 O) f1 e$ ?  j% r. Ymssql_connect('Server','UserName','Password') or die('Error: Connection to DB
3 {( @. B$ m+ X3 X
- d& C( q; N, P) p" N1 JFailed.');( ~) I8 M# T/ D5 M6 ~5 s2 Y
}
: z/ a, E9 J8 G' E' J# VConnect();
$ I% W8 |; j9 x/ i  A! b
$ p+ |' S( g# e3 f$ w- N2 mfunction InitForm(){
% h( d8 H; Z, x5 u" @* q9 l/ p//layout for the form
2 C0 F: Y- c1 q" secho "<strong>Send Items.</strong>& `% R! M) v. h1 R
<form name='select' method='post'>  O; w6 ]. G# S  @
<lable>Character Name</lable><br/>4 Y8 h1 K9 s* P, i
<input type='text' name='char'/><br/>. i) H0 D; {# C/ T
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
8 m& b* A. P  w<input type='text' name='item_name'/><br/>
& w$ a. {/ m  f: w: Z  M<lable>Item Amount</lable><br/>  w: G6 {1 T+ X0 W: k1 ?/ o2 _5 i: A9 `
<input type='text' name='item_amount'/><br/>1 S4 G: Y' h4 j/ _
<lable>Item Upgrade Amount</lable><br/>
7 n0 x- q1 t9 P3 e+ N4 [# ?+ k<input type='text' name='item_upgrade'/><br/>4 ~( j4 Z9 r& o. i( _9 M
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
( E0 b5 _8 h$ q- o6 J6 s: Q: [2 v
* ]- T% W; i5 |; o</lable><br/>
) F% \9 S. V; o; ?3 o1 ^+ B<input type='text' name='item_element'/><br/>2 i  \/ [  {4 a$ o1 `; |
<lable>Element Upgrade Amount</lable><br/>
( O8 o0 Q0 m4 \4 j8 \) W<input type='text' name='element_upgrade'/><br/>8 R7 q8 M: E: K! Y3 {  y& v
<lable>Pierced Amount</lable><br/>
2 d; q! W9 F9 A4 W2 m<input type='text' name='item_pierce'/><br/>
, [+ A- r6 N0 d" r8 a7 V<input type='submit'/>
1 J2 r7 x8 G4 o2 x0 j0 u5 P</form>";* }4 ~( f: {1 v6 u" Z9 L* z
}  a. P4 v; b/ l0 K1 @0 \& k, N3 P
* }# J0 z: L0 a: u
function PostListener (){
# p0 D4 [( h, L* w& J7 Q//Add more post variables if needed and add them to initform() function aswell6 `+ q$ b/ V* [1 {; a& I
& N( z# p% {, s/ I
################################0 W) }. S+ [! I; {0 e: A
##### Connection and Post ######5 Q! y) z6 i6 l6 D' y) ]
################################" j3 s3 h: u; v. r3 O8 O+ w
$name = @$_POST['char'];4 @# S! R" ^% ]3 {, \; _, z" G
$ItemName = @$_POST['item_name'];' V. C  ^7 K7 t
$ItemAmount = @$_POST['item_amount'];7 M% ]& r! p5 O# C, p, F7 ?9 d6 H
$ItemId = @$_POST['item_id'];8 I* \; k# s2 [0 J) L9 W  ^
$ItemUpgrade = @$_POST['item_upgrade'];: e$ \9 H6 g, g: o
$ItemElement = @$_POST['item_element'];
) {0 r5 w6 H- i1 a+ C* C6 Z$ElementUpgrade = @$_POST['element_upgrade'];
& f2 p0 O8 Z+ m* e$ItemPierce = @$_POST['item_pierce'];: ~( z0 a$ k, g' \0 }4 x
################################; A3 r' G0 a: C! {

" t. m7 S5 ~# B& d1 d5 @//Check both variables for empty value
" F. A. g4 `! X7 v  P
3 }3 C+ w2 b- lif (!empty($_POST['char'])){( w7 w, Y+ v) j9 w
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where + Y* v  y; I" k+ _( d

) P3 S; g7 ?0 g( {& _m_szName = '{$name}'");$ e9 s% _6 r$ a1 a6 G- z% q
while ($row = mssql_fetch_object($find)){; s! j4 ?( [* V. m. S1 L
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
( X+ ?, e9 o* `1 P8 o  i7 u  s9 ]$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
2 ?/ ?% d) v- ~$ V9 N% w$ \9 ]  _+ [! [9 v3 A+ c2 G+ x
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], : P* G* O4 u: [: y

- t% q/ p. o2 c4 W9 h- p( E[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
+ [& w6 D2 u5 f/ k* L, ~# t5 z. @9 x! X6 r1 @- g
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
7 T9 v4 d( B7 ?4 W
% ^6 [3 |; Y0 t'{$ElementUpgrade}', '{$ItemPierce}');");
( m2 u! u5 L/ Q# y: ?% \}
0 T+ p$ I: L3 [8 J
# o1 L7 [. u* l}* e2 n4 b; s# u" S

3 t: u! w9 N% t; |- d" v}
" T, Z, W7 x( g) U- T$ M  b! v# w6 f. l" e
$InitForm = InitForm();
3 ~7 i3 C5 J( Z- ]$Listener = PostListener();, j3 g1 p( {$ z0 T0 Y* u. n5 W! q
; q7 N) h! n6 i5 k- t9 x
?>) O! F* y; U& D3 r
4 s# m* i, j; P( K+ h+ h6 S, T
3 m* k3 y+ O: V3 d2 ~

% X. w1 s( s* Y6 @9 A1 |# a3 K: A, g4 F* h) M  C' r
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-26 09:47 , Processed in 0.058549 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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