飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1092

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1092
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php; y* ~7 W8 ~9 R( i$ i' ]
function Connect () {. Q0 o# [# U7 e9 x
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB 4 D, x8 N- [9 p6 i& L+ ]

1 B7 P1 ?" V& ?" D+ [Failed.');
+ F4 h0 z& u) W2 E}. j, _# \, g% O+ c& `
Connect();4 u* _* T5 q2 k1 @& \6 T4 l1 J- N

3 \) J# U8 F2 ]9 `# E& L4 Hfunction InitForm(){4 f( m1 ~. K, R* |' x# u; M
//layout for the form) l2 ]$ T, ^9 E. I  ~. u7 P
echo "<strong>Send Items.</strong>- _* d: Y; o. V  n  V
<form name='select' method='post'>
- G" E6 t+ i2 `; J" ]9 n1 B  k<lable>Character Name</lable><br/>* ^! F2 C  V7 u0 Q3 |1 w
<input type='text' name='char'/><br/>9 p. R8 g7 p& T+ {# L  t9 S
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>5 H# a2 S6 D/ `! P0 k& |
<input type='text' name='item_name'/><br/>
8 y; `5 M* G; K9 ?& L! e" _<lable>Item Amount</lable><br/>0 b( k. a$ R2 f, i
<input type='text' name='item_amount'/><br/>" C7 C6 w3 c# }2 [# \. Y% K
<lable>Item Upgrade Amount</lable><br/>  j5 u2 e2 k2 [) M4 d# n: L
<input type='text' name='item_upgrade'/><br/>( T; S8 k3 [, z+ V" c- d
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
1 `2 |& |0 ?" v% m% |. }) D7 J; h9 E7 Z" E$ I6 P7 S1 N, A
</lable><br/># f& w, _- ~4 H0 _  A6 n# z0 W) }# C
<input type='text' name='item_element'/><br/>
6 L: J* v5 l3 N" I" R' q9 P<lable>Element Upgrade Amount</lable><br/>! O% T- C' {6 |5 r$ y7 H
<input type='text' name='element_upgrade'/><br/># u) C  s2 i1 f7 |2 T
<lable>Pierced Amount</lable><br/>6 L6 K9 w2 a: H5 g' V3 y2 k( a
<input type='text' name='item_pierce'/><br/>
7 I" d' T* G. k1 }<input type='submit'/>
, N2 q/ K6 G7 L4 v</form>";% F7 v0 i0 N* g
}
) u% p( m- N* f$ {* w" M
4 x! f7 g* ~; O- l  Vfunction PostListener (){
2 Z* O, @6 F8 Y) G; d# b//Add more post variables if needed and add them to initform() function aswell/ a& _2 O) k/ I7 l; r; P( X
) g3 ]  A' J: d# N
################################
: Y6 ~6 S2 [" G( w6 \1 e##### Connection and Post ######. h7 p5 e/ p* D  J% @5 c0 g! F: E9 w
################################
4 u; Z2 ?- T2 J7 q. e$name = @$_POST['char'];
& p" c7 T' u/ X! K6 t7 h. \$ItemName = @$_POST['item_name'];2 x9 [3 ~$ G) O* L, O3 m0 ?0 E
$ItemAmount = @$_POST['item_amount'];, P* ^$ y$ p0 ~5 e  D1 s7 J
$ItemId = @$_POST['item_id'];3 o3 ]4 b( z! h2 [9 L* D0 ?# A
$ItemUpgrade = @$_POST['item_upgrade'];
/ M" K' J+ x- G  V7 {1 q$ItemElement = @$_POST['item_element'];
# y$ W3 y# Y* S. ~. v$ElementUpgrade = @$_POST['element_upgrade'];6 q, L$ j0 ]2 l; `
$ItemPierce = @$_POST['item_pierce'];
9 K4 }1 y9 a' {0 x################################
- a+ w! I1 `2 c* ~6 l
! C$ ]/ g* d. _' u1 \  A5 y: S//Check both variables for empty value
6 O8 B8 p7 p4 p: r* \
. ]0 |* c1 f4 X) M6 r7 sif (!empty($_POST['char'])){
, ?2 I, M2 |  k' T' x* P! J$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
7 k  Q6 w0 k& G$ [$ _1 g, R! J# t' ]2 L$ `9 `; D3 n9 h" }
m_szName = '{$name}'");
4 M# }6 I$ o- R; }3 Wwhile ($row = mssql_fetch_object($find)){3 Q" a& ]' }+ G- i
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";; ?7 P' w1 T4 h4 j) X; V3 r6 S
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
' G5 T( l% J+ I4 m4 c6 N  v3 C/ E
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], ( A* ~; t: P/ I

) u: p1 Y# @# F) g+ e9 I[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 2 G$ @: y  D& U% u0 F  v

  j  M# a! f2 J/ UN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
& m4 l( t% w3 R/ X& r: r+ j. b& i0 S1 Q, P; o% N" R) Y3 h5 W/ t
'{$ElementUpgrade}', '{$ItemPierce}');");; x" i! m/ o1 c( |: ?6 J
}
3 k- _( z* I$ A9 y7 O: B/ i
  B. a& W2 p5 H' B' G. y8 ]6 l0 h}
5 G/ G- k0 z( T7 n+ p7 u
; E6 G6 ^3 b; Q! A* P}
. ?  C7 L) C+ P9 f7 r: E3 R
, `2 ]) D3 V, a; W# H) _% q+ O+ W$InitForm = InitForm();1 K. ^, F6 X3 O# s
$Listener = PostListener();
* B* x. W: x, }7 W) M
% H. F5 V; @3 D4 |( B, j?>
/ u1 z3 z5 Q: b9 G8 s5 m0 C% x  g$ Z9 ~1 p1 R

6 A- n: Y( a* l9 X/ P" }
' Z: ?+ ^7 G# Y% c( R7 i
- [4 p% l' F( c! Y0 v
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-30 22:01 , Processed in 0.066005 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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