飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1064

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1064
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
! m( \4 n8 D& xfunction Connect () {$ ]# j% X: E, Z) L
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB 3 C( @# x9 Q7 m$ {

5 z+ @( ?. l% T" k" B9 {Failed.');$ U8 @# N8 Z: k4 y( g7 o
}
+ u/ v1 D2 q+ `: M. M2 M0 nConnect();0 x7 G9 V4 l; {/ ^0 u; N+ k* V
0 U, J) @0 e' H% H
function InitForm(){% r' v- `, t8 n9 \8 v% \
//layout for the form
: }% Q- V% B; j- Y! a' D0 h) Hecho "<strong>Send Items.</strong>
% z7 i& Z4 X5 }6 \7 o2 c<form name='select' method='post'>: y+ m* m1 D7 u0 f. A- `
<lable>Character Name</lable><br/>! |$ L3 m/ i9 _0 @' Y2 g3 U) O, L
<input type='text' name='char'/><br/>* c. R4 G% u* y+ v0 I9 y' V
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
$ s3 N% U/ h9 Y3 t: A6 Z# H<input type='text' name='item_name'/><br/>
/ [5 n4 k/ P- A8 _- ]" r) _  P<lable>Item Amount</lable><br/>( Y# D. R. b2 W: `
<input type='text' name='item_amount'/><br/>& I* r- b+ }* S$ E, u% \
<lable>Item Upgrade Amount</lable><br/>" m0 c! [: I- j8 q9 s
<input type='text' name='item_upgrade'/><br/>
6 c4 J) [( L4 J5 z1 U* Z. B<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
  @0 `  y6 `) G" n* P( h9 _, _" B" v" m8 E$ u
</lable><br/>' N3 K8 e" \. f6 F* u
<input type='text' name='item_element'/><br/>5 V. h8 C1 d7 D5 d  [
<lable>Element Upgrade Amount</lable><br/>
& R: D$ t: z$ s<input type='text' name='element_upgrade'/><br/>5 T, g5 f/ X6 }; S: {* S
<lable>Pierced Amount</lable><br/>9 N# I# X0 V& O1 }6 Q8 \
<input type='text' name='item_pierce'/><br/>
8 u; {7 \- z0 W" h( r5 K$ d<input type='submit'/>
7 ~- }5 j5 E9 I% E" h* l' w+ H1 K</form>";: n9 T9 b  j7 v
}' A% o$ Q: Q* ?% q. r
* M. U* k! U' }1 N; h$ w5 a8 \
function PostListener (){
' i8 i3 w) S. o! ?% y3 x" U# N4 f( e/ ?//Add more post variables if needed and add them to initform() function aswell
; @; W* k# T; _7 f" I# n4 a
5 N4 ]/ H- f6 g################################
8 V- E8 ]! o9 Y##### Connection and Post ######0 u9 K' d$ P# t0 Z3 i, `
################################
5 R8 n1 z  o1 m6 J, q- j5 o8 F1 f$name = @$_POST['char'];3 M2 Y& g7 H- Y4 a- @% c- x" G. D0 K
$ItemName = @$_POST['item_name'];) F. \  _& S1 D  H
$ItemAmount = @$_POST['item_amount'];4 E% @: Z2 u: U4 k
$ItemId = @$_POST['item_id'];7 _1 h! w9 h$ \
$ItemUpgrade = @$_POST['item_upgrade'];
/ V3 q4 P! g& ^" l0 L$ItemElement = @$_POST['item_element'];+ p& N5 `# o  M- `
$ElementUpgrade = @$_POST['element_upgrade'];
0 w0 z# w* [8 x/ t) n$ItemPierce = @$_POST['item_pierce'];
4 ~0 |# K# z" X0 d/ ^################################1 h: n4 x/ N7 h

6 S% Q4 u/ X5 U* ~' f6 D1 h0 b//Check both variables for empty value; e' z1 h3 x8 ^# c
* K, k1 v( E  ?6 P8 L
if (!empty($_POST['char'])){
; l; h$ g7 B3 m! z$ S6 c3 j; g$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where . V" D7 T/ P7 X9 {
  O$ f2 P" j) W8 I7 }6 K# T
m_szName = '{$name}'");
% N4 Z  {0 n" k4 w+ Z( h! G) Swhile ($row = mssql_fetch_object($find)){
/ c; V* Q8 k8 x  @) E9 Necho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";0 i! r6 V; Q" T! {! D5 Y
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], ! e0 p! s+ t1 R7 Z5 T0 O

! Q: B% A) j* q/ Q[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 9 t: P" G* x% {, J$ l/ c+ l  M/ h
  Q/ ~1 b  W- S7 L+ i! r
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', ) W+ ^. M9 I5 ~) Y* R5 [

6 h' C* F7 |3 o; ]N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
8 P- a6 x8 ^" w- Z; t5 r( R8 p' n+ ^2 q
'{$ElementUpgrade}', '{$ItemPierce}');");
8 N1 |2 {' g& E7 b. h}
+ l' k. H; E( Q$ t( }6 S; P& o+ K5 d5 r
}. I: U( h% q. T, J$ a% _
) f* H$ o# l- R$ h) i  l: y( N
}
* e; s. @; ]4 |5 U8 T0 ^
9 t6 `9 C1 n, q' O5 }! W$InitForm = InitForm();  q6 d5 w' Y) Z& C+ q0 |; L
$Listener = PostListener();4 G+ g# r# Z/ b% L
$ z6 X7 C7 v! q; d, K" ]! t, x6 W- |
?>
5 X: j, n5 K8 U- ?3 p+ [: x8 e  Z+ {9 H# y. M
& H* y5 u* N8 @: j. c* U6 h
0 {( d3 [. u: a8 w, O

# H, ~$ j. c3 O' v
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-7-9 15:53 , Processed in 0.065184 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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