飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
9 q" g9 S( d1 q* i" x! P+ k$ Tfunction Connect () {
+ n+ G- Y# m3 G) N3 v/ M' fmssql_connect('Server','UserName','Password') or die('Error: Connection to DB
5 I+ t, y5 |4 e0 v6 p# z  X+ u: R. `, E7 o+ w& D7 F
Failed.');
- i  G% e& q9 A2 O, S+ d}
! L* h# Y" e0 J( e8 x7 M+ e2 _' x% JConnect();8 V1 |) X; F" L+ T7 q9 D

" o3 ]7 U/ O5 d$ cfunction InitForm(){
8 O8 M1 |# `  ~2 ~! _//layout for the form' l- Y  r2 w% `; H/ `/ I# |
echo "<strong>Send Items.</strong>1 a" Q& _5 ?- g
<form name='select' method='post'>
$ _6 P- p6 Y% n<lable>Character Name</lable><br/>% Q5 w1 [! _( Z( _6 \6 j
<input type='text' name='char'/><br/>/ C  E$ n4 O" z9 `
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>+ X) A! W' i* h9 Z9 }$ A+ G0 x
<input type='text' name='item_name'/><br/>
' C, Z: v4 b! G. J: @  X1 a<lable>Item Amount</lable><br/>
" t! \7 q# W6 @2 ]7 A" p<input type='text' name='item_amount'/><br/>
0 y$ F1 p1 L" k9 j, p  u<lable>Item Upgrade Amount</lable><br/>& g% c8 H: S; H7 @7 W! q  M
<input type='text' name='item_upgrade'/><br/>
( }! U' F" g8 J& y# W1 J/ R) e<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
% Q& T; s: ?+ h( g9 q
+ d( {/ u6 o( f</lable><br/>
. g+ s1 w) d1 y- Q9 T( T! S1 ~& V<input type='text' name='item_element'/><br/>/ E7 H6 @8 c) S
<lable>Element Upgrade Amount</lable><br/>7 G- L( l0 d) q) r. [& a0 e
<input type='text' name='element_upgrade'/><br/>  H8 B9 ^5 h% S4 A) x
<lable>Pierced Amount</lable><br/>! k% D/ K# m% k( e' m/ H
<input type='text' name='item_pierce'/><br/>
' Z( V2 n9 ]# S1 y$ T" g<input type='submit'/>2 E, _. r3 L- T
</form>";2 w/ u, m5 F2 _2 [
}
. Y  r1 D3 J, k$ q$ X
: [; Y& J! N6 P2 `* k+ V- Z  T) Yfunction PostListener (){) T) p: {* l9 F8 z, F* V/ [0 p
//Add more post variables if needed and add them to initform() function aswell" s7 D  s' r) _, O: K

6 S; Z3 F, _5 J' j9 n0 U################################
' Z8 G) D4 \& R: q$ i##### Connection and Post ######
; e8 [; l) x* v3 e" |# {, u* e################################
. `* T1 i2 Z/ w5 E2 p3 {$name = @$_POST['char'];
, Y6 W# P4 C6 V3 L* n/ _! l# G2 r7 W$ItemName = @$_POST['item_name'];
! S" ]5 l* v- N4 m3 N$ItemAmount = @$_POST['item_amount'];  B& e# k$ I4 p6 _& N7 j; C9 V
$ItemId = @$_POST['item_id'];
0 W) z! h# }8 j$ItemUpgrade = @$_POST['item_upgrade'];! ]4 D# T7 V! w/ Q/ D- u
$ItemElement = @$_POST['item_element'];
6 P' G4 t8 C5 W' _" a0 T9 }$ElementUpgrade = @$_POST['element_upgrade'];  c+ j# J  z/ Y, ~5 ~
$ItemPierce = @$_POST['item_pierce'];
3 ]* B9 `+ K6 [: F4 P# ]################################
2 G! w; D/ \4 X' T9 {! M+ }! p9 I: Z( E
//Check both variables for empty value1 `3 e% _/ P* n: ]$ T6 l* e- L
# W1 F+ p6 o" ^& M) `* _% Z
if (!empty($_POST['char'])){: J" ]' A3 t& ^- i+ F" k
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
2 u4 i5 ~3 I9 L3 Y4 L. l4 J6 }. ?
! @, ^5 ?1 B- vm_szName = '{$name}'");
3 M  p. q) _) `" X# i$ kwhile ($row = mssql_fetch_object($find)){
$ K5 V' \0 \% Z  Z6 b# n% u; T" zecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";/ V4 m" U2 x- o/ k4 [
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
3 U$ F3 V6 S) e& Q) e8 o% H: Q" u0 q9 F$ O, l/ v8 w3 s. D
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 5 w1 d3 s0 _) T& g" {/ C

) c9 v( f# G/ X[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', : X- e; x( U$ P$ t: H- A6 K
, d- N, n# s0 H, @1 l' H: [3 P
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', 0 u  S  n) X1 m5 q4 @" K8 G4 P

* O# L8 q6 J4 e; Y- @'{$ElementUpgrade}', '{$ItemPierce}');");/ a, x$ q* n- T
}
  X, L6 }+ }4 B3 b# R  v( |. C2 h
}3 ?  q) ?, X& [# ~& s9 M

" t; W( l! z" {: t}
$ Y" R5 Y  A: f6 z* m9 C/ `$ i. a
  i+ T* X9 ]/ e9 S) r$InitForm = InitForm();
! ~3 I0 _; e+ f8 i% }* M$Listener = PostListener();2 I7 I" |7 u* O6 c8 }: K
; t8 e5 W; \6 X5 M. B) R5 U% J8 J
?>; ?3 Q4 R3 s# {
" {& J1 x1 H# {+ X2 H3 k

' b$ l% `3 |$ s% ]3 X+ o6 t2 `9 }: E3 }2 y! P8 e  U

- A! x5 u. b; I8 @9 J+ a
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-27 18:04 , Processed in 0.059023 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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