飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1090

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1090
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php" d. F1 g4 d' X4 a0 |, q7 j* D
function Connect () {
( ^" E2 j# p0 q8 Imssql_connect('Server','UserName','Password') or die('Error: Connection to DB
8 e7 {. N2 V8 B/ A, ^* U  M/ G; B' y8 D0 a7 l  n. \2 H6 L2 b
Failed.');
. q6 ]  b0 w) ~}
: w6 M' T) |! f  w  qConnect();
; A" ~' t) z/ |& `+ X& x
/ ?. c$ ^! [9 c3 vfunction InitForm(){0 H' _7 f4 h  v0 Z: ]1 d
//layout for the form
* M. h1 K: L2 m: D6 d- ]! Eecho "<strong>Send Items.</strong>
, q0 a% u) @5 P- a& [/ d<form name='select' method='post'>6 h8 Z5 O6 [' e7 z( I
<lable>Character Name</lable><br/>3 s9 i7 w' [5 D& R- v* |! O$ L/ Q
<input type='text' name='char'/><br/>
$ y& [7 A8 b1 V; F: U* J$ _<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>% G4 S% p# `3 F& F& `: C6 c% J
<input type='text' name='item_name'/><br/>
: q# W  p1 p1 d8 O, }: B7 a1 b<lable>Item Amount</lable><br/>
7 h( `* E5 a' r+ [* F5 n0 L<input type='text' name='item_amount'/><br/>- G9 ~. M- ~( x3 X5 V2 \
<lable>Item Upgrade Amount</lable><br/>
* [8 m% v! u! R8 H2 B<input type='text' name='item_upgrade'/><br/>3 f0 c% [8 X& |9 ?: N+ F* t, B
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.), G  A0 i  W9 f" B3 _. s0 a

8 i& M9 P8 Q7 P</lable><br/>+ g! A/ G8 W% R+ F* h
<input type='text' name='item_element'/><br/>, f$ X, ^* Y( o- A
<lable>Element Upgrade Amount</lable><br/>
; S0 P9 ?* m$ h+ s/ d<input type='text' name='element_upgrade'/><br/>
$ W0 [) a, p' g<lable>Pierced Amount</lable><br/>$ i- D  |$ l; c8 y
<input type='text' name='item_pierce'/><br/>; I  X7 \, r; [! n+ _' C
<input type='submit'/>
$ ?8 e8 G$ b# D2 G</form>";  G4 A4 k- ^( U; g) T! l
}
3 m& m' O. I. g9 L! x
! M5 @  S2 ~8 E9 U* f/ L6 b2 Dfunction PostListener (){. c) X) \6 @6 F, d9 f
//Add more post variables if needed and add them to initform() function aswell& Y9 Z: J% ?0 M

9 O# @$ ~$ S6 W5 Q" g4 T) j* `################################' H$ u: w9 p+ {' ~! s" R
##### Connection and Post ######
" L, f0 v1 e+ \* P9 x################################: j1 t: z  e4 c4 C
$name = @$_POST['char'];
5 I9 n1 F7 G' E7 \0 K$ItemName = @$_POST['item_name'];
! n5 h) G" `& @' D$ItemAmount = @$_POST['item_amount'];
6 Y' g9 P- D" O% a/ _' e  q$ItemId = @$_POST['item_id'];
3 K& n( u$ W, ?6 }- G, Y5 d: V$ItemUpgrade = @$_POST['item_upgrade'];
: _( `/ U2 H  V3 ~; r: l$ItemElement = @$_POST['item_element'];
' W" S" u% X9 Z8 ]# Q* A/ W4 B$ElementUpgrade = @$_POST['element_upgrade'];
1 k1 t; F$ Y, V9 H3 L$ItemPierce = @$_POST['item_pierce'];
. C6 Y; X# I3 A) I4 Y9 C################################
2 e' k" a9 M9 j' y. B" T1 i7 e* [) n/ g2 r1 I* s
//Check both variables for empty value: n' w& a( C. {$ k' Z1 \# c
' G$ ~) `) R) @8 B! ^  y
if (!empty($_POST['char'])){
3 z4 V  f3 g- U2 W% Q$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
% y! R! N0 A* l; {1 c7 k# f( S% _% B5 K3 h4 X% |* y& G
m_szName = '{$name}'");
4 T* _  r* ^) m# B7 gwhile ($row = mssql_fetch_object($find)){* k* i" q1 ?5 S8 `2 G1 v
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";2 v% X) ^4 V, M# ~7 [( k/ q; [
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], $ \$ Q3 J: c. |; M8 T

+ f5 E# T# w# @* Z8 w* }! Y; Z[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], ' j' r: e; ]* j1 D, D* W# e3 @5 [) {$ E
( Q# ]2 }* C+ A; n; \! |3 j1 H
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', # h2 s5 \  s. Z  @+ p
  U+ V7 W- H9 B
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', , d* a( C1 S) \
* V' q4 _1 B; k$ s+ E" \" |1 V5 ]
'{$ElementUpgrade}', '{$ItemPierce}');");
4 d: {# C0 h, T% H9 k# e) y3 P}
8 D2 g1 S+ q% M; U: b3 H$ [
; W3 x; P' K( X% |% v/ H5 c8 b4 [9 |}
# M3 j8 g% s+ l( y
" F( c7 U; }2 y+ P& p}
# ]- P! q3 e. |: y
5 N2 U5 a# e+ O7 W' F$InitForm = InitForm();
0 |: a: ]; U5 q4 c0 ~$Listener = PostListener();6 i9 e$ x3 v- @% z8 u6 ^0 Q% Y2 m
0 ]5 H; Y1 V6 A: L+ c  Y# H8 R
?>
; w3 v: F) y. F; @3 K' w4 V) l1 E: G

( r3 \2 v4 _! X* w6 l1 K' |7 J* {6 n' H' S8 X6 ^) [6 ^- ^% `+ i% ?: A9 x

/ Z/ |& p& E4 S& o
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-28 10:54 , Processed in 0.063389 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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