飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php4 i! c  D7 g) A0 h, p! _, I. x
function Connect () {. Z: C0 i! R* k7 u3 O/ t) d# S
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
  ~5 D! S" z+ [1 i. m$ Z) W2 n; Q4 U, S/ e
Failed.');5 ]5 d; ^8 ~# j, H  ]5 [
}; x5 V9 H# u" U/ b  V8 M% X
Connect();+ E. W9 v- h, O0 n! c) d# x$ f

6 r, H& v4 N- Qfunction InitForm(){+ |* h" O+ }* J
//layout for the form
: U! ]4 L" u- q! E( |) Xecho "<strong>Send Items.</strong>7 y5 H; H) X9 T1 |5 C1 Y: Q9 U
<form name='select' method='post'>  {& q) q# R* z. a$ T# }; \
<lable>Character Name</lable><br/>3 ]: S+ v4 _! F8 l. R
<input type='text' name='char'/><br/>, F2 Y. E- l, Q+ G/ B0 f: y3 Z2 Z
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
! ~$ y7 H( p  X6 p<input type='text' name='item_name'/><br/>
* H; ], N/ k2 q6 M2 n<lable>Item Amount</lable><br/>; E  M7 d7 C  ^# p" Q- k) {7 P" A
<input type='text' name='item_amount'/><br/>
. R$ i" q% Y6 X( C0 Y" {. b<lable>Item Upgrade Amount</lable><br/>8 X  a" s# g+ U+ A+ q
<input type='text' name='item_upgrade'/><br/>* @) Y- q. j  x
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
7 U' L' j* ~+ j4 C6 l; C/ d9 P9 I
8 G+ M  m. V4 ^4 Y</lable><br/>
- j: A, P3 [$ y. N% J5 C$ @<input type='text' name='item_element'/><br/>; h4 J& {2 `: [3 W
<lable>Element Upgrade Amount</lable><br/>" }  E; |0 z1 p. b
<input type='text' name='element_upgrade'/><br/>, H' @7 W: r, V
<lable>Pierced Amount</lable><br/>
; \. q6 p( ~* \. J& k<input type='text' name='item_pierce'/><br/>$ T2 @8 d0 F5 P  V0 ]; k
<input type='submit'/>
2 q$ `2 R) U9 z, m1 \</form>";1 N7 C# k5 b- G
}
/ F& @2 b) g1 D& A7 z$ y- M7 |  \1 a! @' c3 A: d
function PostListener (){
7 Y8 S$ M* m; Q7 _  \0 ]//Add more post variables if needed and add them to initform() function aswell
( L* n6 y$ a- z) Z: |2 Z. w) \8 b+ ~2 [" b. X$ Y$ t
################################
+ X9 l. [  [# c" c; ?3 e7 T##### Connection and Post ######( L  ?# Q3 e$ F# X
################################
4 O0 n. ^+ m! N1 T, H# [! |$name = @$_POST['char'];/ S. u- n6 l7 Z
$ItemName = @$_POST['item_name'];8 f4 t$ b! i  R* I+ ?
$ItemAmount = @$_POST['item_amount'];
1 U4 {& Q: V- a7 J$ItemId = @$_POST['item_id'];
/ |) n* j, X+ W8 S" H# e% R$ItemUpgrade = @$_POST['item_upgrade'];$ @& v3 O) v- t8 |: _1 B& _* D0 q# u
$ItemElement = @$_POST['item_element'];6 Z1 t7 u$ X& B5 `0 k) {0 s
$ElementUpgrade = @$_POST['element_upgrade'];3 N; `, E/ `$ e# z: U' w7 E5 g2 R
$ItemPierce = @$_POST['item_pierce'];
6 m3 |0 b" ~$ G( l4 w+ n################################
/ o' `1 U. Y6 m: n( w1 i" v3 ?  ^7 e- e. Z
//Check both variables for empty value1 f, F7 n2 p" f! Y4 M: x* o
+ y' k+ }* {! Z9 q6 u6 `8 E7 ]
if (!empty($_POST['char'])){
$ ~5 [* L7 o/ d" |3 x3 t# {; K  i$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
7 c; u) u" Z- }/ L# @0 E) a' s
. R) E. k1 p% t! I$ Z9 Im_szName = '{$name}'");
+ j4 g. c6 @& k  e! i3 V% Awhile ($row = mssql_fetch_object($find)){0 Z( J% U# I) W6 x# N0 }
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
$ R( F  g0 Q' g: n, L& e6 C$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
# Y2 k4 Y4 `6 P4 f8 h$ ~! M5 ~" U6 y0 u) p" B$ U' e
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 6 K0 Z% G+ K8 f" p) q3 g9 e
6 C, {: O- E( d# `
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
' B4 Q; Y. }) j; F, G5 X; |" M
+ e' a6 f- M: K. n( H5 ]N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
! B: }0 k  ]2 [8 j, U4 g3 B8 K% T/ C8 @0 Y% ~3 P, @% V+ E
'{$ElementUpgrade}', '{$ItemPierce}');");- d# |- ^" m/ L6 {8 A
}
* ?: G& b" T% n& t" D! e1 b( F% ^) D2 t& r9 ?, F$ v8 }
}
& M' K" E# k2 g! R: D& n9 G, C1 s& A
}" _4 u& p1 K; l* \* I, G
7 L  c! V, J, r7 ^3 {! l
$InitForm = InitForm();2 s0 l( S2 l  G$ y" m9 f& }
$Listener = PostListener();
+ w+ W) [" D# l' A/ z
: h" |  K& h4 U' e3 g* u* L' o9 N) p3 y?>
4 Y; P4 F& b& p: B7 ]" A8 e1 E
. z& I' O# @8 x& H. t$ u% R# s* y/ t1 f; x
: G. y) i" g7 r% w6 S
5 i: B+ a2 }! S+ u  l
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-18 13:28 , Processed in 0.058979 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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