飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1092

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1092
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
<?php
8 E8 u/ H) S$ b7 P  Afunction Connect () {, v! {- b! j. E6 S' u5 v7 ]$ R& p( H: s
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB 3 j+ M: R  |/ m1 ~8 }8 [
6 y& n" I; Y" a
Failed.');
# g! Y) w; b/ a( O4 [}
- j0 g& Y# `2 w/ dConnect();
- |3 q5 u6 z' |  v& W3 Y; @8 u9 Q8 w* f6 O  d
function InitForm(){
0 {' [1 S/ L1 E8 b9 l1 S//layout for the form
, v3 W( \' q1 j# Aecho "<strong>Send Items.</strong>
& f( b! K$ k; Y% h4 @* d" n<form name='select' method='post'>  r* H0 k8 O- @/ Q6 H# {2 H) u" H
<lable>Character Name</lable><br/>
% L0 n+ f$ X5 u' r* E<input type='text' name='char'/><br/>4 k% u- b* V$ Y+ l+ Z1 L0 e/ y' J
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>5 ^; S1 X* o% B
<input type='text' name='item_name'/><br/>
! R! |  z* Q* C<lable>Item Amount</lable><br/>
6 Z/ z9 M9 p  a' f<input type='text' name='item_amount'/><br/>
- Y2 i. {! n. S! {0 V/ \2 v9 g<lable>Item Upgrade Amount</lable><br/>! h6 W6 o  F+ i0 Q' o
<input type='text' name='item_upgrade'/><br/>
  K1 E& e- [3 g& M! ^: m" t7 h% j  h& X<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)0 D: m; x7 j9 z

! }& [6 a% M: L</lable><br/>
7 f; M8 Z4 n! ]% w2 `<input type='text' name='item_element'/><br/>
2 s) S: j  r- M( i, {<lable>Element Upgrade Amount</lable><br/>
7 v8 X3 `7 h! M$ F+ V+ y/ C9 n<input type='text' name='element_upgrade'/><br/>6 A  w: x# W( D+ F
<lable>Pierced Amount</lable><br/>
9 P3 w' N6 o6 N' t7 O) B8 G<input type='text' name='item_pierce'/><br/>* C, G3 C7 Y6 |& _# Z  B
<input type='submit'/>, b) Z. Y* a" q+ I  Q6 a
</form>";
* L6 O( T) ?' I/ l3 O9 a8 l}
, ?' ~( _) X0 y- e
' c4 Y) b0 N1 h& K& D& Y/ ?  vfunction PostListener (){
. f1 J  L$ t3 D  z//Add more post variables if needed and add them to initform() function aswell0 x% r' s* v: j1 I$ i

, T; R# f) M  S* C2 U: F9 \################################
1 f: ?9 @; E' `$ k. o##### Connection and Post ######1 T! w' W- r: l
################################9 r1 I$ I8 N6 C2 [( k
$name = @$_POST['char'];
: g- |( t; X" u7 J$ItemName = @$_POST['item_name'];) J& Y2 W* f2 Z7 L7 k1 V* ]
$ItemAmount = @$_POST['item_amount'];
9 n/ ?" R4 E' H$ ^* b+ z. _$ItemId = @$_POST['item_id'];8 D6 w3 s- l' {
$ItemUpgrade = @$_POST['item_upgrade'];
9 E) j7 r) K- _$ y$ItemElement = @$_POST['item_element'];4 W/ y: X& j; C8 D
$ElementUpgrade = @$_POST['element_upgrade'];
+ J" O5 X; {( R( w# k$ItemPierce = @$_POST['item_pierce'];
  `* w  v1 d1 I5 q################################0 |! F: C' L# h

8 Y* j, |: _- J. D//Check both variables for empty value
( c1 o7 N) \) w$ x3 V3 i9 l. |6 x; S8 D+ B' k4 V! C7 O
if (!empty($_POST['char'])){# m8 F$ V" W3 k, I0 A, o" `
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
* k( T$ i! d% }( ]; ~
4 n/ g2 G+ t% S8 sm_szName = '{$name}'");
/ u# h6 p: W3 B. Pwhile ($row = mssql_fetch_object($find)){8 A; o# U2 P* f0 ]1 _( I' b
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";# v6 T2 k% i/ b: X7 ]: d! N+ h2 c
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], / K* k( K6 k/ F5 c% g/ O

7 Q  a* W# e& W( B/ ]) ^[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
: n; p  ~* L' V9 B; t( w
* A2 A$ s% P6 [2 B( X) J; x$ g[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
. S- {* g' g9 u: }
0 t* n" }: o+ G. WN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', / ^! Y* y8 m' d- M$ y1 C
7 E3 S7 U  v  U- f% w* h3 u8 e1 f
'{$ElementUpgrade}', '{$ItemPierce}');");
& }' M- E( _) s& d}
9 y! G+ d7 z3 q. W3 u6 L" M6 c
0 |/ l8 o* w; L7 ^; ^. M5 W}
) w+ N* Y4 t( {) p% ]4 O
1 B0 s' d$ F( i$ F}
3 X; n9 W2 `# P7 k6 \$ m) q5 T
7 q$ X4 x$ ]% x( n# x- g$InitForm = InitForm();
1 c7 D# C) M. F* [7 o: k$Listener = PostListener();- N: y9 \7 K! w( i; ]( f. J5 o; m
/ Q$ s' N5 q8 o; t' x" o
?>- @8 n" Z/ S, p, L
5 c1 y2 _: J5 \9 L3 A

5 I' I9 O& p8 f2 M
* v" t: C4 h! _  a! k+ e
7 w; `0 f3 m+ m
回复

使用道具 举报

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

本版积分规则

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

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

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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