飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
# U3 P4 ]! ?7 i8 q! ?9 t" `1 gfunction Connect () {$ K, s1 i2 y' B. k# z: h
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
( L9 N$ }9 k. U$ ?: X- u
7 N3 F0 z# o) [$ }/ _3 n) YFailed.');( d# B' I1 [: K, p; M& p+ e# q
}
- K4 f8 w5 a3 F% s- CConnect();
6 u2 Q3 B& F) K5 [. {: S; e8 `2 d: `- t# _' N5 Z# @
function InitForm(){. ~. S1 y) A+ s6 T! v, Q  C0 H
//layout for the form4 g( s6 X/ J' D+ L' `1 q: F
echo "<strong>Send Items.</strong>
1 k3 @+ h1 I9 k1 v. G- S<form name='select' method='post'>
8 a5 U* W- ?. q* C  i$ `( l<lable>Character Name</lable><br/>: h3 R2 C$ V$ H2 s! y) {! a
<input type='text' name='char'/><br/>- j8 y0 r3 l7 w
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
5 w* w/ w4 q! P! i. t$ N# E! G$ V<input type='text' name='item_name'/><br/>8 s+ n1 S! G8 A+ W' ]$ A: j
<lable>Item Amount</lable><br/>
8 j2 h( r3 F( I' |# J3 K4 s<input type='text' name='item_amount'/><br/>
4 _/ J# Q" ?9 D1 _$ k/ Z. i<lable>Item Upgrade Amount</lable><br/>
" D( R/ W7 `8 z<input type='text' name='item_upgrade'/><br/>
1 y5 B& r1 r. u& g1 H9 N4 }% ]& u) t6 U<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
: H* y( m) `# N) P) c- I# a1 p; ^) a) g) N! K: L
</lable><br/>
. d( s% P( X; j- b$ e( q<input type='text' name='item_element'/><br/>
+ I6 J7 {, }* y+ ^; d# ]" d<lable>Element Upgrade Amount</lable><br/>
0 y) l9 B( l& c8 k  E# b+ j<input type='text' name='element_upgrade'/><br/>
1 D0 I" @- v! L- @' ]<lable>Pierced Amount</lable><br/>
3 G2 s! |2 C9 M5 k" \% L7 s7 D8 ?: H<input type='text' name='item_pierce'/><br/>
. F3 Y! U6 b3 Y: v# J3 m<input type='submit'/>
1 p# A& ]0 k* X- E; I% I$ ?</form>";$ ?& y7 L9 w) {. j  Z
}( W3 T1 h6 R' S" T( k- e

, o) b, Y( f/ E( tfunction PostListener (){
0 x3 k! Y8 P2 \7 g. w- D//Add more post variables if needed and add them to initform() function aswell
+ B' {( Z- a: c! X' m5 P' |
! d3 S" N9 z9 @! ^################################
' `5 C  f" w2 P( B##### Connection and Post ######
' J' T3 l+ [8 _5 p! g5 u3 M0 D################################
: U% O5 W( Q7 q; z$name = @$_POST['char'];
6 k6 r2 v/ ]3 k. r" X& R7 m$ItemName = @$_POST['item_name'];: {9 E; v6 V4 O+ m
$ItemAmount = @$_POST['item_amount'];
( _! s+ w! L. P. e$ItemId = @$_POST['item_id'];0 p9 l0 C8 h* {7 h1 C. a
$ItemUpgrade = @$_POST['item_upgrade'];0 T7 q( n2 h% t
$ItemElement = @$_POST['item_element'];
7 v6 E. }, K. o# F# |- |$ElementUpgrade = @$_POST['element_upgrade'];3 L" q* p0 b  _* `  K
$ItemPierce = @$_POST['item_pierce'];
$ O, a/ d4 i' J################################. R9 C7 Q; }2 ?. }7 A

. a5 B& x7 }2 \//Check both variables for empty value
6 i/ ^& E- T, X! z: Y8 u5 R6 }6 y" K' b& D& d
if (!empty($_POST['char'])){
8 R6 B& o" o- l0 T  Y: P2 A7 r  l$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
- c: P# x' A  Q3 u4 B& D" k8 ]$ y- U
m_szName = '{$name}'");
0 J1 ?0 |' e8 P1 Zwhile ($row = mssql_fetch_object($find)){
2 b5 [# Z& K0 W$ S* `' @- |9 Zecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
: a& o) n' Y3 P$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], ; h, u: ?" s. `, G7 d1 a

5 ~8 _' `: Z; t$ l% o: k- P  `[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 9 X/ V7 F: H8 D' Q2 ~. R

! W" k+ G& |3 A/ F' }; a[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', ; a' W2 b# \+ X8 k! m

: M) r8 m' ]& [* O* {, SN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
8 U6 G3 ~5 y4 b; k+ p& R) c) E) s9 s6 m* `
'{$ElementUpgrade}', '{$ItemPierce}');");
) f5 `) K% b* @" U. i}
$ E8 T$ a  s- _* g( f# @4 ?1 l6 X$ [2 e! N# t
}  t: m# n8 q+ E% _7 }
2 f) j1 F- t4 Q( `$ e7 r
}
: X3 |; n3 W+ u8 A! A2 v$ w" j8 S: C+ u, G7 E- a+ m3 [# A2 J# V  f
$InitForm = InitForm();/ S0 [5 R0 a/ F% d! y, Y4 v
$Listener = PostListener();
+ x4 P$ F. c8 N5 E( \; O0 r$ u# x& o) y$ Y
?>2 m% Z- q' m# x7 l. O9 X% T0 `

6 @* t. `- n' S# e
6 M  y8 J8 e+ ~
* x% B+ q+ D7 s& k- }) g4 P2 y) U) M; `2 [9 I, g" v; Y
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-1 23:31 , Processed in 0.070278 second(s), 30 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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