飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
+ Y( V$ D- F( D+ \; n1 sfunction Connect () {
- p& N' S0 t  }1 e; a. Vmssql_connect('Server','UserName','Password') or die('Error: Connection to DB $ s- V$ f- X7 J5 P1 E% u

$ k4 E$ p2 M; e  k' ?. @Failed.');
4 S5 S  O3 }6 @}
0 Z' l( n$ Q5 \5 p2 ^: O1 l, [Connect();) ~- \" ]0 Q5 j% ~7 x
3 U- A4 Y) {( I" {; D
function InitForm(){) ?. H# Q5 ~+ s5 h. {0 u& m
//layout for the form: x5 I  C2 X; |/ M5 N( y0 m
echo "<strong>Send Items.</strong>' S6 A7 o* Y, ?: _
<form name='select' method='post'>
- C) O: \7 X$ \+ ~<lable>Character Name</lable><br/>5 Q( }7 ~5 x. e9 T: {" r" z
<input type='text' name='char'/><br/>
8 ]9 v$ K* w/ c- O<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>( @$ R' P! j! C. j( W$ j
<input type='text' name='item_name'/><br/>/ L! T9 I) Q# R) K+ c
<lable>Item Amount</lable><br/>
6 h* o. n* I2 O/ o: Q+ Y" R: p<input type='text' name='item_amount'/><br/>
+ v, m' i% c* R) s+ i" a2 \<lable>Item Upgrade Amount</lable><br/>
0 g; A- H8 N8 D7 ^* V<input type='text' name='item_upgrade'/><br/>
9 N+ A4 {2 G/ }<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
9 F& U2 l' M/ A/ q; M/ t. O6 J
</lable><br/>
: @2 M( F# l% F<input type='text' name='item_element'/><br/>  ~, x+ ~3 B8 b, Z' q* x
<lable>Element Upgrade Amount</lable><br/>$ j* H* K% s/ |* }- X+ q2 ]& u
<input type='text' name='element_upgrade'/><br/>& ~( `7 d5 ]7 O/ D7 j$ E
<lable>Pierced Amount</lable><br/>
0 ~6 l# K, e4 j  L# o/ `1 f<input type='text' name='item_pierce'/><br/>
/ l# c* B/ a3 _4 l<input type='submit'/>
  n, N+ B& A8 [</form>";1 B& q- W# ?* ^( K4 M
}
9 L: A5 a2 ~0 K$ w8 ?& I! D5 w0 w1 t$ Y1 G* t
function PostListener (){3 W7 G+ s0 w# s/ M! O; n1 X- T
//Add more post variables if needed and add them to initform() function aswell
: Y5 B3 E) g. k& U4 @. @1 u$ F5 Y5 A4 v
################################( Z0 W# }/ I; @" d0 O: V9 X% U
##### Connection and Post ######
& j; ^7 f7 u# l################################
& M( r1 |% r5 z( h/ W$name = @$_POST['char'];; J' K5 r9 k% l) |8 j3 ]. a  H
$ItemName = @$_POST['item_name'];' j) r$ p/ r. [( C
$ItemAmount = @$_POST['item_amount'];
% y* `6 K4 j6 ^7 c, C$ItemId = @$_POST['item_id'];
5 k8 t/ E; o" P  k' x) L$ItemUpgrade = @$_POST['item_upgrade'];$ r1 N7 R7 I& w
$ItemElement = @$_POST['item_element'];
9 J* l/ b. g( p" f$ElementUpgrade = @$_POST['element_upgrade'];+ |3 f0 {7 [" w' Y! K4 O
$ItemPierce = @$_POST['item_pierce'];
1 X# k( ]- P  U################################
4 [9 f9 }  t3 t: q3 ]+ g* {. M  P$ [2 J, w) y5 p9 Y: h
//Check both variables for empty value( n( N/ N) l6 \% @( {1 t& c

  X& {- ]$ @" T0 K; [% Fif (!empty($_POST['char'])){1 S9 f- L! U+ ~: K
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where 9 u% P) F: r  K( s7 \( Z

8 V; H9 u5 F5 ]8 x$ t! Gm_szName = '{$name}'");
4 l& _' m% }9 l! o' G$ \while ($row = mssql_fetch_object($find)){  ?2 z, B6 B% w
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";5 Q5 k: n2 T  r# i8 o6 v  g
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], ) A6 C9 _8 z* v& D

' M/ @& @; L# d9 w/ l" N[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
* t: x/ k# N  B/ k" }( U% k
/ q6 N8 f2 Y7 K4 ~; V2 F/ l; N1 w[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 6 A4 `4 Y( E/ j
! s- `2 E' B# [
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', # H/ E2 B" R& _. j; F( K  w
- S( A5 R, N3 j% U8 B
'{$ElementUpgrade}', '{$ItemPierce}');");: A9 H3 j; b6 W  ?+ a9 u
}
" x9 |) Z" w5 Z
! D) h* s# S1 @+ u}
- e0 T/ Q) z# }- m, {3 Q: K& }) u. I' ^. G7 x
}/ Z: ~1 q2 I! w3 P

1 }: J5 e0 X+ b+ C4 m, P$InitForm = InitForm();. o  l$ Q! f4 A5 O/ o& f2 o+ _
$Listener = PostListener();
( j% q$ M6 @, d; b" m9 U
2 O$ L! ^2 k( A% M1 y, N) r?>
0 ~" z, \6 ], q1 O) D' C  Y* Y7 ]+ \

5 _. g* }! U2 k" i, v! E0 T% H- P$ [( U1 U) T. \- T( [
; l9 R. V8 k; R. L; K! O$ w
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-3 17:45 , Processed in 0.064326 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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