飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
, b# K$ L" n' W7 g$ O: {function Connect () {1 V* @: y) W# Y1 w3 p" C- j
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
5 W# A" w3 _% |1 e. b% |! x- S3 C8 w, ~3 d% L. ?3 k
Failed.');
) T' z) F8 {7 m9 I3 C: q: r}
! {0 {' m' Z  Q6 q1 Y5 Q  ?Connect();
4 r. I  q4 w9 g* h) W" o8 ?: z2 v8 d+ ]- r* x8 G5 P! c
function InitForm(){* F/ R* a7 |* a
//layout for the form( C, N& w: {5 B3 R
echo "<strong>Send Items.</strong>
6 \+ L9 Y' t; S4 v<form name='select' method='post'>
- y1 J$ t' c# ?$ Z# V5 R/ }<lable>Character Name</lable><br/>0 ~! d/ j: I8 a" V8 n# m# k: F7 \
<input type='text' name='char'/><br/>9 f! o+ V( k) m0 @* R5 g, u% o! l$ U
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
1 N$ l4 K  O' ^0 `" \<input type='text' name='item_name'/><br/>
$ t2 e2 A- O# @" |2 J! f<lable>Item Amount</lable><br/>
2 F& X3 m, U+ G1 ^( J<input type='text' name='item_amount'/><br/>
: D( ^8 p+ j$ H3 [8 \<lable>Item Upgrade Amount</lable><br/>9 Z) z2 _/ D" v/ O  V# k  m
<input type='text' name='item_upgrade'/><br/>
) e- F, U- F6 [; ^5 w<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
! f' I/ r) ~5 e, c
9 r. s" X( H2 ~</lable><br/>
4 ~! K: a! `2 R- L<input type='text' name='item_element'/><br/>
& ~+ E: g) Q- p# y) c<lable>Element Upgrade Amount</lable><br/>
: O  y, S: Y. z0 |. e% C<input type='text' name='element_upgrade'/><br/>
& Y1 S$ L4 C' l6 G% Y8 ?! U<lable>Pierced Amount</lable><br/>
: S& T  Z, [9 n<input type='text' name='item_pierce'/><br/>
1 @! r6 ?# M) }  n1 q; _7 m<input type='submit'/>
, C) G" Z2 b$ P1 }</form>";, n- Z& T7 n+ h/ S6 L
}) q* z) e0 q0 D6 E/ F

* S6 I" F4 z$ J5 f) _$ Z3 hfunction PostListener (){+ F! B( y% I+ R2 M0 P4 J2 r: |7 e
//Add more post variables if needed and add them to initform() function aswell
7 g9 s6 s! ^1 q) ^
  q2 k  v8 r+ j4 T################################
% X7 a* C5 W6 R- I##### Connection and Post ######3 _0 \; U4 I" \8 n+ H. m  C$ D
################################7 Y/ J* i( l! K
$name = @$_POST['char'];
& A; Q% v* O7 H! m9 v: [$ItemName = @$_POST['item_name'];* ]6 G+ }2 p& K8 K" S- X
$ItemAmount = @$_POST['item_amount'];6 E/ p; _5 E- a3 U. c# t
$ItemId = @$_POST['item_id'];
: A9 f) V4 S1 ^# I) M" @9 y, ?' D# W$ItemUpgrade = @$_POST['item_upgrade'];
% v2 F4 s, j: S, @" U3 K' E+ L$ItemElement = @$_POST['item_element'];) ~/ z; v& I- C5 B1 A4 b
$ElementUpgrade = @$_POST['element_upgrade'];
" C) a+ N: d5 W$ItemPierce = @$_POST['item_pierce'];
2 v( N: M* ^* F: C8 s+ Q3 M################################
4 l9 P% h! C! F/ \) j
2 M; e2 l# K1 m" I6 t7 A//Check both variables for empty value' D' e- r3 q' c: H! _% X  m
9 Q( X! ?, J  c4 U0 b' O  h
if (!empty($_POST['char'])){6 o) `! ?2 H! ^" P. R" F* M2 |% l
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
; Y: |, w3 g! x" |4 G' _+ A# K9 h, ]1 I
m_szName = '{$name}'");+ s% Q+ `4 n" v- }' ?9 n5 r
while ($row = mssql_fetch_object($find)){" G( C+ l2 ]: Y, i4 x& g. }
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";% I3 v8 X, x" {8 b7 {
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
* a  v9 p2 i: K/ w  w& E& @2 N  Z, e
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
. C0 Z: s& i: c# u5 p) \* Z. O* s+ R! N2 R0 J% y3 _2 ]& j0 n; a
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 3 @# [0 S% }! X2 k! l+ D9 j

; e! U6 j% r5 y. _' ]- c0 H3 V! H& GN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', 8 c& P4 U5 R; m. i1 e+ v

. q4 z, i; q% a5 x'{$ElementUpgrade}', '{$ItemPierce}');");
8 m$ P$ [' Q7 _}
3 S. }; E+ @2 @  f
& i! u. h$ Y3 Q}' }) _  O8 L5 S: D
8 U& H- |: ]3 Q5 F. z; o
}) S8 A5 g7 M( D1 X+ E) q, X

. ~, b  T- {5 R# D7 f: _- b$InitForm = InitForm();. ]: F- g1 k8 u2 Y" q/ X5 \
$Listener = PostListener();
$ ?; X0 o) Y/ ^3 Y9 q9 Q1 U3 q' {" [3 T' U  D' v: l
?>
8 O1 Q) J* P: C! c
7 f  {# j# Z. G, U! O3 E5 F3 r8 f* T6 c) c: b2 o, P
' g" u9 k6 B) h" Z

% X- M' U/ i9 K; l3 u
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-26 14:53 , Processed in 0.066320 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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