飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
/ ~4 j+ t1 P' B9 r8 s8 e  @; wfunction Connect () {
: |, x+ ~  }0 u# X( x0 o2 Jmssql_connect('Server','UserName','Password') or die('Error: Connection to DB
3 B& c  W0 Q5 Y4 |! z3 r# @! \: `& x0 Y
Failed.');
/ {7 x2 F; @3 {8 j" g}
) H3 ^+ A) b6 [Connect();
) a1 ]; Y* W+ M
# l) r0 K- g1 Z8 Q% N# n% d" sfunction InitForm(){
2 A; e" T# _8 W. V) K8 f- S* `//layout for the form
& u" Y$ h  J/ _/ recho "<strong>Send Items.</strong>
) A: \2 h, r8 J7 B; t# P# o8 E<form name='select' method='post'>
# Q$ f5 P! R+ b' N<lable>Character Name</lable><br/>9 L: c2 L+ u7 ]7 B
<input type='text' name='char'/><br/>8 K# B% `" f7 Q3 e
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
+ k3 }, B& K* `+ z( f/ W<input type='text' name='item_name'/><br/>
& B$ ~, `4 x+ i( Q7 ?" ^<lable>Item Amount</lable><br/>- b# A% z# K5 a  a, M( y+ M
<input type='text' name='item_amount'/><br/>- D7 X& F# g. S1 A2 U. K! w/ C6 L
<lable>Item Upgrade Amount</lable><br/>4 T# Y, Q! q; E
<input type='text' name='item_upgrade'/><br/>
) G  U7 K" o2 T' j5 y. I<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)3 P; J! e% ~7 B  c/ G
2 Q/ S" \( K6 g
</lable><br/>; w. V( @% u% z- \
<input type='text' name='item_element'/><br/>
7 s3 w# O' I  M8 }<lable>Element Upgrade Amount</lable><br/>$ u) q' A" n# G" v" l5 ~
<input type='text' name='element_upgrade'/><br/>
/ r7 w6 @+ t% C" N5 y; v* q<lable>Pierced Amount</lable><br/>" \1 v! I; F. R$ m+ b% P
<input type='text' name='item_pierce'/><br/>
5 Y3 `+ Y( }+ S( N) k<input type='submit'/>
, M8 m3 a5 t! j5 X</form>";  P0 z2 Q  q4 |9 [. [9 P, O
}
$ d( g9 Q: P. K, D4 |, @/ @6 C  E/ k, Q6 e6 J. V9 q
function PostListener (){
  o- S4 O3 e. L8 f//Add more post variables if needed and add them to initform() function aswell( }+ a9 C2 F, O! p

$ t# W+ k0 L* g: K& J( ~################################
5 B8 m. x( n) b6 o& p9 X##### Connection and Post ######9 A1 C8 w- @6 |4 T( ^
################################
( C, N0 m9 F6 [2 n" e$name = @$_POST['char'];
4 i  A, J9 C1 l6 {- _( z' o$ItemName = @$_POST['item_name'];5 q, u7 N; {0 E" o7 u
$ItemAmount = @$_POST['item_amount'];6 _9 _% ?, ?" R. @
$ItemId = @$_POST['item_id'];
% e2 |. g" ]6 o0 ^! j- ?% P$ItemUpgrade = @$_POST['item_upgrade'];" ?( P5 H, ^' x$ O1 {6 c/ `
$ItemElement = @$_POST['item_element'];
9 c, a6 C' z! B& q$ElementUpgrade = @$_POST['element_upgrade'];6 m$ w9 ]0 }2 t$ [
$ItemPierce = @$_POST['item_pierce'];1 o1 L% z1 M+ P) O; @! C
################################) v5 j7 C$ b6 e, m5 p" D- E( w
$ R8 {8 S/ `$ h8 |$ \4 Y
//Check both variables for empty value% K5 S; f7 j: D: u# a8 t+ u* i8 _
! s* H; V; R5 O, M2 W9 B
if (!empty($_POST['char'])){
# C; q+ j- g& f! m/ V$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where ' K2 x; L7 f. ~! J. e, l

" x- ~) p) {5 k5 U& i& b/ Gm_szName = '{$name}'");+ j+ S# H2 n; d8 y7 ]
while ($row = mssql_fetch_object($find)){
( C% l' }5 f' y" Q$ Fecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";+ u0 ]7 P8 Q! C) ~4 |3 |
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
1 m' l. e. P9 v1 C4 @8 C7 b% X4 D$ P. A! Z, t4 Z  f6 p6 i7 w
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 5 r, n* I5 K. C+ E/ `

  E* H! i5 S) z[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
& J: L# {3 e& q4 J  O: r! H! d& P* N0 M, r7 z
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
; E" X8 Z3 C7 Z1 I4 u/ G. A$ L) G; m5 _# a; l
'{$ElementUpgrade}', '{$ItemPierce}');");/ s1 `& [) B: ]" U  Z
}* K# R$ i5 c5 Y0 z* w: q
; {" f  l2 N% ]5 w
}
/ o$ ^1 w6 [  V5 y, j/ {" Y+ ]# Q& S( [2 }/ q( @
}6 D2 k9 W0 g% B6 m8 v0 {' L" A5 F

* E* C  i& K0 Z2 N' N% d4 C: t$InitForm = InitForm();' G' D" t: V, t) T0 W8 N
$Listener = PostListener();
/ V) n/ Y: o9 ]% c* Q, j5 M$ @, l
/ x9 E- W0 g5 V0 a1 {9 X  A( Y?>4 S& k7 o2 k, ]

. Q: @- \- W- s3 N1 h9 M1 ?$ x. _2 F6 {* f$ C* i, y  j
4 R# V$ Y# S+ |) S5 O

: C2 U6 [  D' d4 g: V; Z% O( z
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-22 06:53 , Processed in 0.057945 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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