飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php: x) k5 S) x0 B. {' l5 e6 O
function Connect () {
+ ^" t, W4 }. k: B" d0 Mmssql_connect('Server','UserName','Password') or die('Error: Connection to DB 8 X* i) j! F  X0 ~7 F' {
- N9 X0 P/ c  u4 v' |7 O5 W
Failed.');2 U2 S' @( M# ^+ g
}: w+ w; L* @4 i1 X7 o
Connect();
  f2 S* o" M# ^- _* {; A  i& P% r) ~0 }6 U, ^" ^  |# M
function InitForm(){
5 L8 A; D+ }% z0 h6 Q//layout for the form$ f+ @! D" G! m
echo "<strong>Send Items.</strong>
  D3 @! y1 M. l' r6 B% P<form name='select' method='post'>5 c% J5 H. }. x5 W9 V1 ~) w
<lable>Character Name</lable><br/>/ Z5 I6 E8 G* \) u/ d" q0 Z+ i
<input type='text' name='char'/><br/>8 x* i/ ?. Y8 u/ D/ u, K. @2 d: @
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
7 q6 v! h$ h; q# B& z- h2 |- T  M9 _<input type='text' name='item_name'/><br/>
1 o' k5 _8 C! X" y4 o<lable>Item Amount</lable><br/>
! B9 N2 A( w9 ^7 w<input type='text' name='item_amount'/><br/>
# O/ q: [# Q7 ^/ N+ C' }: ^<lable>Item Upgrade Amount</lable><br/>/ b% u( I- V& V3 N* y
<input type='text' name='item_upgrade'/><br/>- g" r. S0 c+ C) b, F2 g+ V
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
/ H  p" E% p2 z% E
/ y, d' I% X9 |9 I</lable><br/>' h) P, f, m; K- H, [  ]! V, _
<input type='text' name='item_element'/><br/>/ p( A: g" l( ~; b
<lable>Element Upgrade Amount</lable><br/>% X: j0 E9 p5 V$ W3 s
<input type='text' name='element_upgrade'/><br/>" s5 ]; @6 F5 z: w, p
<lable>Pierced Amount</lable><br/>
2 ]$ k; V+ |- e% J<input type='text' name='item_pierce'/><br/>0 P5 n& z+ ~5 K; L2 r' F4 N, c! W
<input type='submit'/>! f6 e1 M/ }' k, Q
</form>";
1 \1 x2 J. H9 b6 {' N, [}# m7 Z1 R+ N& c; S1 |0 r6 S

: I7 l0 W- y, O4 Kfunction PostListener (){7 l/ x4 M4 n# g: T
//Add more post variables if needed and add them to initform() function aswell
5 V. i4 @4 ^) l% Q" ?7 G
" m, o5 [! n+ Y9 ^################################  i8 ^% ]+ n. N" p8 p
##### Connection and Post ######6 v5 W9 {8 G$ L  p8 q
################################1 o) G) [9 o' [5 A, g' f
$name = @$_POST['char'];
# c$ @# a5 C4 ~/ ^: ^7 q; Y' T$ItemName = @$_POST['item_name'];$ @; T0 ]% x' C7 E; i
$ItemAmount = @$_POST['item_amount'];% y  N5 \, `. w# C3 |7 c
$ItemId = @$_POST['item_id'];
6 o; _. N8 p+ ^! {8 A; j, o$ItemUpgrade = @$_POST['item_upgrade'];
9 b" ]  z' x& @$ItemElement = @$_POST['item_element'];. i4 F) o) A5 c0 j: y, B# `
$ElementUpgrade = @$_POST['element_upgrade'];
6 a$ C% Y& @: I$ItemPierce = @$_POST['item_pierce'];* [7 N: f. c- v9 Q; v3 f6 j
################################$ E" e8 H1 c* p, [* E

( l& q9 F3 Q5 p* F1 y8 _3 J& x! s//Check both variables for empty value
  v: l1 G7 h! o9 A7 j. s: ~
- t! |  j* I7 w/ A) N1 Q3 p- rif (!empty($_POST['char'])){' F2 ~7 O- l. U% w+ A# y
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where 2 U1 C$ D. Y2 v% W) A: |! z0 h
; _1 g5 G1 @7 [- t( j
m_szName = '{$name}'");# V! |% b5 q- K( G/ X/ c
while ($row = mssql_fetch_object($find)){
# N7 J* ]. d& ~6 S9 V; A- o% lecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";" w2 b( C! F: \; A
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
1 ~# a* Z- I7 {  X' N; F' `8 W+ g, x) b2 E
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 6 Y- D2 b0 V' h2 H7 p* u

1 i6 X# r% w+ V' }[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
% e8 @& Y6 u7 y* y4 o; Y: |& S
4 @! T; e8 m3 M8 |N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
- d. A% u8 c: [- o; h0 L. o, n/ H0 S  C. O
'{$ElementUpgrade}', '{$ItemPierce}');");5 Y' K1 E/ |. C) s1 }
}
% w6 z: K8 ^5 P0 h
1 e& d- {/ S# n2 d9 \1 \}# ?1 X+ _! ?: W
& L9 q7 ~2 a. V; O3 c( I$ J/ a
}
, q. o$ C: u9 D: o0 a7 g
% d2 Z7 ~, V! U0 k% I$ h$InitForm = InitForm();
' |: M2 h8 H- ?/ ?5 o) w' ^$Listener = PostListener();
  N2 h! r3 |$ x8 f# Z4 Q+ r/ ~9 t1 N+ M  N
?>
% a6 I/ u( _: ?* g9 e1 j) I1 o8 |- B$ q' v2 c( t
6 r7 `5 v6 f6 C( j0 J4 X
* X, b5 S0 v2 e) V' K6 ]& M8 Q/ O" I2 |
; \" j5 t8 @3 t8 y
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-11 10:18 , Processed in 0.065824 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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