飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
9 P7 I0 [' n4 M& Y& \" n7 Qfunction Connect () {& N! }& M$ E2 r+ f$ t& j
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
7 F; c  ~/ D, \- K& e' O/ P9 a* a# j
) g1 Q/ _. c9 }# {Failed.');
# B  z. i( I0 s0 _}4 R$ p* V6 T6 G  i
Connect();
3 q, f# }6 O9 W/ ]; x) w
; c' {2 n3 B  d4 z5 D, d2 o5 ?( h. _function InitForm(){5 H. u: y" y2 D( ^- J, W
//layout for the form7 {  e4 r; Y  g) S9 t8 q% L
echo "<strong>Send Items.</strong>
3 {5 ]  q* Y+ `2 v* i" P7 I<form name='select' method='post'>2 q9 n! c2 x3 }7 _6 v, Q  J# f' t
<lable>Character Name</lable><br/>: v  ?' \8 R* [$ n0 z- k
<input type='text' name='char'/><br/># U; ^0 A1 `  s0 X; M' Z
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
8 j( M4 n: s  D2 M  D<input type='text' name='item_name'/><br/>) L! I+ N) e3 z  `$ r
<lable>Item Amount</lable><br/>
' b# {" ^) k' I2 T( F0 Z. S8 t$ p. q<input type='text' name='item_amount'/><br/>
  ?7 P9 |% O$ k3 o: F9 m" T( F<lable>Item Upgrade Amount</lable><br/>5 U, K" E/ Y4 O, d& \& y+ i
<input type='text' name='item_upgrade'/><br/>
, Z: B  Q* p0 h1 f4 Y<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)' I" W/ y: L& I6 o# {( {$ u

& ?) T; T4 k2 {) I</lable><br/>
/ o! }0 t5 O) f- g0 o% E<input type='text' name='item_element'/><br/>& _4 Z" s; t9 |8 h/ u6 s; F. r
<lable>Element Upgrade Amount</lable><br/>$ i8 H. ]# T, N5 j- t- d( V  r
<input type='text' name='element_upgrade'/><br/>+ p; e- T/ I( j. s4 z
<lable>Pierced Amount</lable><br/>, t  |2 t5 h7 H/ A
<input type='text' name='item_pierce'/><br/>3 G# v( s6 ~1 u9 [0 e) c$ g! `) B, j$ X
<input type='submit'/>
; ~3 W. E( E- h# B6 ^( l</form>";7 O+ ]2 c) B/ S
}
4 f# S% H8 R9 @4 r8 K: l+ D  h
- n' r" C) t8 h4 l+ z2 j' R. xfunction PostListener (){
' f9 D" r4 p$ l4 d0 ~, E% [//Add more post variables if needed and add them to initform() function aswell
  `& w. o6 T1 z
" x# x6 c. ]* W* \$ H+ b################################
! m8 r3 t6 R2 Y7 n8 D+ D2 |##### Connection and Post ######
1 H5 T* e  Q& v& g################################
7 p; F+ ?, F9 T  `3 V7 x6 f$ S$name = @$_POST['char'];) L; J; r, g7 P. Y' a
$ItemName = @$_POST['item_name'];: ]) B1 D- P. \( p( S
$ItemAmount = @$_POST['item_amount'];
# g% Q2 q) f( ^0 e/ r9 V$ \$ItemId = @$_POST['item_id'];* c" m( w9 r4 p
$ItemUpgrade = @$_POST['item_upgrade'];4 `4 F" l: E: Z1 G% K6 c+ Z
$ItemElement = @$_POST['item_element'];; \- k/ n( A/ C& W
$ElementUpgrade = @$_POST['element_upgrade'];
; P: Z8 C8 @/ l! c( f$ItemPierce = @$_POST['item_pierce'];' N# L6 Q+ E  H, [2 ~* ]' {
################################. k" H8 e8 d& }) F4 p. I( F% ]

8 n  \+ w: F* H//Check both variables for empty value
% `0 I9 t% U' V; R# @1 F9 X* C
if (!empty($_POST['char'])){
' v' a( T1 i  o! p$ r( s' B$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where 6 j! [" K- ?4 Y  |* ?( g/ |, O0 H

; {0 }" Q2 X+ i6 ]+ ^' C1 D6 bm_szName = '{$name}'");
5 C$ a4 m, \* l' [' cwhile ($row = mssql_fetch_object($find)){, {8 _  t5 z1 D( H8 r$ h5 y/ K
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
7 k. F. n$ l* U: t$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 8 m8 B# j* Y8 T7 E2 b
/ ^+ W. T4 P5 ^/ Q6 i! |; G5 }
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
( D  |  U9 ^3 M, I; u
2 f! L) Z9 W  |1 z. y3 i, p  D[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 0 ]% ^) b: q7 Y! b- Z3 \+ P8 L

1 B$ H8 I( V+ m# H! ]# F: iN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
( X0 n6 Z9 E9 S; L: m9 d0 m! z! y' b6 \- V! Y7 n; k
'{$ElementUpgrade}', '{$ItemPierce}');");
/ L( g6 Y6 T! t* B$ Q9 j1 n}
( v2 g4 v# S0 Y0 m
; ~) v4 }- E4 y1 w6 v}' q& x8 b8 }9 F' |! a, [- U

4 l" `, _/ P& K  k}
* a" Q- V+ H4 @) d4 e( j0 ^/ I& ~3 D( b# {9 i3 q1 a& L
$InitForm = InitForm();
5 @* P9 J8 a5 ]' D$Listener = PostListener();
" S1 n8 n. b( c  }; e) e! n( ~7 d' E
?>3 @7 p2 a* X9 M( w) s
$ {9 I5 T% Q8 C6 x

# \+ I% Z& c+ H3 f' S7 v, Q
  A* [5 R, O2 w+ T+ W8 s% e6 O/ e' s
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-26 04:11 , Processed in 0.065315 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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