飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
# S- f/ U4 Y& K3 i7 sfunction Connect () {& n4 L( k" B: f# s
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB / m0 G% M2 V+ ]

/ n. F8 Y# y+ |Failed.');
) Q- O6 T- {9 L+ O7 z}
! A: S' H8 O& d) g( y+ G. x- b! @& iConnect();9 e2 Y2 I/ I9 W/ m- ]& N0 f

  f& B% n. a9 q+ _2 I% P' afunction InitForm(){
. I/ s% ]5 N( B! a8 o' S3 }' }//layout for the form& b6 V4 y8 Q9 I9 Q& F0 @
echo "<strong>Send Items.</strong>
! ?4 B3 O8 K6 v' c# E<form name='select' method='post'>$ N* ~9 O; _2 t7 m& n6 `
<lable>Character Name</lable><br/>9 g" G# I# _  v$ f5 P2 u
<input type='text' name='char'/><br/>9 d2 d8 o8 ~' M
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
8 o, J" j7 ^9 F# G5 i! B5 l6 H7 E<input type='text' name='item_name'/><br/># Q' [7 X9 H; A1 m; O
<lable>Item Amount</lable><br/>
2 P0 V0 j% K' ~- R( ?* X7 n5 z4 k<input type='text' name='item_amount'/><br/>' x' ~6 K# U5 p1 S  O% V5 x) l
<lable>Item Upgrade Amount</lable><br/>
; S0 j! U! D4 S9 k<input type='text' name='item_upgrade'/><br/>& Q, t  `& K# {) A) u
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)5 H2 O- Z' _9 f" J1 e$ a3 \0 q0 {

4 S/ A7 Q( H- @& K- A% _3 j& E</lable><br/>7 C" Y9 O8 j) |& M4 [
<input type='text' name='item_element'/><br/>
/ Z! [( V5 r. g, P$ d6 Y<lable>Element Upgrade Amount</lable><br/>
& c6 f$ s6 z. M, l+ J<input type='text' name='element_upgrade'/><br/>& S2 L, F0 k5 N% y5 \: F% E
<lable>Pierced Amount</lable><br/>5 F, N& i( }& C
<input type='text' name='item_pierce'/><br/>
+ m4 b% u6 P# z" @0 k9 o<input type='submit'/>
* q* L1 W3 z2 ?1 i1 G/ d</form>";7 d5 C5 d- i  ~2 A; X* K
}: F% e' q. [: ?4 j" D

# x! a1 l- `8 x% Q2 [function PostListener (){
$ c2 Z. [2 |/ s" j/ [3 J+ }//Add more post variables if needed and add them to initform() function aswell
( t  Q8 `; _, |2 P, g" m7 v( n! O- {8 n7 h1 z, z/ f" {
################################& N- t6 B& U3 Z( g7 E$ @) ~
##### Connection and Post ######8 f; [& H! @  A" E* a
################################
' L& F5 e& D. K& j1 h/ J$name = @$_POST['char'];
6 S( N/ c: U8 E/ N; o/ g* }$ItemName = @$_POST['item_name'];8 `+ L0 ~3 @" S2 f8 ~# V6 o
$ItemAmount = @$_POST['item_amount'];$ a1 `; d* {) T# m* ^" V
$ItemId = @$_POST['item_id'];
2 V' d9 {; Y9 c) y8 `$ItemUpgrade = @$_POST['item_upgrade'];7 _/ x' o, l6 F" U* N" {
$ItemElement = @$_POST['item_element'];- J2 l& F3 {3 s3 \
$ElementUpgrade = @$_POST['element_upgrade'];
' {3 j3 A) l' \* ?/ x, S6 I+ ^1 b$ItemPierce = @$_POST['item_pierce'];0 Y; W8 I' X' q# S# C4 d
################################7 }: R& t& V( K1 ?- s+ C( r+ }* f+ T

9 J. |9 k' P1 B. w//Check both variables for empty value; ], D6 v8 I6 X: P" P8 I
& t) c: S6 g2 t9 A+ V
if (!empty($_POST['char'])){6 G. A1 }3 u# R$ A* [7 l1 s+ X
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
! Y( ~9 h, M" l% }* j; A$ }  B0 e/ g4 ~
m_szName = '{$name}'");) [1 `# q7 E& ]
while ($row = mssql_fetch_object($find)){4 c* w8 r8 L; e  M# ?) q
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
% T. b, S! T8 U+ w" c7 h$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], ( z/ K" u9 u, Z- i1 b

' k+ e) z" ]0 J) e6 o4 I1 F[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
/ ]8 m0 H) b! k4 H: E/ T6 c7 H; W: Y! S2 z: f+ o, d
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
4 @6 b7 q8 m5 w/ d7 t% x
$ _6 F+ N# |5 MN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
& W3 A4 A; ]* y# n* H# A/ [7 F: W4 U0 f' R
'{$ElementUpgrade}', '{$ItemPierce}');");1 R. Q  @* h  Z/ i: r* Y
}6 r6 y8 `! p$ k; s7 S
: e2 c+ u/ L: K( e
}
# j2 n6 i" B7 H6 a/ m8 e) u2 w+ A4 p) ^: B( Z
}& n" ?# }& m3 P0 i- T
) Q' Z( a- `) S
$InitForm = InitForm();& Z( n+ m8 d9 u; T8 T6 v8 t
$Listener = PostListener();
" k7 }3 E( B8 u; u% v1 c' D' A9 T8 @
?>3 k( h. c$ i: V

/ ^8 q5 p- _% b0 w+ W/ @
) G$ F2 j9 x" q& c/ o" T
8 e/ j& @" k5 y# n$ Q
; u4 X! A# a; [# a6 w
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-29 01:47 , Processed in 0.083007 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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