飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1082

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1082
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php( T. s; ^) b& ]6 G7 j) i* g; B
function Connect () {
; A" W0 C& L: ^( i# [2 Z! P+ T" |mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
, V0 U& @' F2 b% L5 Q0 {" _7 u
6 x1 ^/ m8 X$ yFailed.');: [0 M0 M3 Q( w1 x6 q4 h4 q
}, T- E( ]7 d5 G; U1 K
Connect();* N, s/ s% \3 u0 h" D+ s/ l9 P
( N! w7 Z$ }4 w$ x
function InitForm(){
& L1 Z5 ~" y# }; i5 ?, y2 S% [9 _2 q' X//layout for the form* T1 ^+ q& L3 S
echo "<strong>Send Items.</strong>
/ V5 z. L3 }3 _<form name='select' method='post'>/ ^( M# |! g, j( [# \/ S$ d( E# Q
<lable>Character Name</lable><br/>
2 ]! g$ ~+ V8 X, D: c( n9 k<input type='text' name='char'/><br/>0 J9 o4 Z0 b* M8 Z7 v. |7 m
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>9 m' L$ D+ E% R/ M* g) B- c
<input type='text' name='item_name'/><br/># N1 J  q  D! n4 z
<lable>Item Amount</lable><br/>$ Z" _2 v# S6 Y4 {7 l0 S  M
<input type='text' name='item_amount'/><br/>
8 q+ l' O8 E' ?) {* d  O5 \<lable>Item Upgrade Amount</lable><br/>+ a( s( y1 m8 `
<input type='text' name='item_upgrade'/><br/>7 `+ `! X! h1 [0 _, R8 s, o% a6 G
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)8 i& n, g( `0 |* q+ d) j& Y+ J
5 M  E+ s. p: _' a$ ^! r5 K0 Z
</lable><br/>- ^" k% j; T0 W  @
<input type='text' name='item_element'/><br/>1 X+ f, T& A9 |# O' ]( h
<lable>Element Upgrade Amount</lable><br/>8 H8 R9 m1 `- p: _- i
<input type='text' name='element_upgrade'/><br/>
0 z- r! J( v4 _<lable>Pierced Amount</lable><br/>
; L! W4 d/ [& X! O$ D+ d<input type='text' name='item_pierce'/><br/>, ^7 s' q% [) |' J3 y' R+ @5 c
<input type='submit'/>
6 A$ Y8 L9 L# e+ M/ |</form>";
4 ?3 [3 C$ @0 G+ C* M}
7 g2 P! K4 V4 a+ U' ^0 K/ v$ S* y4 p6 e# e3 s$ P5 ~
function PostListener (){8 M6 D  N) h& {) ]0 |  g
//Add more post variables if needed and add them to initform() function aswell
5 ^) f7 P' o/ B
& z" C5 @: u  R0 C' m- \7 o1 n* u################################: }. r7 U: V+ {/ A
##### Connection and Post ######( _( e' N2 y3 O4 R1 q* s
################################
8 w* P1 W; }6 K& b$ o4 H! [5 h  V$name = @$_POST['char'];- ]/ o  f" b% |7 g- o
$ItemName = @$_POST['item_name'];7 l5 @0 r% d$ {2 u
$ItemAmount = @$_POST['item_amount'];
0 C" E- f$ n1 K! i3 W$ItemId = @$_POST['item_id'];
6 I3 x# N" R- s) E, O2 V4 g" y# n$ItemUpgrade = @$_POST['item_upgrade'];
9 ^# t$ j3 R$ V) q8 x  B$ItemElement = @$_POST['item_element'];
* |- E! ]0 _9 Y4 z) D5 B% ^$ElementUpgrade = @$_POST['element_upgrade'];
# `3 F& g* Y8 D+ X" ]$ItemPierce = @$_POST['item_pierce'];
# D9 E4 q$ c# P) v################################
8 l9 g6 v' Q2 i+ D, R# @
" j5 I* r- }; a8 t+ `//Check both variables for empty value# Z* u, g  q0 d

- r+ h: v8 B  Y5 m% O2 oif (!empty($_POST['char'])){% t7 _" i) b) a3 W/ t" a
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
' D3 m. _4 r+ p
' N* f5 D% J5 Um_szName = '{$name}'");
  w7 i  M7 }$ x+ _. M4 U) a& Dwhile ($row = mssql_fetch_object($find)){
+ r7 n% i2 g  r8 S7 j& |, Decho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";: n+ I; R  }0 |( Y7 m5 r8 `! C
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], : W: s( J  q$ ^$ `) s4 n! Y, L
4 ?+ W, f4 y4 h6 q3 Z
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
9 J5 {5 @7 G& D: w, M/ L0 i- J* E% c8 i
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
3 ?3 W6 k/ k; u' Q3 S: J+ e% {# H8 O& O! a
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', 7 k6 n6 I$ n0 D3 X( d2 S5 ~
+ j4 V" J# o3 I! M! r
'{$ElementUpgrade}', '{$ItemPierce}');");, v4 h6 H# i  w5 M1 _1 U
}9 w: U7 o  b$ L2 f. y' P3 G4 S* @

, g7 @& A1 t0 S  y$ x}3 D2 E. ^3 U7 U9 Z6 E. v
$ R  W  A" @9 L4 U; o8 m
}- K3 r& i* n% d" x1 y: T
! X" q' A. P5 D+ O- }% p( \2 \
$InitForm = InitForm();3 M3 h& g9 k3 n
$Listener = PostListener();
4 e2 q+ i3 z" N) X; S
: R8 m  z, K) f" C) Z# I! u?>
) t/ e  ]$ z; j2 K3 _# S2 l/ _2 p% U9 e% B5 D8 ]
. D! W) c. w  {& r! c& V# b! G$ d
. E  W0 F3 O- j) z4 t, L
/ R# ?$ m+ |: L& y  v! |$ }; v
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-7 02:06 , Processed in 0.068865 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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