飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1064

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1064
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
4 D8 }2 a/ m0 G6 @- [: G8 zfunction Connect () {& [4 I7 X5 I1 X8 r- [8 q
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
. M4 d% l/ N; Y: i/ S: s- A
  R6 Z* z5 x& v/ g3 ZFailed.');
+ c2 W9 u& d5 W9 G5 Y}
3 d9 \. p' y8 j2 E9 ]7 o; b8 WConnect();+ r% L! F- E6 O1 f/ v. y% v; g
+ s5 B' ]1 ^2 f! V! F
function InitForm(){
3 X  g  a  N( x+ `/ j* @7 N//layout for the form
0 O8 u& K' ^; _echo "<strong>Send Items.</strong>
& s) b* B* \+ f. P0 H- J<form name='select' method='post'>
% h3 K# Z5 K8 f6 L: H3 o<lable>Character Name</lable><br/>
8 Q4 ?; D1 F; B: H& u' U4 i<input type='text' name='char'/><br/>
! e- X* }" v6 U; f" n" Q<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
/ k" {$ V" e+ V, h" n$ ?# B. `<input type='text' name='item_name'/><br/>
8 ?) j: x. ?. D. v<lable>Item Amount</lable><br/>
& o- ?4 {/ I; a1 y6 D+ o" O<input type='text' name='item_amount'/><br/>
7 }, q. t  m0 W# j4 t7 i$ Y' X<lable>Item Upgrade Amount</lable><br/>) F9 _5 w3 L/ ~/ N9 o
<input type='text' name='item_upgrade'/><br/>
$ T7 J; j; {5 c  u) M<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)) L4 l" u2 I- g1 t. O( [
! ~$ u$ b% j/ ^! X5 |& r4 i! I
</lable><br/>
3 ?; U5 T$ R: ^9 b; v; _( S, b<input type='text' name='item_element'/><br/>1 Q  {* Q* U3 S7 V) `  H% J
<lable>Element Upgrade Amount</lable><br/>
( _9 C9 c+ }* {<input type='text' name='element_upgrade'/><br/>5 I% C- E. x0 f2 O8 g. t$ v, q
<lable>Pierced Amount</lable><br/>8 n6 }$ r, \! J8 O: K" F
<input type='text' name='item_pierce'/><br/>3 k/ J# w' w5 G: R
<input type='submit'/>, ]0 H: m( F" L1 h: J
</form>";
0 d" b+ P% C  E3 h0 f  ?}( j& ^' ^0 l$ C

: e8 F/ `: S2 O4 R2 j# m% e0 ufunction PostListener (){& h8 w/ \+ j/ c6 x
//Add more post variables if needed and add them to initform() function aswell3 X& |9 m' s4 X7 F. W- c
; O/ t6 e9 W9 |6 @1 P3 Y  O6 f. u* y
################################' U: ^( C7 R9 b1 q# H2 t3 \( z( V
##### Connection and Post ######( Z' a  b% c+ D
################################
; f5 c6 l/ g2 d6 e% \3 T$name = @$_POST['char'];
8 n/ x! F. Q4 _" A, |- n# [$ItemName = @$_POST['item_name'];  P# n8 n! T+ |! N& R7 K  G
$ItemAmount = @$_POST['item_amount'];
# \( E# v9 @) |' U3 R% P$ItemId = @$_POST['item_id'];! e3 h. i$ I" v" ?; c
$ItemUpgrade = @$_POST['item_upgrade'];9 \- g. K9 x( j" n
$ItemElement = @$_POST['item_element'];: j5 M" Y2 }! a+ x, p, Y
$ElementUpgrade = @$_POST['element_upgrade'];1 c; }- ?3 k% D. B
$ItemPierce = @$_POST['item_pierce'];! j$ l  |5 ]$ l" [" g$ z
################################: w+ T# K8 ~( ^9 y& K. d
1 t: ^* Z3 z5 f! H4 q6 |% H4 Y3 \# a
//Check both variables for empty value
: x/ ]9 j( i: g+ I2 y( R8 o
8 w+ n- e6 c" J; b$ M' m0 c+ mif (!empty($_POST['char'])){* a' T8 j. I; b: i8 a# r5 Q
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where 3 R* f& R7 m0 U; a$ Y3 R

8 V7 t! e  ^  ?! M" W* Z! A" vm_szName = '{$name}'");. P6 E% ^( N8 f1 R5 `
while ($row = mssql_fetch_object($find)){
& A* N7 B- q' f- @8 _6 decho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
1 G' k: _6 S7 a( B$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], % X; u7 I( h1 [+ [
; D9 k6 B# H4 l% N! H
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
* z5 A; j% ~% `  Q8 F2 z9 V0 Z% Z$ u& c1 J0 S  c% n
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 1 w& b3 J& J. w5 E5 a

: R6 U! U. x& dN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
3 v  Q( W! T6 G* g! n/ @
4 r2 B, u/ U& l  \! o; W. P! ]'{$ElementUpgrade}', '{$ItemPierce}');");0 e; ?9 y$ _7 e' I$ c; H
}& X) g. ]/ c& n- O

; g* [& s8 ~/ a9 A  I7 h}
* v9 [& D1 O6 o8 B$ h; ^
* O  S, a0 t8 B; J, v& l) V6 L2 }}
8 D3 @3 e2 l1 v1 R: t5 ?) e! q- ?# M( J# l& X
$InitForm = InitForm();
* r/ I" J. D. ~' L9 k1 H$Listener = PostListener();
- x$ ?! j; n2 M- X# m, C0 W, e2 |3 g  a
?>. N$ Y+ ~% C3 K! ~7 y' i
* o5 i$ a* D& E& |& c
! A) }  x$ a; g$ h' N1 z

( e( }" f2 x# V4 w* D% `$ ]
1 n9 L( @# o  f5 u1 l) M
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-6-17 00:41 , Processed in 0.100116 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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