飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php8 ], V9 U4 ?1 X5 D( F/ ~
function Connect () {
+ N8 V9 L: ]$ i2 Kmssql_connect('Server','UserName','Password') or die('Error: Connection to DB
) Y( b# |$ y5 I: [# Z
/ M- }' s5 N1 d3 O. TFailed.');
" D" `- L4 K$ \6 p! P8 N% z}
6 O0 ?; x" E0 p: |# O7 i. F4 |Connect();! @9 [7 a9 ]! l6 v+ [7 `

+ r0 A/ j/ r9 k# K/ ifunction InitForm(){) |8 e! u4 F) Z
//layout for the form6 c& K7 r- h6 N+ e  r" J
echo "<strong>Send Items.</strong>3 N3 y* h5 y8 @1 I
<form name='select' method='post'>
' {" H  G* K" t; f/ q0 |7 P<lable>Character Name</lable><br/>
5 S. j8 D3 v/ Y! T6 J5 P<input type='text' name='char'/><br/>
, T5 C' {* {- l% ?4 ?<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
- I9 J" {. q/ ^9 P8 z( `<input type='text' name='item_name'/><br/>
9 B2 N0 }- C4 D<lable>Item Amount</lable><br/>, d$ E/ b" P3 ^# P
<input type='text' name='item_amount'/><br/>
/ ~, r0 l, `6 g, s. F& t' [) {<lable>Item Upgrade Amount</lable><br/>. \) Q% v8 ^. z
<input type='text' name='item_upgrade'/><br/>7 A& ?( [  |2 F4 j, F
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)) g: h$ q  S/ w$ W

7 Y! F' y' S& f: d4 _, [* m</lable><br/>' }7 [' D  o5 N* M$ W: f
<input type='text' name='item_element'/><br/>, {; i% N$ f2 `
<lable>Element Upgrade Amount</lable><br/># p  U! Y: @' L+ @# @) n8 H% D
<input type='text' name='element_upgrade'/><br/>
. K  M: t, C7 Q; _( {. k<lable>Pierced Amount</lable><br/>
4 s& w* {5 `( c% K4 c/ L7 p5 L<input type='text' name='item_pierce'/><br/>
( ?2 A( ]9 `) q% U# @<input type='submit'/>
4 y* |7 L8 s; s2 Q: q. m</form>";) T( M( F0 B8 W' n7 B  Z) C. k. Q
}- q& M6 o! P8 Q6 r( h( z) U
' C& S# D, i# C  ^7 G$ g7 M, M
function PostListener (){: L% o$ w  Z  Y
//Add more post variables if needed and add them to initform() function aswell& J/ y* ~) I; O5 i7 @( u, y! X( ~
0 I2 z- x9 f; Z% B% b4 k/ z
################################: r8 p3 T+ j8 A7 y
##### Connection and Post ######
$ i: K6 S3 G  y################################
$ Z: V% c0 R4 ^% ]$name = @$_POST['char'];& e* c) K7 n3 i- k- k- H+ z
$ItemName = @$_POST['item_name'];
( i2 L: D* c" }$ItemAmount = @$_POST['item_amount'];
+ Z5 x! [2 P; f! U$ItemId = @$_POST['item_id'];
8 `1 {, P) v: M& ]6 X, D' a+ Z$ItemUpgrade = @$_POST['item_upgrade'];! W6 r7 V! f6 v8 l
$ItemElement = @$_POST['item_element'];5 Y* U# o4 }' X4 ]( U& m. n3 c: Q
$ElementUpgrade = @$_POST['element_upgrade'];8 k- v" M0 a" i+ y. t3 {
$ItemPierce = @$_POST['item_pierce'];+ j& `" i9 J' ^; l5 D7 B
################################
* ~& z- O0 E8 S9 ?
# j8 K/ c, i! _# f//Check both variables for empty value
& t4 W- t( N; [5 v
, D8 W8 u; z/ j" E. y1 T( I+ \if (!empty($_POST['char'])){  J& {; c5 P: ^3 G
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where 3 @# A, E" G8 ^8 {

$ j3 f. e3 V  Q' Tm_szName = '{$name}'");1 ]' n- S- J; o* H
while ($row = mssql_fetch_object($find)){
! H" M) `6 e& l+ k, n# [echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
$ ^! M+ ~+ x! C2 O& M$ X0 V$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],   ~8 {! C' E- R; ?" W7 D+ H4 l/ n

+ J$ E2 \+ H4 h  y' B[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
+ E; o1 Z3 ^' ~$ E; b( ^* i0 q7 |9 W: m- W5 s5 s' k+ d
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
' b5 Z6 _8 E% B3 C) y* z% V0 b# _6 h" ~8 W# M* S5 r7 [
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', " K( @( P) X: e
0 J6 ]0 O& p7 d2 U0 \. {
'{$ElementUpgrade}', '{$ItemPierce}');");
1 y" D% A: p# d, M" Y5 `0 ^0 Y}
" X, Y' [3 f( x% E1 Q$ `' I, T" H, B4 O" \1 t1 j" Z4 I
}/ a4 c/ x" t$ a8 e8 L5 e
4 }* O& _3 d, u, X- ?; X
}7 S: i0 U' Q3 O+ y
& q6 x  J+ z9 h
$InitForm = InitForm();6 D5 L7 a: L1 E  i
$Listener = PostListener();# g; g  x9 w9 ^1 r$ ~  N

4 o+ ~1 y9 r$ {/ q1 X7 D. x?>' }# c. X+ I7 l" J

8 J4 R4 C. s; A/ O' L. ?, K; F7 \- z. l
- C0 q& n+ f8 X! m( \* a
- f7 w$ v, l: H. G1 t; Z9 Y
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-15 12:41 , Processed in 0.062065 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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