飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
<?php: s  M) ^" @/ `- C
function Connect () {
: R2 W$ t) n5 r" n- I# }mssql_connect('Server','UserName','Password') or die('Error: Connection to DB " V* Y1 S+ Z& [4 a$ P7 z, M' t

7 ?- d+ D! ]& G3 W  b7 QFailed.');
" I, v; l& X# K3 Y: F% l}; K: ~4 I+ i, R( F9 e7 P
Connect();
2 U3 _* X9 G- p3 V: T+ y9 Y, y% l$ w' z% U7 A" \
function InitForm(){
0 f5 I4 z' }" s: T6 a% b1 y# [//layout for the form
* `% P2 k- W( I) P5 y1 G/ Uecho "<strong>Send Items.</strong>
. s2 \$ u: ^  u: K4 v<form name='select' method='post'>
: O4 x! b5 d5 a, |5 |<lable>Character Name</lable><br/>
+ V$ A- a' k. ]$ I0 j0 O5 ~<input type='text' name='char'/><br/>
  |+ l0 U( h* f. i* r, C* p<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>4 q/ o, D3 U; q
<input type='text' name='item_name'/><br/>+ G" J0 A! I9 b7 \) ]) M
<lable>Item Amount</lable><br/>
; a/ L) b$ u# ^2 f<input type='text' name='item_amount'/><br/>
0 P) O, Z8 d$ H! p/ ?& S<lable>Item Upgrade Amount</lable><br/>4 H9 t, Z1 _* |2 t) m% i
<input type='text' name='item_upgrade'/><br/>7 h5 h, a# `' U5 e8 R
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)- ?- A+ Z- D* t  N/ T1 J" \
9 P( e; P3 G) L8 ]' w8 [
</lable><br/>% x0 Q: g% _. X* u* u
<input type='text' name='item_element'/><br/>
! \' v1 Z* C0 L! r<lable>Element Upgrade Amount</lable><br/>
9 \% p" v/ R- y  @" n& z$ H<input type='text' name='element_upgrade'/><br/>
, f1 W8 i2 [9 B<lable>Pierced Amount</lable><br/>
8 D9 F, R5 J  Q$ \- k  v<input type='text' name='item_pierce'/><br/>
; X! o9 ~$ l' h7 f<input type='submit'/>
- D5 G- A' }1 K) a</form>";
" |( ]% }( Q3 e- t, _/ J, [, |}! Z, U+ r. ?- R  U! W- p% T

9 i5 u# u1 R$ w) b: U2 x4 |" C6 f  {function PostListener (){6 E" K0 l$ {! a; C4 b
//Add more post variables if needed and add them to initform() function aswell# @7 g, t9 A* y

, j0 A9 m, Q5 c# b: W################################/ X' x% M/ h) ?) u" x1 P
##### Connection and Post ######
3 Y7 d* L' ?9 I) B+ \3 s% u################################+ h  ?# G, C% N$ O8 `: B9 `
$name = @$_POST['char'];
, o- n+ ^) D0 G' ^8 {, ?. I$ItemName = @$_POST['item_name'];
( ~/ s8 E2 U. U  O: c$ItemAmount = @$_POST['item_amount'];
3 g3 T; C6 `1 g5 B/ d, p- ?$ItemId = @$_POST['item_id'];6 {  {$ n! Q* y- s: W' |. z
$ItemUpgrade = @$_POST['item_upgrade'];
$ b- B! v& }/ e" E0 k0 U$ItemElement = @$_POST['item_element'];+ v* W* p5 j, A7 F/ ~
$ElementUpgrade = @$_POST['element_upgrade'];
: r' N/ ]# G& g( s) [; c$ItemPierce = @$_POST['item_pierce'];
: h+ c" U4 n5 K5 G% `/ }; h$ H################################. j- U. U& e* l2 F
4 c  q+ W% |! V
//Check both variables for empty value
4 B* m. `" Z, e$ P, B0 _& G3 P9 a3 W
# u9 V! |, T, [* }& m: T8 kif (!empty($_POST['char'])){1 A/ E# W( @6 \
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where $ J( d7 Z) t% {& I$ v1 o. n# J
5 r1 W. {4 _9 c: V, }
m_szName = '{$name}'");7 ^, p( e; C0 ?" o
while ($row = mssql_fetch_object($find)){
1 O2 X: D" o9 _# |  becho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";& f; I( _) B& T
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
' @; N! x  g: _; `; R+ b& y1 i  j* J+ l) Y( p
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 4 G- B. N; w( c2 |; [

: D; ?4 A; j" _* `4 ^[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
! n) l) P! S# a2 J! V8 z& W& }* R- V) M/ h1 y# G
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', $ _& {/ \9 E; [& U4 I
% t& F! ]  k/ }% a
'{$ElementUpgrade}', '{$ItemPierce}');");: w# S3 m- |7 b
}% A  b" @6 }- H5 s& X: r
: C0 ~0 o6 h- k* t- N& c) U, V
}
0 c5 `* H% e' u8 p( \' _0 d: s2 I' V2 J4 W
}
0 a: x) S  y6 \& ^  ?6 P
+ j/ Q7 P/ ]3 `$InitForm = InitForm();
3 v6 P6 J6 N5 D9 r3 D$Listener = PostListener();6 P7 L) `5 q" @8 m
" y3 a" }, z- Y& S
?>- T& p( P! [+ x& V9 O

3 p, E5 T# \3 W, F/ [& e- S- g5 A' A: L# \; P2 m
+ D& l1 u0 L- Q
1 R) U  F& w6 h1 v$ v% z# ~( r
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-26 02:33 , Processed in 0.075920 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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