飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
$ R- b" e1 f  [+ V/ {function Connect () {
; }! K$ p0 K. Q8 X1 D/ k, bmssql_connect('Server','UserName','Password') or die('Error: Connection to DB ; U! ]/ z* ]% ]: X
( D% t1 U2 A) n1 z& i% I* C
Failed.');
  [8 E8 K/ ]) ]* n: s& ~( x}
" z* \0 B) g. `; e4 ]Connect();0 q6 k* t/ G; \* _0 ~/ B8 J
  |0 k) _5 U) R; {
function InitForm(){
; G4 @) o' H# U" b//layout for the form
# w& |! c2 p. u5 I0 U' X7 m+ Recho "<strong>Send Items.</strong>
- _# v  k8 q& l4 L" n6 m* u; ^% y<form name='select' method='post'>
3 Q4 u* F2 f" z) l' k, t4 s$ ~+ e<lable>Character Name</lable><br/>
' Z+ M* o. {! W; r<input type='text' name='char'/><br/>
& x. w# [1 {; i! I4 R8 y+ {<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>% d% c1 L9 n8 f1 i) ~
<input type='text' name='item_name'/><br/>
+ V0 O/ P& r. X' T<lable>Item Amount</lable><br/>
6 F# s. [/ w! Q5 A<input type='text' name='item_amount'/><br/>8 P  h2 L/ k) ~. o( Y' g
<lable>Item Upgrade Amount</lable><br/>
' L) `5 T) q' s6 r<input type='text' name='item_upgrade'/><br/>8 Y. y* r6 P; ]5 L3 R6 F
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
7 e/ T! d1 D% f) T: D4 l' d' d2 F6 g% q* s' Z3 S$ q
</lable><br/>
" _% Z/ F& e+ Y, I1 e<input type='text' name='item_element'/><br/>! y/ s: R+ d' q1 H) f5 ^4 E  O4 ]/ I
<lable>Element Upgrade Amount</lable><br/>
6 u/ _* _& Q9 S; U$ r/ H/ C2 y3 V<input type='text' name='element_upgrade'/><br/>* B& h" q, U; \6 |- ?/ W
<lable>Pierced Amount</lable><br/>
; O. I2 \- ?' v' r  t2 k1 z<input type='text' name='item_pierce'/><br/>
+ _: z3 x1 \+ r8 \: S<input type='submit'/>
" h5 E# y3 J: c1 }( f</form>";
8 Z' b% I" X  x# l  c  |# |}
9 n- T2 h* T+ [% Q6 |& _. K9 M. ^+ i0 C) H8 ?
function PostListener (){8 o# I" |- A+ ]  r- r
//Add more post variables if needed and add them to initform() function aswell5 G( ^& N" s8 y6 X6 B, ^6 B
. x4 S; ?+ Q) w6 r
################################
8 ^1 }/ O2 I6 k2 [$ Z! M##### Connection and Post ######
" f# t; N, Z  @+ |& O2 _# Q' `################################$ s/ i( f$ p  G1 ?
$name = @$_POST['char'];
$ h" h  }' z0 m  y$ItemName = @$_POST['item_name'];
3 z& i; G5 ~, z- E" d; c3 z3 B$ItemAmount = @$_POST['item_amount'];. j) W! Y' L- d3 D
$ItemId = @$_POST['item_id'];, ^: a( S0 D# e; E
$ItemUpgrade = @$_POST['item_upgrade'];' q* \3 E9 z! T" |0 V; C
$ItemElement = @$_POST['item_element'];; W2 S4 p+ U' F' P
$ElementUpgrade = @$_POST['element_upgrade'];0 ^; W! J5 \! x! {* Q, x2 ?6 b+ X
$ItemPierce = @$_POST['item_pierce'];
" \9 Q' [! a  L. P4 O* S################################3 J! i/ b/ b" U# O

0 f: C, ^# t' B2 b' J4 p//Check both variables for empty value
0 Q) i# z3 Q) v) I$ |" s0 o: L+ N3 A0 Q) ^
if (!empty($_POST['char'])){; _0 X* A9 l# p9 p
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where + f7 S- O3 W5 h+ u8 v8 m

+ g4 w' C8 ~7 em_szName = '{$name}'");7 M3 {) o6 I9 D4 ~. P3 ^
while ($row = mssql_fetch_object($find)){
( ?: `6 K) a4 ]. q9 J) yecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
* V# a. v5 ?4 D0 {4 F- ~0 n$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],   u" T5 \5 _7 p/ P/ [1 e( K; s1 w: {

1 Z" A" b3 i1 z" M7 R[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], # E3 n  o% f, q$ u8 _' h! b2 |2 D% {
2 |  U3 |8 c1 Z) h  }% Q
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', * f( r4 y$ o+ C2 K' |. ~# e7 P2 m7 J

1 |2 M5 b- Y8 f$ R: P+ o8 l0 m/ \  |N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', , _. j' k3 P2 U' s: W4 O

4 f! B% k3 U' W+ q% |% M& ^'{$ElementUpgrade}', '{$ItemPierce}');");% |& `9 ~) I' ?. R3 f9 e
}
9 ^3 ^; o. j) J% Z' c2 _2 a6 c
2 k: z- H2 e& Q}+ J4 r5 F! V- B) b/ V
7 x) \) W  U6 t
}7 {; S4 ]1 w% g6 m$ m+ x+ u& f
4 f6 s) r8 e* N  A5 A5 E) C. P5 L2 F
$InitForm = InitForm();
5 \; a- e* M( A4 K7 E3 _9 M$Listener = PostListener();
0 @( k" k1 Q9 l3 J' C( \/ v
) B* y7 `9 l: A8 L" X" u?>' p# f' M: K# ~$ F5 l
3 c( V! n) v- r( F1 ^

% h* l. h: q$ L. d# H% _
3 ^4 E$ j9 x) o# T$ a9 z! v/ i: X: m; N( e
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-11 20:17 , Processed in 0.072334 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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