飞飞世界论坛

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

物品发送脚本

[复制链接]

200

主题

203

帖子

984

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
984
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
* _& k; N& s. W$ C* efunction Connect () {
0 \8 e, S( f8 S, y! imssql_connect('Server','UserName','Password') or die('Error: Connection to DB 4 }/ J5 w* H4 r9 A$ u( S3 L

  S. ~/ v2 K4 ]# q! {1 oFailed.');
' ?, g7 n4 R3 t}
/ H' h; W: |9 n  x5 qConnect();3 d8 r! R( B5 k- ?+ g' p

* `% v" w$ A* y  I- @; Lfunction InitForm(){: l/ F& \: I' C/ z  X6 I, M
//layout for the form
5 y$ K- A3 _2 Vecho "<strong>Send Items.</strong>
' S% G, s  R$ U% y& H0 v<form name='select' method='post'>/ T' a( B: D) [# r, q
<lable>Character Name</lable><br/>0 \5 v) T7 _- N% U( ]& R
<input type='text' name='char'/><br/>
  a) v4 Z8 `3 p5 `<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>) E5 k9 j5 }6 q* X1 E
<input type='text' name='item_name'/><br/>
/ N1 U% K2 Y2 ^# V/ O% \1 @* d" E<lable>Item Amount</lable><br/>6 D% A6 i, X" u+ u" m
<input type='text' name='item_amount'/><br/>
  z+ H  Q0 S2 C5 `  ]4 ~2 e; X<lable>Item Upgrade Amount</lable><br/>
/ F+ [2 \( v+ V: r/ M9 Y<input type='text' name='item_upgrade'/><br/>8 V% X( p; d" |
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
) B7 d9 M) `, a
+ L* |$ E1 W0 f$ U, J</lable><br/>
& l9 j+ T' E$ o<input type='text' name='item_element'/><br/>
% x4 I. F" P6 C4 f# N2 H: B6 w. Z<lable>Element Upgrade Amount</lable><br/>
$ }' Q# F2 Z7 F+ ^& m6 h$ R<input type='text' name='element_upgrade'/><br/>* M& }+ T5 O6 [- g/ G" y' v) M
<lable>Pierced Amount</lable><br/>
0 l( W1 A, d  v& S' d* e+ z<input type='text' name='item_pierce'/><br/>; K8 R9 U. K, t: T. ]5 [
<input type='submit'/>9 ~8 |1 }$ l) N0 |2 N8 t
</form>";
+ h  z+ @6 p. m7 b+ m) E}
3 c/ C3 h3 h) P7 h! H$ N7 a* ]" l8 R7 s  x' {( A0 Y
function PostListener (){2 \7 f: y$ n; J2 P( h. S$ w
//Add more post variables if needed and add them to initform() function aswell( W: G# e, [6 d
% P- f' O6 y9 C8 m. h( f' H* f
################################, o  a$ @- w" `* ^1 `! U+ W8 n5 K
##### Connection and Post ######
7 `+ b7 u* {2 l  [8 `################################: E2 I% W# n5 B$ ~* @  A% o
$name = @$_POST['char'];
1 L' N/ u, T/ O# L! W0 K$ItemName = @$_POST['item_name'];4 P1 `+ R; g' `4 Q2 D
$ItemAmount = @$_POST['item_amount'];
' F, D+ u' u* }( O$ItemId = @$_POST['item_id'];6 J- F$ F* `( l/ P
$ItemUpgrade = @$_POST['item_upgrade'];9 N$ n: @& \  z4 D
$ItemElement = @$_POST['item_element'];: B8 K7 x% n6 C- L# ?0 u
$ElementUpgrade = @$_POST['element_upgrade'];! Y. y7 s+ c, _/ J: p- C% E6 V. p5 E
$ItemPierce = @$_POST['item_pierce'];
4 x( v6 W: v9 n################################6 u3 U( M/ {; k6 A* s

7 R( @$ p; S3 a! g7 e; C//Check both variables for empty value
7 q; r/ x& M  G# {+ H( N: y1 @# B5 J
if (!empty($_POST['char'])){
8 P$ _; H' }$ `) x$ n* w, i* C+ p$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
6 w  K5 F8 N  _% L" s/ ^& g" i9 w- l" J
m_szName = '{$name}'");
4 W5 s' C' z& p% s6 p% l& F$ awhile ($row = mssql_fetch_object($find)){
. o3 t9 @0 c4 M& t4 Eecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
: z3 Z7 [) v( r3 U( G$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 8 M3 j. V8 U  B/ `3 M

0 N* M  |7 }, k; K" I4 K[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], ! J; Z3 q1 u( S
& \" e) m/ A$ Q; o! q6 }& {
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
; ~* i6 z( \1 A* H/ y' a# o
7 d' ^0 J" E9 TN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', $ b" x* B4 J. K7 B8 l' \
7 Z5 X1 h! q5 z* V
'{$ElementUpgrade}', '{$ItemPierce}');");
; e1 y. E, _4 e8 m. b& ~  D! b}
2 z' t( @9 ]  A5 b" B5 p$ m" K1 X
}
6 [$ {7 ~* x5 X( P, T' W3 r! m+ V' l: I2 [9 o/ L: @, A
}# p' o( ^$ p/ P" i6 E. x7 G$ b0 Y4 L' c
! ~' B' X4 y) l* ]( E; H
$InitForm = InitForm();
4 ^6 H) s' }6 c- C: }# A, o  n$Listener = PostListener();
) [' n" [% l0 \' j8 P! |4 ?- a
; @) V( f: r1 Q$ j8 B?>  |* t- d- r  @# C
  j- |+ ~4 J7 h9 G9 m7 L$ c. a

8 r0 V" x* k1 t6 J: F0 Z6 f# B5 s$ H# b+ z

8 b1 Q: Y% [- j' [! l) I5 c
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-4-27 04:43 , Processed in 0.063444 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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