飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
<?php
0 A5 I/ R% l4 T3 z; w5 Cfunction Connect () {  g* w* N' u/ y# ~1 z9 ~9 I
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
; b0 G4 w4 U. Q9 u1 A7 P# i- t: b
Failed.');
0 Q, J' ?! t! C" g}
: c" ~8 ^/ R$ m; S. WConnect();
0 x) A! Y3 K% A2 u% d' O) q# S. G0 I+ F
function InitForm(){% z, B8 Z  r9 [6 r3 ]
//layout for the form% F' l: L( }/ z
echo "<strong>Send Items.</strong>
/ l+ _; d' K  d0 ^4 L. q" ], q<form name='select' method='post'>- c0 n. Q! e- I$ |3 |, U/ Z2 j' y
<lable>Character Name</lable><br/>
4 E1 a( g) t0 m$ N% I# Q3 P4 l# n<input type='text' name='char'/><br/>0 B2 V0 B( f+ x/ D0 {
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
6 [1 Q$ I; D" z# E5 N$ N. C% j: j<input type='text' name='item_name'/><br/>: U' D% w7 @" B' ~$ @
<lable>Item Amount</lable><br/>3 M2 x! a' o. C1 h- A: [# u4 _
<input type='text' name='item_amount'/><br/>( J1 r2 V( e. z% m4 Z( d, M8 c5 l: z& h
<lable>Item Upgrade Amount</lable><br/>5 j% n  y# R# X: S$ G3 `8 Y, h
<input type='text' name='item_upgrade'/><br/>
! Z' I) V1 K3 ^5 i3 Y4 Y<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.): @2 c7 N! _+ t; f- ^3 X% A$ g  Y: e- A

1 U  [. H( z! q. u</lable><br/>
: N* C* h/ {: d6 t2 Z<input type='text' name='item_element'/><br/>; s( C2 e  L- O# k. b( A# K4 N1 W
<lable>Element Upgrade Amount</lable><br/>
' O# L% \( r! V8 ^: [1 I<input type='text' name='element_upgrade'/><br/>
6 V; s2 Z  f5 ]<lable>Pierced Amount</lable><br/>. e% ?& n% @. H5 o1 Y. _: T3 n- r1 S
<input type='text' name='item_pierce'/><br/>0 j, k* P2 D$ X) c% J/ x
<input type='submit'/>) G% V6 u) J4 i6 g5 k
</form>";
7 @$ o, Q9 `3 n' [! P! G}% a  G# y4 B; p6 a

+ A" l5 E" q& P6 d) {function PostListener (){1 J* t' k* V$ M: x2 I% l% s
//Add more post variables if needed and add them to initform() function aswell: _. ~& L) \' S% u4 h
4 S" P$ i6 p" B# r2 w' ^9 d% j' ]- V
################################
' N& W6 R8 Y) \##### Connection and Post ######
' w; k! n& Z+ M. c! |################################% x5 U& s/ z9 J) Q( l8 v0 f; \0 I
$name = @$_POST['char'];
  j& p$ K* b# X6 k6 A' L# x0 Y& Z) y  Z$ItemName = @$_POST['item_name'];( |! c/ \8 z) V2 E, E5 {5 K; w
$ItemAmount = @$_POST['item_amount'];7 n2 X% _/ F( c2 c+ N5 @- y- ?
$ItemId = @$_POST['item_id'];
3 S, ?. z/ M/ v; u$ItemUpgrade = @$_POST['item_upgrade'];
$ G) P+ u$ f- i$ItemElement = @$_POST['item_element'];/ ?6 t( ~) z6 F. y! O$ u; b" F
$ElementUpgrade = @$_POST['element_upgrade'];7 {0 w- D2 M) t' b! B
$ItemPierce = @$_POST['item_pierce'];
- s% A* t2 Q% R1 S! X! C8 c# Q5 g################################0 W8 u. U" j2 @# d
) I" z8 W: s$ G/ b# C# j1 T
//Check both variables for empty value, @. C4 R: a, N9 ]4 c
8 g: o& H( U9 T, h! i% M7 v: ^$ }: G& t, D
if (!empty($_POST['char'])){5 X" C4 v8 o! p' D& {+ I
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
7 B7 D$ W7 U$ u  C( q) v+ r/ k& h. D
m_szName = '{$name}'");% f+ F& v) d& ?# ^
while ($row = mssql_fetch_object($find)){  ~; d3 R  E- p& i; d, @1 l
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
5 s; c6 ]; X9 L) n( G# D$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
2 ~9 m* ?5 E/ l& I5 u8 {- p' S$ a: \2 O& `& R
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
/ q, Z4 H! u& j! Y6 d- U8 S5 e
: s+ J% N) H  n+ m& D1 |+ ^. O[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', ) u: l" m# j2 w7 _1 w
  j  R3 [; N) Q1 \& L
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
3 j7 S7 u7 a, c4 l# ~9 ?" z: d9 R4 e4 V7 f  ?3 F1 W: f
'{$ElementUpgrade}', '{$ItemPierce}');");" E8 [9 B3 t/ F6 o$ @: C$ r& X
}
: o! ~' a, g* W# d- s" D
2 R! q+ V6 F" Z2 f, r}3 _7 ?# a/ d* y0 h2 {, L& `% h; ~: \

, W7 \* G/ v- R2 A( Q$ u8 D}0 m& G$ u) J/ S

. ?% r) v+ z, B+ O# `! S$InitForm = InitForm();
0 @; ^: |$ b# \. C" ^' u8 c$Listener = PostListener();9 \; e* U% P8 S/ o8 b% u! k9 R. P

7 }4 H; `9 z4 g?>
& t3 g5 `# a+ k* y( U/ Y$ w. k
  L# V6 a3 }% @5 k9 r4 U# u
- |/ e3 |# ~# D( |# Y, g
+ l/ o# d4 K( q' f) q; c# x. {
! J/ g2 [% }( m& T
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-3 17:51 , Processed in 0.066883 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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