飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
<?php( g0 j8 j& K. V
function Connect () {
, V. c- M" C' O; F- d. {" Lmssql_connect('Server','UserName','Password') or die('Error: Connection to DB
; R. @3 v" v! f9 |, T
4 |2 x& U/ {8 |0 s2 XFailed.');
+ N! P* s4 Z  Z" s}4 n2 \5 [9 a5 w
Connect();, }' D6 O* A, P5 s' M

; l+ w" R7 F; l7 afunction InitForm(){
& R1 F& x1 Q5 y% C. {7 c6 h1 f6 A//layout for the form# L- E: K) N" I' ?7 m
echo "<strong>Send Items.</strong>; g7 v  i4 ], n4 `% X' J
<form name='select' method='post'>4 k9 X3 B+ C2 E- O; c
<lable>Character Name</lable><br/>/ I" E' t$ m( l" X9 R* D
<input type='text' name='char'/><br/>
# o% J$ e8 r( `, y7 J0 i" m<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
, {7 ?) |, B: \1 T2 m5 l6 {) z<input type='text' name='item_name'/><br/>% x2 d$ [+ N$ ?" i. S8 M; i
<lable>Item Amount</lable><br/>
# Z- a; {7 t' a  z' n<input type='text' name='item_amount'/><br/>
! P4 m' W0 `. J3 O9 d6 Y<lable>Item Upgrade Amount</lable><br/>" w) L8 B% S( O/ \. F( r* y: {! v) p
<input type='text' name='item_upgrade'/><br/>
1 Y; X; A- Q1 N8 o4 x+ S<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
( h- O' h  `- W+ I4 f
9 T2 z; H8 y" n2 }</lable><br/>3 d+ M7 T- D3 s/ K; e! S
<input type='text' name='item_element'/><br/>3 q5 |8 }$ F0 }
<lable>Element Upgrade Amount</lable><br/>- N& Y5 f% t4 h/ y( b
<input type='text' name='element_upgrade'/><br/>
2 V# Y; H3 G) J<lable>Pierced Amount</lable><br/>2 m  H+ |  ^5 B2 c$ k
<input type='text' name='item_pierce'/><br/>: Z/ X9 e1 h' ]+ C$ r2 v) C0 s- h7 l
<input type='submit'/>) {. l" t: A7 T. i8 J, T, p
</form>";
: J. i* u& ]! U6 I+ ^& T0 K}- [! S3 o3 k7 K2 T6 I) W. f

% W. A) u$ |: d/ v: W2 pfunction PostListener (){
$ ?: ]% L* E& D; b//Add more post variables if needed and add them to initform() function aswell
' `. r( |! f  g! O1 J! @1 X+ r: e% C/ ~# |1 x% M1 `
################################
! z' K$ N- n; \* N# K9 o- g##### Connection and Post ######8 k" p! E2 y% U1 L$ W
################################3 a3 ?6 U/ U+ ?: B
$name = @$_POST['char'];6 c7 y+ u, H+ X  s! P- ?8 Z" z
$ItemName = @$_POST['item_name'];. S" s6 I8 B% O# o4 v- {
$ItemAmount = @$_POST['item_amount'];
) {, h1 v# A+ U% l. a& j6 U$ItemId = @$_POST['item_id'];
. L! f3 b# |! t$ItemUpgrade = @$_POST['item_upgrade'];
0 S: m& H; b( {" a9 @. V' M5 Z- q$ItemElement = @$_POST['item_element'];3 f5 b: P* y% v1 D" [
$ElementUpgrade = @$_POST['element_upgrade'];% A; j2 `1 V; P1 G. B1 [. q4 L4 E5 `
$ItemPierce = @$_POST['item_pierce'];
7 Y7 [% z: a( o% @- Y################################, P$ x" n7 _4 ]

% K" o( Y$ ], X7 b) g4 K//Check both variables for empty value/ U7 ?. F/ e6 g" L
' ]; i. t- c# w
if (!empty($_POST['char'])){
& u* z! s: H) h& b! ]" }1 I$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where % g+ D2 f! H$ {# U- ~3 ]: H

% @3 U7 n  D2 B0 ~6 Nm_szName = '{$name}'");, r' x4 y# h- U6 M  S6 |
while ($row = mssql_fetch_object($find)){
: w( n+ O# C+ N2 \echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";" s5 N2 N3 _2 b5 g, J. h, _2 r
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], / w1 Z( y& W& v0 G% N5 X' z  N
/ ?  U" [  y( ~. M7 U7 _) k
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
* ]0 b+ y: G4 m6 q7 N/ i8 d7 Y
+ F+ \- L+ I4 v/ f) P: V[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 6 O: y0 k" _- [2 x$ M# t; I* f: g6 b6 \

( r: n9 j6 q3 h; [* O& ~N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', 1 ^; T& D% ]. w) i$ M0 w( V. z

$ c: H0 `2 A) g# g. L. T' L'{$ElementUpgrade}', '{$ItemPierce}');");  \, _) m1 r! L& [
}3 w$ d: J) ]) F/ W* S0 p! |/ ]

4 [3 p; b2 x' G}
! u2 a; k  S% l" j/ p; s
  Q! g3 _: o. w; P; G. u5 L6 |! q}
3 Q2 B1 f+ g, ]9 a+ C: r: [, q" K6 g& w4 }2 n" @5 @% \5 h
$InitForm = InitForm();) v6 V6 ^: {! ^
$Listener = PostListener();
& Z6 Z2 @+ d( C' A6 w% l5 H
: Z- L1 g+ k! Y2 r?>) B3 s/ g5 H6 {; d" C! W

! {" d. p) |. z$ i+ C
; u: ?  C/ c4 w
% l" |8 m  G) E, I8 ?3 j' D5 Q" N  z' V  y# K$ p1 q* z0 X" x
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-29 06:07 , Processed in 0.069219 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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