飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
<?php& f, [! }2 ~* `
function Connect () {( G: d2 Q6 @  Z; c
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
* d/ {+ @8 e8 t
& f) k* s, x9 I2 ?Failed.');* a3 V$ ~' k7 L/ u* `% I( n
}. w/ w& T% H! m& k; J
Connect();! h% i/ Z8 @0 J! `9 f, M7 }
# D. I% e. U; e- }, J" ~# ]) E
function InitForm(){
; l) z9 y9 K- l% P/ q) f2 N& e//layout for the form# K! B! z: @1 g4 s
echo "<strong>Send Items.</strong>8 \  a4 N3 h0 Y% m
<form name='select' method='post'>
! H% s" g4 g# T8 B% O9 l" G<lable>Character Name</lable><br/>" W; b+ j5 Z1 i2 c9 d
<input type='text' name='char'/><br/>
1 F& ~0 j7 r, Y  S+ C- i<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>1 B/ K# v& W2 b
<input type='text' name='item_name'/><br/>3 ^1 i) g3 @7 g5 G; x; h
<lable>Item Amount</lable><br/>0 k' a3 X9 K; W6 {1 P. R& @
<input type='text' name='item_amount'/><br/>
1 l  Y/ s" Q) o6 g) N8 x& V<lable>Item Upgrade Amount</lable><br/>
4 T) N# i6 A2 z6 `1 m<input type='text' name='item_upgrade'/><br/>
6 O; k2 w1 y, A! R  m  K<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)( g7 s' U4 s; `4 q; O6 W& I0 y
$ x: j+ i, K9 i# |( O
</lable><br/>
) j& |8 |6 D. X1 q9 _3 k3 S) b<input type='text' name='item_element'/><br/>8 i: H9 Q. A4 K6 M
<lable>Element Upgrade Amount</lable><br/>
% y. R' v5 `! A8 ]0 U<input type='text' name='element_upgrade'/><br/>
& G2 ~$ E. \( o8 l+ n) q<lable>Pierced Amount</lable><br/>
: u  S* J! k9 i1 v1 [" \/ \* c* n. t<input type='text' name='item_pierce'/><br/>
# m) P! c; N0 W4 w<input type='submit'/>
3 \  }# t7 A) d/ U</form>";* ]  ~  z4 W4 h  i+ g1 z
}
; {' }& Q* X5 k+ B  e$ W
  V) q: Q' ]1 b& \/ T' O% K" Nfunction PostListener (){6 \1 F$ g5 H- w! Y# |: R2 U! K, Y
//Add more post variables if needed and add them to initform() function aswell
6 _; j' G: i( u3 S+ h! K! u9 m
4 h5 ?. O6 F: U: ^( U8 e: \################################! O$ |/ E% B+ V2 G- r
##### Connection and Post ######
8 Z/ [* s, |' A3 l7 l################################$ |" V: O0 g+ B
$name = @$_POST['char'];
) v, J+ I* d+ u" T9 R1 a3 B8 i$ItemName = @$_POST['item_name'];
# j! U2 i+ p0 P3 K4 G2 c7 b$ItemAmount = @$_POST['item_amount'];
% M1 s! Y! r% m- g$ItemId = @$_POST['item_id'];! o5 t& m$ a- P. P' p5 Y! F% M
$ItemUpgrade = @$_POST['item_upgrade'];/ M$ h9 |, T* q* k
$ItemElement = @$_POST['item_element'];
- S5 I5 ?7 p3 _/ _  k4 a( Y$ElementUpgrade = @$_POST['element_upgrade'];/ C9 x( V& M; h9 c: D" W3 w
$ItemPierce = @$_POST['item_pierce'];
# D- v0 P2 g$ A& t/ W2 {6 }( {################################
; p- O! N  d, m1 ]1 I
4 }  w! D; B+ `( l, N  y//Check both variables for empty value- r) [) ]0 C" e) g: o

, _1 q% S6 _3 i% @# Wif (!empty($_POST['char'])){
% Q. ?% `6 ?# Z, u- V2 G$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where 6 K* Z/ }; h0 T& }/ z
8 e. [# B, s' l& |
m_szName = '{$name}'");4 W9 \; e) v0 s$ A- ^
while ($row = mssql_fetch_object($find)){
' b0 G1 ?1 i. H7 \5 u, h6 c# B4 Xecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
0 E/ r3 m- i- K6 s& A7 D; G1 Y5 E$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], - Q! }& u; r* C5 ^. {
& ~8 u# h' _; k1 [! @, @
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 9 N  M. S7 D7 H0 }, g4 \

( _4 }( i! a+ |0 D1 ]2 o  m; w[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 9 O) r* e! ^+ B& k/ e8 q) e

6 ?9 x- Y/ e' ^) H8 s; lN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
% S, ~  {0 l& Q1 q6 s
! H7 _4 \4 {2 p( p0 D1 N3 E6 B) E'{$ElementUpgrade}', '{$ItemPierce}');");
1 p  E* A2 r( w9 |5 f9 t7 `) n}. |$ ^$ ~( K% [# D" ]

2 ^0 ^5 ?5 @* I3 L: W7 C}* m! p) P/ B0 z  ]
, J( m/ k# n$ J; c5 l
}& D$ X( K: b3 s/ L) y
& A% T4 y  {2 s/ F2 J! o- c6 P
$InitForm = InitForm();
/ P# o, y$ K3 r: ^$Listener = PostListener();
" j) m8 G8 m5 V
! e$ {0 r- d# U8 i. u?>
  U- V1 c3 f7 ~: ~
# q' w  ]5 V0 Z, T3 d2 y7 e- c  S2 f4 w8 Y6 W
, D+ \, t- k% @" ^$ b0 {

7 |1 I8 h! m" w. ~) Q  [
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-20 04:15 , Processed in 0.055857 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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