飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
  d7 e0 L& r( qfunction Connect () {- @) Z5 z3 o* D- d, y9 }
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB # y- B3 M# B& u: }" H- G: K
  H# e+ e. v7 N7 x+ ?/ c  ?
Failed.');' N8 n3 s0 t. G5 e* u, `+ W0 y
}- U; F& X& |7 I  i: ?; l4 Z1 S6 u& z
Connect();( Y: S9 z3 k' O) `

% g4 v' @" z3 ?. t1 y% {; wfunction InitForm(){
7 H  I* x2 h! }1 S//layout for the form
( o3 ~0 k( D/ P3 Oecho "<strong>Send Items.</strong>
0 A" ?$ h8 X3 H7 E<form name='select' method='post'>* J. J( ?0 l# }) D0 O( o9 `
<lable>Character Name</lable><br/>
: F& [( {8 x8 r0 v<input type='text' name='char'/><br/>
% W7 ?7 u+ M& ]* C9 F, x( l<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
7 m- ^8 X# O$ D<input type='text' name='item_name'/><br/>
+ @0 H1 c# O1 j; P( \! }# o<lable>Item Amount</lable><br/>
, j# v$ Y2 ~- D" [1 l<input type='text' name='item_amount'/><br/>
' U/ Q" j/ M1 c! s4 C2 \; E<lable>Item Upgrade Amount</lable><br/>$ c  B' o% P, Y4 H1 ]& g. v
<input type='text' name='item_upgrade'/><br/>
: U" C: u; e) j1 t4 w7 ~$ b4 W<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)1 R2 A% M( g0 W' f( K4 m, `
. k1 x- L+ z; P' o6 [
</lable><br/>
  }+ k" K0 S, R1 Q- [* C" x4 N9 v<input type='text' name='item_element'/><br/>9 w9 l9 a1 V9 c
<lable>Element Upgrade Amount</lable><br/>5 Z$ U8 p  o. p* ]7 \% {2 t
<input type='text' name='element_upgrade'/><br/>
6 t1 ]' H6 S0 x$ V9 y  r/ e, G<lable>Pierced Amount</lable><br/>8 B9 W9 j1 b8 H* O9 c5 j4 c
<input type='text' name='item_pierce'/><br/>
; Z3 e6 E+ v1 e  E( T$ C  Y8 A<input type='submit'/>
  s' Z) @) l+ e8 ^</form>";
% e% ]& I0 n1 C3 @}* c; T9 {' w+ |& ~& r1 \% Y5 t) l
" ^2 K3 b( B, g
function PostListener (){. `1 r& g% s6 i! F2 M8 k* D
//Add more post variables if needed and add them to initform() function aswell
; F' e$ j2 [9 Q' t: b7 @' I" k) P9 s
7 f9 [# ^1 f1 }! k& p+ A5 W################################. \; I, \* |/ N2 w" J! m$ _
##### Connection and Post ######
. q% y2 J1 S/ k# n################################
- s# M% p6 S& t& O) f, q4 |$name = @$_POST['char'];
' M0 R5 M0 n) V: N$ItemName = @$_POST['item_name'];$ f& s3 x& r5 L+ e# Z6 P4 m
$ItemAmount = @$_POST['item_amount'];+ t; w8 s# o& s$ j: A( @
$ItemId = @$_POST['item_id'];3 g: r2 ~/ s% [; n$ x
$ItemUpgrade = @$_POST['item_upgrade'];
# C1 x* U, w6 c1 X' [$ItemElement = @$_POST['item_element'];
3 t- ]$ M5 Y7 c8 s  L% M; B$ElementUpgrade = @$_POST['element_upgrade'];0 Y! w' k3 m# E( s$ A
$ItemPierce = @$_POST['item_pierce'];& A; n& o$ e7 s0 k0 G
################################. f7 I  @+ D% H# M- j

8 Q( W, p8 C0 B: \3 ?7 B7 W6 O! r//Check both variables for empty value0 j3 S0 i& l2 Q4 b& w! X) x6 ?
5 P; Q* g7 P& B/ _5 g
if (!empty($_POST['char'])){5 d" p/ F6 R( q7 P% s9 I2 Q8 |
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where + O' |( {7 M+ H
! C" b1 c/ X6 H0 K+ N* _
m_szName = '{$name}'");
: U" ^8 Q" K: s9 |: p8 Wwhile ($row = mssql_fetch_object($find)){
$ Q( U0 A! s  ?' u$ a) X- D+ kecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
! y# b* L: W2 Q9 P! B! ]% F8 D8 A, M$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], & v1 c# ~4 ^1 J1 d! S6 E0 h7 I
$ I! d6 H4 q9 I+ g# U$ v( X
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],   Q  Q3 m; r8 p& w' H  Q0 b/ J

; N' E6 v8 u, A) g  r3 `. q[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
* _# B5 z5 ^& V0 X1 |+ m0 `4 P
! S: g7 U8 y3 V2 `# B$ RN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
/ y0 m( R: o  ]  _
! J5 x9 s% t! R0 C! z' i'{$ElementUpgrade}', '{$ItemPierce}');");
: K3 A* n4 _5 g7 ~. M. g}
0 l, Q7 I! M; Y. g6 w8 h: X! j3 t2 q5 Q* O1 E' X3 l3 ~5 r* a8 z
}! G4 [! f- w5 O7 l' Q1 p( O

! H5 o' y  k/ }}
2 U. ^9 q+ c4 l& H% _9 }3 [/ S- |
7 o; d7 q2 c$ X& `/ Z/ |  g1 _$InitForm = InitForm();! f5 F0 b6 u8 [+ R( `& [
$Listener = PostListener();+ v& }9 [' e+ m0 {4 |
/ O. d+ H1 @. W+ _# J
?>, y8 e! n& |! @" |0 {
2 p. H; S9 N  d! r/ x: C7 d+ c

  r! b$ _' M$ s; t& K9 ]$ e# z
( l/ l% }. M8 ]( t9 d) \& |% Z2 j9 L" t) K+ |  C& y5 {6 ~
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-31 08:35 , Processed in 0.063108 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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