飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1090

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1090
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
, @: i+ b( o. L  I  R( `function Connect () {
$ i. f5 j, C1 Z$ M% Kmssql_connect('Server','UserName','Password') or die('Error: Connection to DB
$ H' s# Y% L' L! U, W/ k
% ?/ t1 b( O5 g, Q* TFailed.');
* B- ?4 _1 U" p' l}
8 F% A9 v* Q4 ]' iConnect();) w! h: x( B; k+ q8 U6 u( X
0 N" Q4 h" Q( a* d7 U
function InitForm(){$ @' x+ J- Z# w2 Y, i1 g
//layout for the form
$ x: H: f* B, B+ eecho "<strong>Send Items.</strong>
3 ]& N, r, w$ O0 P) S<form name='select' method='post'>7 e: p1 q, f) d4 S9 J+ x
<lable>Character Name</lable><br/>3 s% Y; l3 }' [, w
<input type='text' name='char'/><br/>
" I5 R+ `4 `" D8 S7 ^5 M2 w. t8 u<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>; U( o: ~; K0 x/ d2 Z+ M
<input type='text' name='item_name'/><br/>4 q7 {& Z" T$ t: R% y
<lable>Item Amount</lable><br/>
4 p- y- ^/ |* j* Z% a" F<input type='text' name='item_amount'/><br/>" Y- @" N( X. z/ A" y! p* ?2 N
<lable>Item Upgrade Amount</lable><br/>
/ O+ G& t  e8 h( R4 H<input type='text' name='item_upgrade'/><br/>% v: v2 B1 j: ~1 k& I
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)! v0 P8 {/ W) H
, w, H5 ~; [) u% j0 h
</lable><br/>
( A! l9 f2 I0 D6 _$ Z<input type='text' name='item_element'/><br/>' Q- U8 n( S* f" M/ G# {% w
<lable>Element Upgrade Amount</lable><br/>
4 j4 j4 A; D% f8 ^  d) e; K<input type='text' name='element_upgrade'/><br/>" x( t& A& E% ?2 o- N( F
<lable>Pierced Amount</lable><br/>4 i5 q2 O: e; Y5 z" E
<input type='text' name='item_pierce'/><br/>) c$ V1 y7 S9 F: J7 n
<input type='submit'/>& R$ [3 C$ C) m% s! t& h
</form>";
8 d( a& \8 w! S; {- @}
% ?9 r7 {2 ]; N- R# `
! ~2 J1 f3 w- `, z" pfunction PostListener (){+ O1 C% j& \3 |& U
//Add more post variables if needed and add them to initform() function aswell$ a# `  U' a+ b
3 x/ a- _! A" U7 z/ W2 O
################################
2 J. u" n+ I  c3 q* N##### Connection and Post ######
4 q  ]5 a6 q2 |, m& D2 l  L8 G: z################################& i8 x  T9 `& s; b2 V# p8 @% H
$name = @$_POST['char'];
1 G, A. A& R, O  x5 a2 \$ItemName = @$_POST['item_name'];
% d  r7 h7 p, a! ?6 n# s) r& _$ItemAmount = @$_POST['item_amount'];
$ L4 B8 _+ v2 ]) u& h9 o# U! O0 J$ItemId = @$_POST['item_id'];, u0 r* C  \  v* p/ @: n
$ItemUpgrade = @$_POST['item_upgrade'];9 ^* F3 }$ q$ b; Q, `. B' V% I
$ItemElement = @$_POST['item_element'];- ]! |$ C4 d9 G1 p6 K
$ElementUpgrade = @$_POST['element_upgrade'];
2 T# S) v* s% `& {: e6 c  N( ?6 @$ItemPierce = @$_POST['item_pierce'];! w2 c* o) r. l7 E4 Q+ F5 B4 x* F
################################$ }% `6 T- J$ @8 D& H
7 }1 Z+ l) n( j
//Check both variables for empty value
- T  M0 o1 T- U. O$ a0 ^  {( E' G6 M& ]+ F$ B6 y! U
if (!empty($_POST['char'])){4 y0 X/ G2 q+ B  \  z
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
$ f0 O+ J. {" t) |& f1 G
# w7 U# W5 j! um_szName = '{$name}'");
3 Z. }" h1 [3 N5 `) ?while ($row = mssql_fetch_object($find)){) T; @5 Z0 W4 c( |+ Q& g1 S3 j
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
4 |+ ?- c" T- J% d6 r$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
! @" G  y  ?' I) \9 f0 ^, e* i* v& k( H
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], * J/ n3 Z# X( c0 f9 H

* q9 j7 l8 v* A" X* P[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 5 m& e5 F) k: F
& w6 `4 I4 Z& P  ?- I. X" h! j
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
+ S1 e  L7 }+ B2 p5 ?2 i  k7 }  I9 h) a
'{$ElementUpgrade}', '{$ItemPierce}');");9 m7 ^4 m7 P$ _& [+ P
}
- ^9 z* d+ E& `( {& Q1 J5 S( A: o3 b$ N% n+ Z" D, ]: \
}
/ `2 d) m2 `9 _& y2 G, {+ u! p% _5 P4 s
}
5 J; B: n: j) K$ S+ @1 k
0 Z+ D) p: W( [0 t$InitForm = InitForm();4 F0 G( v7 `- o
$Listener = PostListener();
2 Z3 s8 P- ?0 D2 ?6 z  x# {
. n9 `) k7 X1 Z  V% I  f?>
3 W+ M! I& b3 z2 j
. h  _2 P, E2 |1 W! z6 E9 Z! K" m. B6 D, k2 }

4 q; [+ Y! E( `9 C5 _/ V" t8 T. J+ B3 W. p+ A$ m
回复

使用道具 举报

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

本版积分规则

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

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

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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