飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1088

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1088
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
<?php
& [' i' U. q6 J/ x9 dfunction Connect () {3 `- n1 N4 i9 N. r6 ]! w4 _
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB / O/ M6 u9 X3 R  u0 u; u1 T. c; y0 P

( d7 a, u# I$ B0 m3 l4 pFailed.');
8 p0 |$ l" X' W- B+ U7 M/ K}
6 _9 d8 J4 B4 t9 s) l7 F4 {Connect();
- o: I0 F1 m2 q9 L
- I' _1 c4 g2 J2 ~- C$ J' E' bfunction InitForm(){
6 C  d' K$ e) _: a//layout for the form+ c8 x& u: s- i( B
echo "<strong>Send Items.</strong>% F5 Z8 J4 p  t- x  _
<form name='select' method='post'>
* H* K$ T9 l3 {, \<lable>Character Name</lable><br/>1 Y% T4 F  `& r) \) B, y
<input type='text' name='char'/><br/>; B9 n9 s1 N8 x& b
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
3 K/ [, ]  u, K( Q7 ]<input type='text' name='item_name'/><br/>
0 L( U& S: W; c4 d, e<lable>Item Amount</lable><br/>
; `+ T* B& y/ \5 b<input type='text' name='item_amount'/><br/>  c- D* q4 d2 m: \
<lable>Item Upgrade Amount</lable><br/>6 |  y' m% D3 V8 @5 I) z
<input type='text' name='item_upgrade'/><br/>: y" G8 N4 \0 n( L. v7 |% m) c
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)0 u) E9 f% R* ?; r) g
( u: `6 T' j2 `. F! L5 F
</lable><br/>5 o) g4 l' C* T8 P4 T; R0 a
<input type='text' name='item_element'/><br/>1 `$ V/ Q& x2 r/ J) g! H0 a
<lable>Element Upgrade Amount</lable><br/>
  j2 }9 a7 U( n- N<input type='text' name='element_upgrade'/><br/>
+ b; f8 j4 g8 D<lable>Pierced Amount</lable><br/>0 Q) F. ^+ z8 W- x3 D
<input type='text' name='item_pierce'/><br/>+ x' b, t2 o; J1 G
<input type='submit'/>
+ {3 O! t: s& G</form>";/ q3 a+ m' x' Y2 l! c1 [! A
}
) H$ J+ @9 y7 p* e( I
* {0 n8 o* _! kfunction PostListener (){
/ |( `/ c0 f; X4 i3 o/ u7 Q* z//Add more post variables if needed and add them to initform() function aswell- R* b8 j. O. y' O, ]- v3 }) w' W

5 Q& \+ r3 v! A+ \9 L! J# n################################$ p: Q! d2 }3 u1 V* b
##### Connection and Post ######
6 g1 b2 m/ y, H) S+ C; i################################
3 x* i! g# ^- A$name = @$_POST['char'];) q% y/ ^% ^- `, b
$ItemName = @$_POST['item_name'];+ l) [- S+ O9 W( }) q
$ItemAmount = @$_POST['item_amount'];
  C$ Y. ^% i# K$ItemId = @$_POST['item_id'];0 m, u( l+ u) ]2 F- L6 n' r; J, V+ h
$ItemUpgrade = @$_POST['item_upgrade'];
9 b6 f0 Z7 S8 V2 b/ {$ H$ItemElement = @$_POST['item_element'];
; ~4 L2 E, ~, u' S$ElementUpgrade = @$_POST['element_upgrade'];
4 k9 j  c0 g2 z0 G1 c( w$ItemPierce = @$_POST['item_pierce'];
/ b( M8 |% N' b* E+ g################################: o( W6 ]( B+ S8 }, m1 e

0 `4 M0 E/ E  |$ Y: F//Check both variables for empty value
; w1 {. O& q& ?$ P5 R+ ]
; s7 q; s& P& h, q7 Rif (!empty($_POST['char'])){' W/ c  T; E& b! l$ p# o9 ^
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
, W" V0 N7 B7 c; t) ?' b- ^! C7 D" Y; _' Z: ]* y; ?' V
m_szName = '{$name}'");
% h5 c! i+ e- p& t+ S, W9 G- C- hwhile ($row = mssql_fetch_object($find)){& u& r% u+ m7 M2 K  F
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";% J+ u6 M2 X9 \
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
1 X& n  l& ?. L- v2 A! m
  a0 Y2 H6 @* t+ t$ g[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
( ~. H( y7 }+ h8 A* W( _) A' e7 }0 F7 j8 j$ N% a+ c
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
) K$ \  d& t+ V9 q2 [# n, @% @' {
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
3 g5 r3 u' g  R& l; L, T  W; n. i+ u  C2 t
'{$ElementUpgrade}', '{$ItemPierce}');");3 m% L+ d0 v0 i. R! ^
}
. Y% S, G3 ^. J; Z8 \; h& }9 r) ]/ ]1 {' j
}4 ^- `& F1 F& \) l' S- Q, b
2 Q* E0 q' {; F, R+ y& ?
}6 U) Y6 W- m: E/ p- Z
7 [% Q/ C) l: o0 r+ j( t
$InitForm = InitForm();
# k# \3 D! z6 u( V( r# X$Listener = PostListener();0 P& `# }" e' A  z4 G) E
  n* m  M0 I. u) ?6 K
?>
/ e8 ?; e% ], u) m; r
1 n  X$ z( ]& v4 D1 \$ \( l+ f9 X+ s4 d# j% P6 f7 ~* a2 A6 p
2 Q: P. I, G% _- S8 z' S" h

/ i- n$ K, a& H; h' l( W# t$ Y+ g
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-23 11:42 , Processed in 0.058675 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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