飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php' _3 |( F. h" l# h/ V$ Z
function Connect () {
, G+ j, V4 Y0 H8 ?& N3 Q2 Imssql_connect('Server','UserName','Password') or die('Error: Connection to DB
% Y' i: s% ~* x/ p* g4 w* t  F0 D4 t: u) {
Failed.');( \- n" ^9 t8 w  S; H# \
}/ s  T. J4 J- ?; \
Connect();
+ E, H) x! B8 \" V  Y' c. N" [2 I" Z
function InitForm(){( O. K& V0 c5 @* u* n9 D
//layout for the form
0 z+ A0 X3 S. G8 `* V( u. p7 xecho "<strong>Send Items.</strong>
. S) x' a9 D% u8 M<form name='select' method='post'>- K; S" C+ D" Y7 g" |+ d2 C
<lable>Character Name</lable><br/>3 N/ f9 ?8 O* H# Z0 r3 J3 u
<input type='text' name='char'/><br/>
& L9 d0 k0 G8 n  t<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
( }  J- w2 r: K: I9 P; s<input type='text' name='item_name'/><br/>7 B; d- T' M- f5 P' V$ T
<lable>Item Amount</lable><br/>
% n2 z. C/ Z+ V$ `1 p; T9 ]<input type='text' name='item_amount'/><br/>! r0 h+ \$ }; e' U
<lable>Item Upgrade Amount</lable><br/>
9 E% b; H# {2 y% D6 w- P<input type='text' name='item_upgrade'/><br/>
& S! P! r0 u) q5 O" ~" q$ e' Z<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
- m/ v) _3 s/ O3 k1 z) j
) Y# w1 k' s) u2 i9 \</lable><br/>3 \! n% o7 _& P$ A
<input type='text' name='item_element'/><br/>* g. {% r( B) c9 v: P9 ?" U3 i
<lable>Element Upgrade Amount</lable><br/>
: E8 r) S2 H8 U4 _3 U7 [4 I# `& T) N2 W- `<input type='text' name='element_upgrade'/><br/>2 L" S) \/ \8 p
<lable>Pierced Amount</lable><br/>
& o0 L/ @2 K" v0 S3 J3 u<input type='text' name='item_pierce'/><br/>
" _6 e9 z; S5 L' e  h' ^<input type='submit'/>9 S0 j3 D' N  t8 K% a% i
</form>";
1 q3 T% V6 c3 V  y1 t2 a}
) ~: u+ ]6 @% {  v! h8 e% b# W2 _2 m  ~
function PostListener (){
+ e8 X5 e" N* C; C//Add more post variables if needed and add them to initform() function aswell
, I1 V, O6 |0 ]6 M5 @# Y" h
5 g. ^% |+ o$ |- u: N################################3 g& d: s3 }, h0 C( B; b8 t
##### Connection and Post ######
' Z9 M3 g8 ~/ H" b################################- b- w7 F1 ~8 F$ _# \
$name = @$_POST['char'];: f& @( e0 T6 o& T; i6 r
$ItemName = @$_POST['item_name'];; Z; f3 Y; C% V3 w# i% D' t$ v
$ItemAmount = @$_POST['item_amount'];$ y  l. h; [. T6 e
$ItemId = @$_POST['item_id'];
- M$ K: I" ]) A( k/ N$ItemUpgrade = @$_POST['item_upgrade'];
2 B3 C' L, d2 Q) W! n& A+ n$ItemElement = @$_POST['item_element'];
6 B6 j3 B' a& V0 K# U/ b( E! z! m1 \. j) e$ElementUpgrade = @$_POST['element_upgrade'];; n  z0 C' G4 T% ]3 I
$ItemPierce = @$_POST['item_pierce'];
% R; @' b  @: l; n4 p5 D: }################################4 U4 M, D; `6 q9 R0 s

" Y' W/ ?2 B2 m3 ~% c//Check both variables for empty value1 `# x5 s  R, ~! l8 ?7 Y$ ~

$ I# j! T* q5 D5 Aif (!empty($_POST['char'])){
$ P# ]. ^3 X* k3 L* ~$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where ) N6 g5 D5 n0 Y0 c, B

# R$ J, ], O1 B' ~8 a1 z5 d" Am_szName = '{$name}'");" u; {% n, n  i
while ($row = mssql_fetch_object($find)){
+ k; y4 ]( D/ D8 B' Cecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";- k5 p7 X$ s' O  h" S
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
" f3 G. e+ g4 \" s' w9 W1 |! ^2 j8 v' f2 g  d' |
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], % k% n: B4 Y' W6 g+ X$ c+ [/ ^8 @1 h

" A! G5 z( a+ C$ M, n2 T/ R9 B. d[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
" h4 [5 y3 u. l" c& k! l! B: P* l! q  V2 k$ H1 ^7 `7 D; W
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', / F' }  `# i' l1 S6 s
) h1 I" L8 O. @+ u9 d
'{$ElementUpgrade}', '{$ItemPierce}');");
& N9 G9 X. y8 z* N9 G+ i0 [}
& U8 r; Q) V$ S. |6 o9 j/ n' E* o- p# W! t' H4 f* F1 Y
}7 `, `/ j. K% s% N4 ^

4 Y/ r$ [; }3 l9 k: W, d1 C}% W5 e7 `! A* |1 Z& d
) I. e! ^4 V3 `& u
$InitForm = InitForm();
9 x! Z7 \% l" t: {! l2 q) b: j- j$Listener = PostListener();2 x! X7 H- @- ], J

+ I6 i+ x, Q  e?>+ h6 }" `( {& O9 g* T# x
+ o1 @& t3 Z1 Q! D8 w

; D! p% F4 D4 l" F& q5 b1 L9 {( M/ N3 |; P2 }: ^9 ]
& R* m# s" ~. x. R& R% ^
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-12 07:36 , Processed in 0.057682 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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