飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
<?php$ q. c4 P. U* Q4 K& O8 M
function Connect () {
8 j: o8 t3 P! W% T) ?& w5 zmssql_connect('Server','UserName','Password') or die('Error: Connection to DB 8 l, k; m; d# t$ m9 p

& Y5 s# g6 B* T+ G' H6 _Failed.');8 \/ J: B2 O5 U3 J$ a% z: h' A
}' h  A5 }8 g3 g( n5 ^# _- P
Connect();9 R, ~& v3 S8 C
: j, ]# c5 \5 ]  P$ R
function InitForm(){* k/ R: h$ M' V, S3 |
//layout for the form
8 e* t7 u2 K, r  recho "<strong>Send Items.</strong>
* c5 w" m* t$ w* J<form name='select' method='post'>
+ v6 u% Y& _; m- E8 `<lable>Character Name</lable><br/>
: k6 }  M! o& S1 J( x<input type='text' name='char'/><br/>- W% s# y" W; e6 A+ a. `- s/ q) g
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
! X& N% _- F" s0 a1 q& G<input type='text' name='item_name'/><br/>0 L- h& l3 u5 c3 _9 A
<lable>Item Amount</lable><br/>5 @8 b" N$ Y- j. a/ N- _& H# v2 r
<input type='text' name='item_amount'/><br/>
9 C4 g( H4 j" [2 p7 ~<lable>Item Upgrade Amount</lable><br/>+ T  i% p" Q! v2 {
<input type='text' name='item_upgrade'/><br/>
# L1 t9 S& ?* h( M" p0 ~8 {<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.); H, Z: X7 N7 W1 A+ c# ?) O
; M3 T9 H6 c5 P# ~7 {( T
</lable><br/>
, F7 G+ k" L8 _9 e( j<input type='text' name='item_element'/><br/>
, }# W0 w& G* u* V- |<lable>Element Upgrade Amount</lable><br/>
% M# d. N. v  v! p+ e, v<input type='text' name='element_upgrade'/><br/>
. m4 U4 t0 a8 I) p/ @6 ?9 H& ]7 W<lable>Pierced Amount</lable><br/>& R9 g7 }. S6 B. b# S8 i
<input type='text' name='item_pierce'/><br/>) Q& Y0 v- _- w- U! j( J" k
<input type='submit'/>4 ]* O+ i+ Y. Z4 p5 y# t+ D$ b
</form>";
! P8 j" k" W. U  U7 {. N1 ~}% e' E( J1 \# Q. u, J

: G  I9 }. j- C& S) xfunction PostListener (){, [6 b: M2 ^( Y7 I( P/ P& t) u
//Add more post variables if needed and add them to initform() function aswell
( k6 V# ?; ]3 a  q3 z7 @: V" `7 O' F5 U5 v( E
################################
& P7 l. _& Z7 P0 l##### Connection and Post ######
6 q  g3 r% ?2 ]################################
% L, r) y. H! u$name = @$_POST['char'];/ i6 c" T5 n  `. X. a  R7 ~
$ItemName = @$_POST['item_name'];
( l( L; ]( m. i' N# C$ItemAmount = @$_POST['item_amount'];3 E/ J( U# c3 ^. S* _! [& U
$ItemId = @$_POST['item_id'];$ Y/ X: d& \, W. t/ R
$ItemUpgrade = @$_POST['item_upgrade'];& C% {, X5 e' W+ b4 u
$ItemElement = @$_POST['item_element'];
3 |2 D# j2 T( @% H* V" B$ElementUpgrade = @$_POST['element_upgrade'];
6 ~. g: X# T+ u+ g0 o5 F) d! s$ItemPierce = @$_POST['item_pierce'];
/ }, [2 O" `0 B6 ^################################( f8 n+ r0 C$ M6 s# R; V
* A6 [# v# R+ ]) w) d& I. X
//Check both variables for empty value- q/ a$ a+ S5 t/ c. E

' s7 k: N1 n2 \/ w3 O0 _! tif (!empty($_POST['char'])){5 q8 z1 F( h8 `; L7 |
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
* p! d: J6 c* [5 i' W  p% `1 O9 j8 q
m_szName = '{$name}'");! |2 F" j0 t/ R. S; k" t
while ($row = mssql_fetch_object($find)){  {( n  ~0 L' M6 f) j9 y7 V% `3 D
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";& Y3 `9 G  ?) Z* T  N
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], ! \5 Z  W# ~; Y  i+ Y- f) e

* L9 G3 b9 O% v3 z# t7 U[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
& o, S8 ?8 t+ b- w
: V/ r6 O# h( K6 |1 y[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', ; Q2 j- a5 R" a; }% @+ D3 B" @8 U: Z

% L$ a$ g! h! X, O5 M5 [! ON'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', % M; I2 _% K0 ~# Y& T/ H1 C
) H; n& Y. V& _2 o- w
'{$ElementUpgrade}', '{$ItemPierce}');");* O  \6 b7 ^2 |5 ]& X4 p
}# N2 Z7 z5 G2 k

4 S  L: h6 S+ Q% a2 `}. Y$ S. ~" \+ L0 |/ V0 I' |
+ I: }: A6 l) w  r" a2 S/ ~
}0 V8 z+ U2 }: i- ~6 c

3 r0 v! F6 i' e' |* E* T$InitForm = InitForm();! u/ Y3 [* x; D
$Listener = PostListener();% b3 |% H, P- L3 g

! f2 t1 |; Y# s! n/ h- n6 V?>
$ q; b3 Q8 Q9 D4 }
( V) I& I3 U! \) H) N7 v+ M1 |) l" j* ^. Q6 `
6 J" j8 m7 w$ ~- e% U

) S2 F4 p% T+ X' T3 r
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-1 07:15 , Processed in 0.059172 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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