飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
7 H1 s* _0 _& x/ ?# q" ?5 a7 Rfunction Connect () {
7 ?$ Y/ I- C1 R6 ymssql_connect('Server','UserName','Password') or die('Error: Connection to DB
3 ^/ O$ Y- E. j7 T4 g9 W( }7 Y4 g6 }2 `, Z
Failed.');: d5 x  k. E/ f/ U7 y/ I, s: {  Y6 X
}) @3 O& W! [: \) k! b$ M- b7 f# L- i
Connect();
; [1 ]- o* p- o" T6 k% L3 V" k" Y" U+ j3 U( Q7 U
function InitForm(){# W8 h6 `$ m3 |/ n, u
//layout for the form( Y) c# ^! N1 `1 B5 |
echo "<strong>Send Items.</strong>
" }) v; `" i7 c3 o; J<form name='select' method='post'>5 U% N" {, P, G( E5 G0 D
<lable>Character Name</lable><br/>8 f2 z# L* L3 b+ Q' X+ V% [
<input type='text' name='char'/><br/>+ @; B! Y' {) V8 d2 h& g" x
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
- u3 N) ~! P" Q% H" f& x<input type='text' name='item_name'/><br/>( k4 ~& b  ]" o+ w, H) g9 F
<lable>Item Amount</lable><br/>
1 k3 y) `7 C; s2 e<input type='text' name='item_amount'/><br/>
  O. |. K+ Y# ?) z) K<lable>Item Upgrade Amount</lable><br/>3 [3 `" Z% z2 |2 f; V4 ^5 m
<input type='text' name='item_upgrade'/><br/>
' A2 J" ]3 v* ]  r: v<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
( T3 _  V4 r4 e# C. Z' P1 W- ]) i9 \. u' W
</lable><br/>
* b5 W3 ^$ M  O5 G<input type='text' name='item_element'/><br/>1 r1 E4 y# c% {+ U+ ?2 t
<lable>Element Upgrade Amount</lable><br/>
9 W# d+ z0 s0 s+ S<input type='text' name='element_upgrade'/><br/>' n4 P; s0 b' F8 E! U$ _* Q
<lable>Pierced Amount</lable><br/>
$ j# c4 y6 U+ C2 O1 M- ^% B5 u: Z<input type='text' name='item_pierce'/><br/>1 H8 g' m# p' H  I2 }
<input type='submit'/>$ H3 {( t0 J' ?2 a  b5 z
</form>";
2 r2 D; f7 i+ `}0 a0 p9 ^% O' y2 o5 v

. w) m5 E( P; v) [$ ~6 I+ hfunction PostListener (){
3 X1 L; C8 b# a//Add more post variables if needed and add them to initform() function aswell; f. P; n+ f, y+ B# h2 \8 E

4 H+ I  ^3 v- _& \  w################################0 L6 d0 y3 Y" a& v  E/ ]) k8 k
##### Connection and Post ######
) m1 |9 L2 _$ q; q+ {2 O* {################################5 ~2 z- B( J4 }/ w* b7 c
$name = @$_POST['char'];4 V& ^2 `  P/ A5 [* a! t
$ItemName = @$_POST['item_name'];" U( y8 r" s. u# K- C3 x
$ItemAmount = @$_POST['item_amount'];
4 D" b) f4 x' @3 T$ c$ItemId = @$_POST['item_id'];" X3 x! |: B! x+ c; c$ W
$ItemUpgrade = @$_POST['item_upgrade'];
1 W) ~/ A. \' J  f) p* _* N+ e$ItemElement = @$_POST['item_element'];2 s7 H( J% R+ N' a- e$ _0 `
$ElementUpgrade = @$_POST['element_upgrade'];
% z, w* K: e  }7 u3 x$ItemPierce = @$_POST['item_pierce'];" o2 N, }3 K# ^+ M2 c
################################
8 r. {, x" `7 d- k
, n% @  Z6 m5 P//Check both variables for empty value. H0 q- F3 E7 D3 ], l1 i

( C% d* `6 I$ i: N; ~if (!empty($_POST['char'])){, L3 _2 C: ]# x; Q% j- ]
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
, \! J% m5 Z0 }  q' B' ]$ p. P" \0 h. I3 K7 n
m_szName = '{$name}'");) _/ q4 [7 \- @6 N
while ($row = mssql_fetch_object($find)){& x" h+ G2 K7 P0 t& K  F: C2 t) v
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
, ~% ~9 j0 X* _* P) j6 z) T$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], ; Z. G* S, X7 ~; g5 f' }- _
" r( X7 ]/ X6 i" w( O% E
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
/ e4 c8 {! E- X  M1 k6 I4 k
+ H0 J+ g: b9 `* k% x[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',   ?) d* u6 V' S- F) ?  X' u8 m
+ H0 p# a/ S2 d
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', 7 A5 E; @9 n9 y! L( o+ c5 {' L

; L+ o; @" B7 x8 C! k' t3 N; U'{$ElementUpgrade}', '{$ItemPierce}');");& `- P( e+ h% g: v% y1 `3 @2 K
}  F* j+ E; q/ R  D2 a! ~
; K8 _* A( g! h% c
}
  z! [+ n# q8 e. z+ O0 X) A
/ \2 Z4 U3 ?4 u% s% k}
+ x+ `6 K# \  _; h4 Y. D" _
5 e. k; n" U0 c$InitForm = InitForm();
8 j* @6 D- ]2 n( r6 g$Listener = PostListener();/ t7 T+ Q% t6 h. J/ }

5 O4 N4 K4 ], D- ~) x* W  z?>8 T* l- L3 Y$ V' g, O. F

. R; `; Z6 R1 [1 |; c* J+ C) W& h+ a2 `- ?

0 C  s8 j% D7 |+ r4 T3 z, s
) A4 D& u0 ]- f
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-17 06:31 , Processed in 0.059490 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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