飞飞世界论坛

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

物品发送脚本

[复制链接]

200

主题

203

帖子

984

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
984
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
6 }& D  W" i$ D$ d8 Sfunction Connect () {/ n9 Q4 h, c- w% o* {6 s
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
; J7 h5 c. B0 h, a4 {% L
3 f  w3 W9 c2 y8 c6 U( b' NFailed.');
+ w  d3 G6 \4 ?6 F: X}
: o( y" P/ D" jConnect();$ F2 }; r& T7 _* N- C# Q3 {" B
0 U4 H3 @7 e! S: i2 G* ~! l9 y* ^7 o
function InitForm(){
: H' j* I# k! ~" }  D9 O+ o7 n- ?9 \//layout for the form
9 O" |. a& o2 a) E8 Y/ e7 kecho "<strong>Send Items.</strong>
! P1 K% B% M7 D" F  c: i<form name='select' method='post'>
9 z2 H6 ]5 l& ?& H/ O<lable>Character Name</lable><br/>' t2 b0 J2 t3 ]# t' y/ b# Z. f' f
<input type='text' name='char'/><br/>
/ t+ |2 r" ]+ ~: i( X9 \' m! d<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
) f0 g' I$ q6 P5 G( Z& F<input type='text' name='item_name'/><br/># ^4 M9 B" j4 ~! o" g2 W
<lable>Item Amount</lable><br/>
1 A  A* t9 @! o  R<input type='text' name='item_amount'/><br/>. }" e& \8 ?& D
<lable>Item Upgrade Amount</lable><br/>
3 U' f- Z2 V/ m/ N<input type='text' name='item_upgrade'/><br/>
/ K' f& }) u+ U7 V1 Q: G3 y<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)5 N) ]6 v# x! R+ D

2 }- F4 r" r; w) {- P</lable><br/>
. F- v/ `# L) j% G7 ?9 Y7 a<input type='text' name='item_element'/><br/>
, y- @2 |6 y% ^: J) E<lable>Element Upgrade Amount</lable><br/>! L. }. L1 t- D- n; u$ T
<input type='text' name='element_upgrade'/><br/>) ~4 h; ~1 b; @% Q6 y& y
<lable>Pierced Amount</lable><br/>5 ]; l) {2 x  Q9 M, a" G7 i# w
<input type='text' name='item_pierce'/><br/>
7 j' \: [  B; L0 r<input type='submit'/>
3 t# I1 A: [7 M# m# y</form>";8 J( a! L4 t- Q" Q# t, D+ F: E
}$ D  Q) M. ^7 n" T  N. a

8 U. B4 M7 I3 G0 x2 Zfunction PostListener (){
4 {7 M" |3 x* r2 O! {- }( F4 C//Add more post variables if needed and add them to initform() function aswell2 T' F0 n0 J7 s/ A/ u& \8 Z) a

- i7 N/ g2 \' P( w) I6 I################################! b! {" r+ s; `6 C$ L
##### Connection and Post ######
& N+ ?  \/ R6 z: g################################3 F' d; u2 A9 H
$name = @$_POST['char'];
' `0 K2 \; R0 p# V; C, B$ItemName = @$_POST['item_name'];
: u) }4 r' P5 R$ItemAmount = @$_POST['item_amount'];
, S" m0 ]  T& Q$ L$ItemId = @$_POST['item_id'];% p7 V3 Y3 @: c; [/ U" M
$ItemUpgrade = @$_POST['item_upgrade'];4 V) \5 \- u7 F
$ItemElement = @$_POST['item_element'];# \& T! u" W( U( i6 u
$ElementUpgrade = @$_POST['element_upgrade'];# U: }) V) t1 d9 p- q" b7 J6 u2 ~
$ItemPierce = @$_POST['item_pierce'];
% O' S+ w1 |, {7 v# R################################" V0 X) R- t2 y' y
; B* y8 P) M; t" z
//Check both variables for empty value" d/ P, e/ e, Y" I, C9 w! Y, O

  N2 Z" t2 k$ {* Cif (!empty($_POST['char'])){4 J. C' D  O! z6 Z% u
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where & q: M, k  P& e" _' @& q

  D; C& I8 p9 m" Z8 {m_szName = '{$name}'");9 g; E) s1 r; Y# d5 k/ G5 d% S$ m
while ($row = mssql_fetch_object($find)){% l. W! y' j  f
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
$ q) Y) |& W* X! j$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], / u1 H; n% ?& n" ]  F$ x# y

( ^5 L& T7 ~5 d0 S" |[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
3 q" E% p$ b! o( O& V) m' i# I8 c4 ~3 ~. O
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', # F; a& T( [+ \0 ^3 U

' Z7 M& t9 J. jN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', . l: a8 G, r; z/ M# T

% ^8 A1 c8 d3 L) e'{$ElementUpgrade}', '{$ItemPierce}');");
  o; C9 `. `* j! K5 b}% T% y6 A9 v& c* g2 Y& F  W

7 x. ?6 p6 Y7 ^6 X9 {}" ?: ?. B: o2 Y2 o6 z

+ b! M( U4 h4 {5 F6 w8 v}4 ?! G! ~* B! l, [+ W; E
- I# T. E, n5 ?: `5 N1 K
$InitForm = InitForm();
  o1 N& s, V9 H% m' K2 y+ t4 B$Listener = PostListener();! H# l: q. x0 x( Q' o
; z4 D% `: r; i/ Y1 W1 N
?>7 {4 t; Q$ K, U! _! {
; [  D$ i6 `7 ^# o* v

0 D" F7 z/ ?5 L; u8 d; Y( x, G1 D1 [) P
2 Z1 [0 K* R% z9 i! `2 l$ j! {& G/ [1 {2 _; Q; i
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-7 22:52 , Processed in 0.062697 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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