飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php6 U' ?0 N( [# n# P( W' H
function Connect () {/ c1 p6 M4 o3 S! [
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
8 L/ D% s9 G& E+ B3 j) r& h
8 }* k. Y. j4 X: n4 n/ \( V& v& XFailed.');
6 h7 p1 _& v+ l. J. C}
3 S' w( x6 E, D7 r8 K0 U$ b4 yConnect();$ ]5 F! r; ?) F7 ]- a

' }; _! L8 v2 \7 P% B7 Z6 {function InitForm(){) {0 u2 V* X: N4 X# Z
//layout for the form- ^! [6 D7 X" t7 ^% o
echo "<strong>Send Items.</strong>4 i: t2 Z& g; q
<form name='select' method='post'>/ R- H5 n( R. j5 y) C
<lable>Character Name</lable><br/># H: L: Y1 e# A$ a: R# {
<input type='text' name='char'/><br/># C: v" a8 M* M5 G+ M
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
4 Q5 {; f9 ^) @6 @4 Y7 A! C; @" U<input type='text' name='item_name'/><br/>, T5 E2 m3 K' x% V# }: e
<lable>Item Amount</lable><br/>; W* q8 b; ~! F" I9 W
<input type='text' name='item_amount'/><br/>+ Y+ M) M( l9 }
<lable>Item Upgrade Amount</lable><br/>0 L" J% D7 C& D
<input type='text' name='item_upgrade'/><br/>% b. B7 F1 u6 j1 D2 ]/ F
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
. [3 J  k( u9 P3 {% i0 U3 u) ~% v( W6 {: w: ^9 q: D
</lable><br/>
# {: o% C3 ^' Q<input type='text' name='item_element'/><br/>
2 t7 C' U! D1 M- K5 Z; b: k  p1 a<lable>Element Upgrade Amount</lable><br/>
3 a& J8 e8 z% u6 a& e- }; w<input type='text' name='element_upgrade'/><br/>) n% @8 V6 Z; V4 I" i8 I3 W: m
<lable>Pierced Amount</lable><br/>
" P/ ^; ~# S# Z& B<input type='text' name='item_pierce'/><br/>
+ q# e& |# A# u<input type='submit'/>) ?- S; \( X( [
</form>";
  q9 f. N& [' Y! S/ c& `1 P& V5 z}
. g+ J. ^8 e- I* ~6 N* l8 R* h- q! T8 |2 w
function PostListener (){
) v  r: p! m. d//Add more post variables if needed and add them to initform() function aswell
+ Y2 R( |1 v7 f5 a! y: J7 O7 f
) W. |! B3 t- q) N################################! d, u- s1 D. O- y8 W
##### Connection and Post ######
4 L2 D3 v3 O! z' c9 b################################' ?. S4 _( i; ^) m9 y+ ~4 f* l
$name = @$_POST['char'];
6 g+ h- J& e/ o8 |2 J5 l$ V; d$ItemName = @$_POST['item_name'];; x) {+ B7 _! a
$ItemAmount = @$_POST['item_amount'];' O# u. f) l- b- }; Y
$ItemId = @$_POST['item_id'];% Z) L) u4 }. Y) w
$ItemUpgrade = @$_POST['item_upgrade'];
4 J- o! S% M% R$ Z  L1 h) a. I$ItemElement = @$_POST['item_element'];; Q% m+ J  ~4 J3 [2 f/ t1 ]" x+ s: {
$ElementUpgrade = @$_POST['element_upgrade'];8 ?* n4 ?8 \9 H0 j1 b
$ItemPierce = @$_POST['item_pierce'];
  V  G7 Y6 S. U0 o5 x) O! {' @1 G################################5 t0 W+ a% E0 R$ @3 Z

5 n' s9 }* J6 q* ^0 D/ h6 K  g//Check both variables for empty value
; F/ A, G  h' B9 s7 p& f3 g! h$ K; E. l4 l) \5 w  W: H
if (!empty($_POST['char'])){
1 F5 e- @* `( X. W5 Y$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where $ T5 E* z; a0 J4 `

- s  ]2 {% {/ e6 R/ ?m_szName = '{$name}'");
+ H$ W& `* }4 f; f0 M4 f& V+ Awhile ($row = mssql_fetch_object($find)){
( H. R6 ]4 ]& y3 J  G8 _1 M# v. }2 Zecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
& {. S/ Y2 b) |" j$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
* T  X" g8 e& K2 Q, T4 l3 x6 n1 x3 Q4 G
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
  T) Z* m) k) m* E( \7 p8 R6 y- Z, T( M' ~& i& d8 y
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
# t! P$ ~8 x8 g+ {, g% }1 L" w3 A. Z9 W- N. @" e; d" c5 _
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', ' |# T4 X/ u% o4 o/ W

7 y9 ^& P" y8 a" j+ }'{$ElementUpgrade}', '{$ItemPierce}');");# N* ?! \" R2 _5 ~6 }
}
, T% Y2 Z6 A, l2 V1 ?# j  a6 L
; U( Y4 K4 V& p7 n: o}6 h$ m' o- Q9 a

; M. y/ ?$ ~, E' w}
+ E% E/ j, q9 v) J- h. z3 Y6 W/ Z( x
$InitForm = InitForm();" m6 V0 n" y+ j9 K' v
$Listener = PostListener();
1 A! o: z; {. L5 T, j
$ \9 r8 d0 |. d. {* S3 G% d5 C/ i( X?>9 Y) ?# M2 ]& P
; e5 S2 t+ C2 ?# m, K) G3 }5 [
" T$ k& ^3 Z- b' [# I$ c: l# l

9 ]. f$ O4 \" `' C7 ^
* Q: t, Y' }4 R7 P" B( k* |6 r& s# O
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-13 14:17 , Processed in 0.079361 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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