飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
" ~8 r6 F; _2 N4 mfunction Connect () {
  }1 S4 P$ [( R6 T* e& \( wmssql_connect('Server','UserName','Password') or die('Error: Connection to DB
1 D5 H, ^( ]+ H  ~" [3 a0 t! p# ~0 o( c, e( u" M  Q# }
Failed.');
& m$ ]" T1 s4 R' g}
6 U( Q1 G7 ^) D- {( ~; x: s2 B# mConnect();
/ j* y2 N5 Z6 L
! K+ _: W; r, N: G$ ?! _0 s) h; }/ c8 Pfunction InitForm(){
( H( \1 _. g/ E) L//layout for the form* O5 c1 F# E  o2 T' M5 n$ H9 C
echo "<strong>Send Items.</strong>& |$ }, ?( M* H" D7 ^4 Z
<form name='select' method='post'>
, j  X' J4 p( }! z' b  W* j<lable>Character Name</lable><br/>4 U$ m( W" G7 b+ B/ P6 _
<input type='text' name='char'/><br/>
, m( ]( O( s& r1 d  i: A' F<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>  w6 I, B. F2 @, |0 [( u( W
<input type='text' name='item_name'/><br/>
) h  f* o! ~- _* r. V<lable>Item Amount</lable><br/>& J. j; a, W! ~6 q7 J- V1 A  t0 ^
<input type='text' name='item_amount'/><br/>
2 s8 K+ H+ o* q2 H<lable>Item Upgrade Amount</lable><br/>% F/ s. W2 @' f4 F0 ^( o- E5 ^
<input type='text' name='item_upgrade'/><br/>+ B0 Q" b  W! _+ @" q  `0 M" j
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)! K! H! ~$ r0 F9 I# y: I+ b& o

( d0 K: K: z. J: h$ k5 n$ `4 D</lable><br/>5 |- B6 ]  m* c& J
<input type='text' name='item_element'/><br/>
* o- r) D, w+ ^% A* `2 f" l. w* ?<lable>Element Upgrade Amount</lable><br/>$ k& g* z0 d: c* V0 s
<input type='text' name='element_upgrade'/><br/>
1 c  N/ ]3 b; D* X! I6 r. _<lable>Pierced Amount</lable><br/>* H( a6 Q9 o, c7 W# }9 B
<input type='text' name='item_pierce'/><br/>( `$ h2 j/ c' j7 n% B+ Z8 d
<input type='submit'/>
5 G/ i( S; Y8 o</form>";1 ?$ Y+ B4 a2 B- S, D9 R. F
}
: j; r, w3 d! K7 l. Y9 N7 ]
- N! U' ^$ U- l, X" A/ Gfunction PostListener (){
- \( r8 C  z3 D. `( V5 t//Add more post variables if needed and add them to initform() function aswell) i/ x- w& K  r8 w, O
* f& f8 {) y. E% l9 i4 e
################################- v8 b( A) L# o' M5 Z4 ^
##### Connection and Post ######" i: D# `& }% S3 `+ ?
################################: ?9 H% V3 t7 y. Y
$name = @$_POST['char'];
' R8 `. e: b' C5 K* r- N& Z$ItemName = @$_POST['item_name'];: R0 O6 @6 x. T8 c% S4 s2 U
$ItemAmount = @$_POST['item_amount'];
% h/ A% Y1 c, g& i; w- w2 j$ItemId = @$_POST['item_id'];) \9 ?' M( l3 y. ]8 N  r; {
$ItemUpgrade = @$_POST['item_upgrade'];
/ c& q( z" q% P4 L0 c$ _$ItemElement = @$_POST['item_element'];
: _+ E" y3 W5 q7 ^# q  A9 B$ElementUpgrade = @$_POST['element_upgrade'];
3 ~( r( w: R3 U4 T4 l8 p. @1 X$ItemPierce = @$_POST['item_pierce'];
) B. }3 j$ I- j( A( o* _! O% j################################
4 |6 l/ d; u' q8 @( m5 u+ @; L
, X9 {$ O+ Q; b//Check both variables for empty value
+ z: I9 Q* u; o1 V" ?; z- q' G, h  a2 j( r/ \
if (!empty($_POST['char'])){
; K9 Z: l1 x* v% E" R( k0 e+ l$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where 1 r% x  [" `8 Z1 |+ X
6 q/ g1 E: f& U2 u% v
m_szName = '{$name}'");$ N  F9 e( Q* q! V
while ($row = mssql_fetch_object($find)){
& ~2 z' a  h7 z; j) u- qecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
2 V) Y( w3 i$ F* O$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
0 b  `% x0 y9 }% P" y
; b) J9 r* W) U* _[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 7 ?8 f( n4 {1 l) U2 u; y* ~+ E
+ O9 b, Z7 L/ N- ?
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 3 X' ^6 O  j& P" ~3 Z) S0 A

$ @7 V  X$ |9 l9 i7 vN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
* y5 U3 E1 w- e0 g$ `' [! Z3 F* c- c0 I3 R
'{$ElementUpgrade}', '{$ItemPierce}');");
# X2 x$ Z3 d9 s* \: U' j}9 X+ U, O0 o: @" @% _4 M0 ~

" o2 H2 ^4 B2 d9 X% \) Y7 _* {}9 x: J, x+ e" I$ U2 d

* |+ m" [0 _' w- [7 X' X( q}0 w% ]# P9 X2 v' b" e3 {
  p$ y# G( C# p  \
$InitForm = InitForm();$ A* p$ K6 p  T) x; `
$Listener = PostListener();$ T$ a1 G, t8 Z

" H' P/ q5 c9 x# q# d! F?>4 h- ?" [. y& e9 q7 z, D, b3 U
9 ^( ?  k5 u: J. @
- O+ I* ^2 J5 ^5 r6 |7 w7 P

3 q9 {4 H$ q/ K3 G" N
' y3 S; I, h; r$ s) A! _2 N5 [
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-18 09:54 , Processed in 0.057450 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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