飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1090

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1090
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
7 z, R  h  e0 d: I2 T( N/ e* C' `function Connect () {
% @( C' ^6 K9 h# x# v% imssql_connect('Server','UserName','Password') or die('Error: Connection to DB
. c7 z; R: z6 ^# a2 m& g" l  ^# G4 B% b* Q- L" r* `
Failed.');
  b0 k: v% n" e4 J; c}
' x3 E! }9 P! Y: u' a; Y8 f+ DConnect();
% N% N$ z- Y) @! r
: n# P9 s. l- f! z/ |function InitForm(){
& w# {5 w; c! n9 w2 L5 V//layout for the form* l4 ^. u; m' ~# |
echo "<strong>Send Items.</strong>; Y; {) S  X* r5 ^8 \
<form name='select' method='post'>
! R' e  ^  ~" H5 A4 D+ I, L<lable>Character Name</lable><br/>
0 E9 a+ s, x! ~% `6 }<input type='text' name='char'/><br/>6 f' p$ u6 Q" o' v( |
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
* V7 L* S" T  k+ V) ~$ g/ X<input type='text' name='item_name'/><br/>2 Z% ?4 B5 h7 r, C1 |) m( g4 O
<lable>Item Amount</lable><br/>- N3 m. @* K+ J! u9 v& c
<input type='text' name='item_amount'/><br/>3 `) b3 t/ e0 p9 W. Z
<lable>Item Upgrade Amount</lable><br/>0 j9 F9 D* |5 o: D
<input type='text' name='item_upgrade'/><br/>! H9 @' m9 X7 g
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
" t4 d8 M3 H) h
% ^% Y: Q- y7 x3 J</lable><br/>
( u  W; |& w, R; h<input type='text' name='item_element'/><br/>
% o4 U! L+ W* U. X9 `$ _' A2 R<lable>Element Upgrade Amount</lable><br/>8 e' e/ n+ D$ c+ [$ @
<input type='text' name='element_upgrade'/><br/>& N8 F4 q. S5 W4 k  k8 K' I* S
<lable>Pierced Amount</lable><br/>
: J+ X" w$ G. l3 u<input type='text' name='item_pierce'/><br/>
' @& \8 m4 {' ~8 I2 k2 s<input type='submit'/>
) ?; _9 M, ^# C) S; N  v/ k</form>";" E( |' [% t) k" v7 y$ P9 C* \
}8 ?, f. D5 j! M" N, m) R5 n
$ V7 i5 H( |$ u; l% \. a4 z
function PostListener (){; K2 Q' Z8 K" e9 s3 w& w7 e' l
//Add more post variables if needed and add them to initform() function aswell- |. D' O( u  {3 T, ]
/ e5 j# b1 E1 l. N8 }7 Y8 Z: P
################################( T: m' g! [, b
##### Connection and Post ######/ }- f. s. R" n" I" y
################################5 s# F( s& {; e; E# s! H
$name = @$_POST['char'];0 E8 x/ l0 t" Q/ r+ H1 k# ~( M# y6 d
$ItemName = @$_POST['item_name'];% J: P4 l- u) M' H% W
$ItemAmount = @$_POST['item_amount'];
: ^$ u) Z7 M* J4 @7 i$ItemId = @$_POST['item_id'];
6 o3 @' I- c4 @4 T+ s8 u% Z( y$ItemUpgrade = @$_POST['item_upgrade'];4 W( \1 j- d8 a3 k/ X3 H
$ItemElement = @$_POST['item_element'];: `# g( |( i$ z3 H8 Y8 U0 b
$ElementUpgrade = @$_POST['element_upgrade'];
- v% ?) ?/ A1 d' D$ItemPierce = @$_POST['item_pierce'];8 x* n5 b/ c. a& n; I4 a
################################- J$ b. K  K9 o! m! y1 Q3 l. C1 x& \
0 {: L2 f+ t( |- A/ g! w& _* F- A
//Check both variables for empty value* B. B$ h# m! l# e

' T+ f. F  I, ]$ E# vif (!empty($_POST['char'])){
' V. H" i' w* j9 a$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
- C* a5 x! q8 R& A0 @
2 r$ d$ h+ r( Q, q5 E5 G) Fm_szName = '{$name}'");7 A. ]1 U. {; p$ t. ^
while ($row = mssql_fetch_object($find)){
4 ~, ^" c7 z- z; r+ g5 K# {& Becho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
: g. J8 n+ {/ S$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
5 ^: _& Q. [; H: P4 `* M- M- F
0 z6 J/ c( v) q7 C0 [[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], # F6 U. {7 z$ z. q, O4 S+ ?7 U. f# s/ ^
, P# U9 _# x$ X1 s5 |6 E
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
+ i0 H$ m+ a% v$ k7 ^0 d3 X" @! |. X6 E
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', & j7 x: I* v9 s8 w/ @: w9 G
1 n- _* q5 ^' v! L2 n4 I" x
'{$ElementUpgrade}', '{$ItemPierce}');");
* g) A/ k( K: h% O; k0 ~}9 B/ \# v% r- J5 f) W$ p: Q& f
. U' f( P( q6 W# l; ?: N
}! R7 c4 L7 G4 i: h* e: \  X

1 J+ Z$ {3 o4 V. Y6 p" d}
( z/ K" E, B2 }* e7 y
, `' W" z! d9 G' T1 f7 q! G$InitForm = InitForm();
4 @# ?3 u; F8 A0 d$Listener = PostListener();
2 m) s1 z2 E  ?, u3 w
( e. A3 a$ C$ Y6 {" F4 N9 o3 A9 d?>  x8 l  {  Q# L& Y, h1 C) L
9 g' Y8 \; N( Z2 D2 ~
; s/ m3 ~8 H% ^2 {% J
" a" V- i* M# t" M1 o9 o4 B: `

3 G  c, U- ]5 q6 u4 x$ s
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-26 19:41 , Processed in 0.061037 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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