飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
2 P) ]: d8 J, U# g, gfunction Connect () {
8 S. F7 I8 F2 Wmssql_connect('Server','UserName','Password') or die('Error: Connection to DB + P/ w# f, Q" R6 m: b
/ ^: h1 b; Q$ M% `6 \
Failed.');
4 E" Z: u( e9 x- A* k}
& Y2 r+ W: g2 G& k/ WConnect();  k% a4 T3 h# l" ]/ W) a) H
* d9 a% b6 }/ b; v, r6 a
function InitForm(){
1 H1 I3 ^9 Y3 K/ }. \4 R& l" D& e" ?//layout for the form' d& ?- G% L" X
echo "<strong>Send Items.</strong>" q; K- G. Q) I8 v
<form name='select' method='post'>
$ ?9 D. d, \) @  L<lable>Character Name</lable><br/>  L9 [7 N; j$ P' x% O
<input type='text' name='char'/><br/>4 l; g% R& R6 B2 x3 a: S/ T
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>! ~% q4 [& W; m8 S1 [& Q2 C9 a
<input type='text' name='item_name'/><br/>
! K  B, N  s3 z; W5 e<lable>Item Amount</lable><br/>
2 {) b9 E% ?# C) R; Y<input type='text' name='item_amount'/><br/>
1 Z# M. Q& ?0 T# X5 s<lable>Item Upgrade Amount</lable><br/>* K% o, N% f+ V2 C5 E2 D; o! x
<input type='text' name='item_upgrade'/><br/>
5 p/ Z6 l, c6 B6 t) l! `<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)+ R2 |; ~+ ?# l
# O- n1 f# {: }* C# p
</lable><br/>* d  [$ {) u7 I. `1 l1 e# b2 U# `* t1 ?
<input type='text' name='item_element'/><br/>$ R9 N* ?3 x% R! t
<lable>Element Upgrade Amount</lable><br/>
1 {8 U3 c: C3 q9 {0 w. X7 T: I; s<input type='text' name='element_upgrade'/><br/>) B# x' ?' L  u8 z# ]" E# e$ \$ D
<lable>Pierced Amount</lable><br/>
; k, _$ d( k' t( v<input type='text' name='item_pierce'/><br/>
/ m  C  b0 y- y7 ^* m1 [<input type='submit'/># o! S; }( ]+ ?
</form>";2 w6 n4 K/ J5 _+ ~& f
}! y/ @: h& U& O7 v

$ [4 [8 t( [% ]5 Q+ n4 ]function PostListener (){
5 B' D1 I+ }. q& f7 O0 z0 f. R//Add more post variables if needed and add them to initform() function aswell1 i% m. N9 I5 d% E8 }* v
0 l* L/ M4 l3 M+ |6 `7 b/ y0 |
################################, n$ |; ]  ]- e8 `% d) u2 C' V% [
##### Connection and Post ######* |! }7 D6 B1 }2 F
################################
6 p  {$ Y+ B! S: Q$name = @$_POST['char'];) u+ g" z. p' G: U9 c& S
$ItemName = @$_POST['item_name'];6 H6 H- q" C( [, T
$ItemAmount = @$_POST['item_amount'];
  H' }3 r. A# x+ P3 V$ItemId = @$_POST['item_id'];3 S, e4 Y0 j+ S8 G
$ItemUpgrade = @$_POST['item_upgrade'];
4 n* T5 z  n: [- Z1 l: U$ItemElement = @$_POST['item_element'];- p7 M) d/ L/ _+ s% o, ~8 D! E
$ElementUpgrade = @$_POST['element_upgrade'];% G! d/ I( g* ^# [: B2 G
$ItemPierce = @$_POST['item_pierce'];6 h  b! z5 F6 s- c3 \" p
################################
' V( i) U) d# M; _4 z+ d
/ c- B' U. l, J) v5 \//Check both variables for empty value
  _3 T* d+ R- V* d. V7 u8 m. J! ?
if (!empty($_POST['char'])){: b4 u, k- P& {  }+ N
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
8 V) E1 C$ |5 o# }) ~0 h. w' m6 l- I. D/ y) h/ a
m_szName = '{$name}'");
. e  @  ~1 b# M! _5 Gwhile ($row = mssql_fetch_object($find)){
; ?1 {- W- l6 ?$ z% V7 A1 h/ o+ lecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";- ^! |6 s( B) s2 }
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], / N6 r+ m5 I$ g8 t& E: V& q# _- M
. V" b& r. F4 `1 }) Z) H) @$ O
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
0 \; ^' _5 z* v1 d* a: y% l9 G; w% O9 T3 [. T
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
5 H7 ^" L, m  a7 B) W# w9 k& ^' l3 |0 S0 h
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', 8 h4 ^; L9 Z0 {
8 j7 J; ~& d* U+ k8 ^" ?! A4 R) |3 h
'{$ElementUpgrade}', '{$ItemPierce}');");* U9 y* G# n) x' n% U
}4 P+ ^2 S8 ~" p0 B: A) z9 i: O1 q; V

7 r, w! R$ `) ^" j, D& F}8 c8 H8 q" C0 `" h( E

8 Z6 k, h3 E5 k$ Y}
+ B9 m* v; c" j2 C1 e+ B* F: E9 V1 |9 r+ P/ ~! w7 m" ~
$InitForm = InitForm();
9 T. C  f* {! Y' D: Z$Listener = PostListener();: ]7 G, z+ H4 k  l7 f6 \$ L. t

" M7 ]4 a# c" n?>2 Q7 J" J$ z- f5 }0 w) ]; I
# n$ Z( P! Z/ O; ~  l' k
% B% ]. T* u* l

" I" t9 A2 Z# h. Z+ d
: ^- i+ b$ h1 ^
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-16 11:53 , Processed in 0.065623 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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