飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php( v$ t! [/ W1 R8 Z" k6 N6 |
function Connect () {: L% V6 m) k5 d
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB / j# K  ]& b5 v6 }$ @+ |

& s9 d3 j) r( BFailed.');+ T: M- \) Z- b2 R
}
" v% ~5 J- [# v4 ~* R9 G; sConnect();
; B8 U5 ?  w9 \, p6 n2 e7 C! T
function InitForm(){
! Q% F- ~3 B! i3 U- v//layout for the form
7 A; L) y0 v5 q6 M8 `echo "<strong>Send Items.</strong>/ o6 D& }& J7 v  G
<form name='select' method='post'>
, s4 K! g( A) x1 z2 L9 }<lable>Character Name</lable><br/>. P7 _& J1 `' ^/ ^. P
<input type='text' name='char'/><br/>
0 A1 e" H; E0 [$ ?% b# U<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>. _8 Y- N9 N1 b) A' j% n
<input type='text' name='item_name'/><br/>
. z3 ]; C2 A( }4 U' k- m<lable>Item Amount</lable><br/>" g4 G- |4 w5 A+ w7 @0 z
<input type='text' name='item_amount'/><br/>
# c  T2 O7 F8 @5 M+ A3 w+ k5 b<lable>Item Upgrade Amount</lable><br/>
& I4 a. _, X! x2 P, q: }<input type='text' name='item_upgrade'/><br/># B3 N. G3 a$ S, J8 g+ f5 C; j
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
% b  a8 z1 I: O3 L6 b4 Q* ~- M& a6 t' {; Y0 n% ~0 X
</lable><br/>) r3 j6 y. x" v* C) q
<input type='text' name='item_element'/><br/>! u# |2 z, [0 x2 E& n; r
<lable>Element Upgrade Amount</lable><br/>
2 G% o6 g6 I7 V# P7 p/ s6 w/ S9 K<input type='text' name='element_upgrade'/><br/>
) s- a8 Q- Q1 P/ k<lable>Pierced Amount</lable><br/>
" j  v7 t8 {% j) q! k<input type='text' name='item_pierce'/><br/>5 F4 b! `& W5 t0 l+ h8 Q
<input type='submit'/>
- @* {" X( f* [7 T1 n5 B</form>";
8 S2 U& q0 @( A+ q}
9 a6 Q2 y7 ^" o' ]$ w+ G6 C* R( J# a( V  j) r, ?6 b
function PostListener (){
, F& r6 [" m# K" V" N3 M' Y//Add more post variables if needed and add them to initform() function aswell4 w/ o  v+ @$ [9 F/ C

8 V6 j7 t4 g/ @) V4 }7 x5 \7 W' p/ H/ q################################5 \( r) t8 @" }8 U0 T+ E( c; @
##### Connection and Post ######2 E% K5 S8 Y! J# D6 E
################################- u" u0 |4 _# T$ ]+ S. G1 Z
$name = @$_POST['char'];) x/ F8 S! Y/ W/ b7 @
$ItemName = @$_POST['item_name'];! h, O$ H) \/ t' I
$ItemAmount = @$_POST['item_amount'];
$ Q" y7 n$ A! }* r$ItemId = @$_POST['item_id'];5 T, E5 p3 U' H% X" o; ?
$ItemUpgrade = @$_POST['item_upgrade'];
7 ~$ [" t+ f, R! {. P; H& G$ItemElement = @$_POST['item_element'];$ x' O/ K; @5 ]7 e. V
$ElementUpgrade = @$_POST['element_upgrade'];+ E9 u$ ?  n: q, _
$ItemPierce = @$_POST['item_pierce'];
" t- ~0 w3 [) {5 l  l# u# O. d################################
' Q, _, `8 x. T' |) [
7 Y. c  N% M7 q6 o2 A. N+ i//Check both variables for empty value
; C! ^3 w, q3 ^: `: s
( n' _7 a% R$ p0 q9 D2 Jif (!empty($_POST['char'])){/ }) Z+ n) a% K5 \8 y) h8 L
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
8 Z8 `. V) I9 |6 P$ L' W2 h! m: k. M% x( S2 o' ?
m_szName = '{$name}'");
8 `9 B  b/ @7 ^5 g+ g: owhile ($row = mssql_fetch_object($find)){
! q' V2 V( `( Secho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
- C6 v( j1 r& Y% Y" }$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
  @: F% u% y, z3 k8 R6 C1 j1 R; K# j: m
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
# R- M6 K; x2 ^! P
; e- B) \3 g8 K7 K" D[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', ( s, u% I* A; g$ r$ m

3 t0 H4 _! l2 P" o9 H3 `N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
; v& O& A- }+ K8 x( u( a: J% B; H' n, `- I; x5 E+ O
'{$ElementUpgrade}', '{$ItemPierce}');");
/ s# V  C& p" {) d4 g* B+ e}: g( b2 \5 m2 n4 j9 w

' o/ b" ?, ^8 _}/ w4 T6 _& e, O: S3 [9 A% R# t5 H
3 g/ |1 j/ ?# W6 s$ i7 G% E# J) W
}
, g0 {  u4 x, V' O1 n" k
  B) a+ j" k! n) X2 G! w- \$InitForm = InitForm();
! H: c* _2 R1 i0 h$Listener = PostListener();, w" r; `) J, t! e* p+ o
2 X3 ?0 o. B; C( X# l7 x1 }
?>
+ W# ~( A/ I% O4 L9 q$ X0 y; R: X9 R% J% q# Y. {" b: P) b  h1 Q

! ^* h5 Q7 K/ {$ I4 b
$ r$ f" a5 j  t6 v' f
( h1 Q9 a3 K8 ?) N" G9 i
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-19 23:34 , Processed in 0.059721 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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