飞飞世界论坛

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

物品发送脚本

[复制链接]

200

主题

203

帖子

984

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
984
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php2 [" N: x. p: M* l: c! ]- W4 l
function Connect () {4 ~  p5 T: S9 P( l) i% t8 T$ |0 z
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB & Z! \$ v! j' v) ]7 i

- K; c" P6 q  YFailed.');7 G+ v" i- c: z1 v% y
}
+ g' t2 J2 [9 q" ^: c  `9 \4 EConnect();3 X4 A3 S. V, o9 ?. U* E
9 c5 F* U7 ?2 v- k- }, R
function InitForm(){
5 W- i4 H; N0 `6 T5 n//layout for the form4 _( L8 _. c2 t% |* a  V
echo "<strong>Send Items.</strong>! Z' y5 O& ]2 e  x
<form name='select' method='post'>8 [( z9 z! s% e% b! n
<lable>Character Name</lable><br/>
- n" a6 E' {) i! q8 s* ?! V<input type='text' name='char'/><br/>8 D, f: E* X1 h: u9 i5 a
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
3 O$ ]5 `9 B5 o8 ~<input type='text' name='item_name'/><br/>
( Q7 }7 u% y0 T* g0 n<lable>Item Amount</lable><br/>( V8 o- W; k+ `: r1 Q: s$ P
<input type='text' name='item_amount'/><br/>: O- j2 t! y9 D; Q  \! X
<lable>Item Upgrade Amount</lable><br/>
& B3 b/ R1 T1 @/ s' j" R<input type='text' name='item_upgrade'/><br/># u5 l2 b7 \5 ^0 |. |" K7 l
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)3 k* W1 Z2 o" Y: T
. l$ B: V1 l% L; S
</lable><br/>" P3 i# X) N9 h. P# c. }
<input type='text' name='item_element'/><br/>. r+ K3 g0 F7 }0 [- I5 G
<lable>Element Upgrade Amount</lable><br/>. p* S$ K( `6 r# k7 l& E$ q1 A9 V
<input type='text' name='element_upgrade'/><br/>4 ~4 i+ w7 C7 @+ ^* K# H9 d: L
<lable>Pierced Amount</lable><br/>
' G8 a9 b& W. E$ C<input type='text' name='item_pierce'/><br/>0 h9 c- C" X9 F9 C5 n& B
<input type='submit'/>( V- y/ ~5 ?7 c
</form>";, ^8 \+ n. U# G
}
6 Q* q3 T1 q8 ~0 A5 A% s) E7 V
0 e2 o8 V" ?7 `4 q( }function PostListener (){0 |5 ]* ^* ~$ S% D- Q- N
//Add more post variables if needed and add them to initform() function aswell2 O' b0 g! a8 u; e9 Z6 d1 R
! `. s# i1 Q) Z& S2 J2 L
################################
2 Q1 w  O+ R: E##### Connection and Post ######& i+ v: e3 |/ X! Y- r9 X
################################5 h' i! J4 u" y, p3 o: k
$name = @$_POST['char'];% |1 ]! M- t, n9 z3 Y/ y, R  _
$ItemName = @$_POST['item_name'];& \9 }. P3 |5 O' {
$ItemAmount = @$_POST['item_amount'];
/ s) Y$ o8 e. g* h$ItemId = @$_POST['item_id'];
" @7 H, L; X8 \$ [: C; ~$ItemUpgrade = @$_POST['item_upgrade'];
( p6 S2 Q$ l7 B0 o$ItemElement = @$_POST['item_element'];0 b1 [8 t* N! g2 D. p" v* y. ?
$ElementUpgrade = @$_POST['element_upgrade'];  o" z( \  I) P$ {
$ItemPierce = @$_POST['item_pierce'];( R/ u" p; b7 \# x7 B8 F; v
################################( n1 x$ w  Y9 E* `2 }( s
9 u. U, Q* k7 ?
//Check both variables for empty value
" G  `! }( z; o% J8 z% }1 [& _- S  s! Y% b# M9 s( v
if (!empty($_POST['char'])){
: q9 }! F' w- c3 e" `+ c6 ^/ A1 _$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
; P% F/ a+ I2 c! @0 a# w
7 ~! u$ S" X$ v( @m_szName = '{$name}'");
# [7 C+ y* O$ E0 Ywhile ($row = mssql_fetch_object($find)){2 j, c) t5 ?$ M* `
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";, {# z: @4 I9 j
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
7 L9 K# M7 k. T4 P$ C& G! q% N: ~/ `7 k) E: E
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
0 t# n$ V: f/ R5 h# [( {+ B* C- l4 W) I- r$ S0 V; I4 d# l& |: v) H4 }
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
( h$ U4 f% _: X. c% H9 P- p) m
! ]  l9 d! Y  |, k% i4 l' E% W0 kN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', ! c5 A1 a4 |7 U3 d4 O
+ R% e7 b& p' l) V( ]
'{$ElementUpgrade}', '{$ItemPierce}');");& j( k) B2 G1 B& V  z
}
) P! G2 }. w: |$ ~; R3 w7 i9 A# ~: y" f2 \
}) T$ I9 Q4 x) H2 ~4 o0 a) l
5 v3 W: E0 U/ {4 @( T
}
2 _- w4 x, z+ I! ?; q
9 _  |  w* j6 `& N5 s2 p$InitForm = InitForm();$ D0 w. k& k3 A$ H7 l2 e4 b3 y
$Listener = PostListener();% v0 t' @3 L, K; n
9 z7 ]8 I7 {6 {" `& F, x
?>
+ s! b+ K8 U% ~, U0 ^) _, v; {1 ]% x1 @2 O% O

9 o. R3 K% s8 D) D! r$ N) _$ z; u& ]2 X

( u5 {! n, u8 s6 ~
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-19 23:34 , Processed in 0.069941 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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