飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
5 @% u; l4 `1 f- I6 `  u* L( ?  Ufunction Connect () {% e3 Y/ u9 J! P* L
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
! `" x% |+ D  P7 @# i4 K$ `
  k0 i# P  `4 o: {) QFailed.');; o' @( N6 I1 \: h! v9 B
}! w2 d: V9 _1 _0 F' K) [
Connect();) T! `) @" |, ]( q0 Z
$ ]+ r# a4 H9 j" B0 w! i
function InitForm(){2 B7 b: ~: S' {6 p$ {/ ^
//layout for the form/ @/ W/ B0 T, G7 F
echo "<strong>Send Items.</strong>) n& m4 z! M" s* q* X2 U2 i2 x
<form name='select' method='post'>, q# X+ K7 C+ Y8 R% N- C, ]6 T9 ^
<lable>Character Name</lable><br/>
  J" U$ e) p+ u. u3 N7 _1 M5 R. M& b<input type='text' name='char'/><br/>
3 s& W2 I5 j& D$ D# w' b* v2 M<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>9 D# C- C0 u8 p) b
<input type='text' name='item_name'/><br/># ?* ]1 Z3 M: s, V! s
<lable>Item Amount</lable><br/>
/ @$ w2 D& l* ~# D* e<input type='text' name='item_amount'/><br/>
% O/ C" p' o7 B  t! O" Z) L<lable>Item Upgrade Amount</lable><br/>
& A1 C9 j2 R' B) K% W' g<input type='text' name='item_upgrade'/><br/>
+ y: a; o5 }9 r" R<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
; Y1 r( R0 z2 B/ |5 G$ B7 S9 Y3 i- R# z
</lable><br/>
. R7 h! k/ p; [6 J3 C2 a, V<input type='text' name='item_element'/><br/>
+ G# x! M# Y# U% m% o4 W1 X<lable>Element Upgrade Amount</lable><br/>" J5 \: ]; Q$ P# `/ Y( g# Z% {
<input type='text' name='element_upgrade'/><br/>) p8 N  y& y* T' T& ^
<lable>Pierced Amount</lable><br/>
6 k3 T  \. P& G, \  ^4 l$ c/ q8 n<input type='text' name='item_pierce'/><br/>
7 d# V, Q9 m9 ?<input type='submit'/>9 T6 t! V% P( T& {* z& y; f2 z5 t
</form>";/ ~: L$ {3 {: e+ o4 L, q' n
}: j, D4 a, M" V% I% W3 J
) k; C: Z- I5 d2 Z9 Q
function PostListener (){
3 {& @3 J* X# m: q//Add more post variables if needed and add them to initform() function aswell
$ K* i$ X4 X4 u: J6 u' I7 c( \+ ?
# ~) c# e( J- {1 @: `################################4 f& a3 |' ?6 w5 v4 B
##### Connection and Post ######
- z* u: m& {: o, z! I1 H0 u################################
6 D) i& d8 N& ^* G$name = @$_POST['char'];
  r8 H3 m1 o3 h9 Y. B6 d$ItemName = @$_POST['item_name'];
. i! J- w; }, \* V8 O$ A$ItemAmount = @$_POST['item_amount'];
5 z0 F% n3 d: R$ItemId = @$_POST['item_id'];
# [) E* c3 O" o+ E. W& J$ItemUpgrade = @$_POST['item_upgrade'];
8 D, ^/ v, b5 q  N  b4 L% H0 E$ItemElement = @$_POST['item_element'];
4 _) }: q* x0 e. O. F$ElementUpgrade = @$_POST['element_upgrade'];( `$ E9 X: i8 N: S. Q6 B9 c* L1 {
$ItemPierce = @$_POST['item_pierce'];, {4 M$ _9 i$ {0 D7 f
################################
% q" ]# m% [! W7 E5 c! t" v$ k: G! J
//Check both variables for empty value3 {1 T7 u- Q8 G7 e

6 ]6 _9 u/ E" }9 a, sif (!empty($_POST['char'])){3 H& v, A. x" f  d
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
/ N. D' s7 }: q. `4 j6 L1 f. b3 \/ s/ k" @. t' R
m_szName = '{$name}'");
) ?+ Z5 {* f3 t) [0 w- d- zwhile ($row = mssql_fetch_object($find)){
/ j+ U7 A+ ]9 S& z( g* Cecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
: Q6 A# L$ u3 {, K$ D6 _6 f, D$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], ) Z3 ~9 x' s  d/ V

/ e  X! I& G! E, e" N& H% \[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], / Y" V3 C" }' d! C0 \8 T

0 R5 k( g% B% a1 e[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
  p( Y/ }& g  u5 ]% W  {, ^
+ T% {# L3 I1 D* ?N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
# x0 r5 d& }4 t6 S
3 k4 C- P- V& Q6 d2 ]'{$ElementUpgrade}', '{$ItemPierce}');");
8 j/ p0 F' z  ~0 f0 R/ h}  ?1 r. u( b4 p3 i- D6 e
/ Q7 |& a+ g( R+ N' h6 D% z
}, Y1 t0 x5 c& V% \) m- X

$ l$ ~) d9 c% e}/ ^# f: a4 D* V! ^. s

3 P" o# l6 r, ]: c( u; @$InitForm = InitForm();
8 ?6 H& d7 C- E) F$Listener = PostListener();
4 X$ _$ F6 y. _8 M* o5 U0 c" h8 B) G3 p# T4 K' U3 O
?>
5 K5 c, Q5 D2 t- K) o/ }% ?1 v; V+ \, {

$ {, Q: }) X) T. L, E5 F! r. T4 n7 y! w. r, ?6 b; W) x

7 U; E& d) Z% v# }
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-16 05:51 , Processed in 0.057258 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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