飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php4 g9 U9 q3 v4 T$ a
function Connect () {$ _- m2 P9 _. V9 n9 U0 _
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB ' e9 o3 l7 p) W8 T7 ]& z3 s" G
; U$ u/ H3 w; t: F) ^) W5 n: f
Failed.');$ [$ P" K, f7 d5 [4 ~' w/ r3 I
}
; f3 Z% |3 [( t: H: T) wConnect();: W$ Q8 n6 w; H; J2 E

: r5 R$ @1 o. R# ?! v* mfunction InitForm(){' I" |0 `3 V) h6 X. N0 }" t+ y
//layout for the form
; W3 M* q( r* G7 w, C' Q  p$ I5 `echo "<strong>Send Items.</strong>3 y; N! @* W- k
<form name='select' method='post'>& f& g, _. v7 t8 o8 {# W7 Y8 ?' g& O
<lable>Character Name</lable><br/>
0 Z, Y/ j' ]6 M' w# y! y<input type='text' name='char'/><br/>& n# ~7 }. `1 ^$ I4 }5 l; G9 C% E
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
& q8 ?- m  V+ L3 Z' r9 ]7 K7 y- O7 Z<input type='text' name='item_name'/><br/>
  q9 z$ H/ A; ~4 m<lable>Item Amount</lable><br/>
' |. C1 h/ h4 Q) S; Y: f. z+ Q6 r- Q& G: o<input type='text' name='item_amount'/><br/>) H# K) [; q- i6 X6 O  \
<lable>Item Upgrade Amount</lable><br/>
* X: C$ D2 s  R4 p; [7 L' W0 j3 c7 G<input type='text' name='item_upgrade'/><br/>
) i/ c. k- t$ x( g6 e% M& N- S" c<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
+ \) \% s1 j5 N  c; a  j' m3 s  _
</lable><br/># M7 y& p5 V) [  u5 V, q! b0 y
<input type='text' name='item_element'/><br/>
* g2 H1 p: X9 v<lable>Element Upgrade Amount</lable><br/>
3 v. q' u8 `: P* X<input type='text' name='element_upgrade'/><br/>
: r& S4 {7 M7 T4 N7 F<lable>Pierced Amount</lable><br/>0 V, t7 a3 j$ A% I' H/ d
<input type='text' name='item_pierce'/><br/>1 O2 U6 [* I8 W/ z4 }
<input type='submit'/>6 B% N1 r, X9 A" r
</form>";7 r9 X  Y" }3 d! X: }* c6 ~
}5 z0 ~' E, p) r/ s* W+ X0 L7 M  i
8 }6 \5 A' \5 j! q1 {; y; j
function PostListener (){
  |% w2 u# i+ _6 O//Add more post variables if needed and add them to initform() function aswell
% b- K0 A* D! j1 g" U$ h3 t4 O  x3 G+ `& Z' z* w8 d8 Q0 V8 P
################################
" T- H2 @- n$ M( V; H9 f##### Connection and Post ######; b, ~$ }" q- O& v/ @
################################/ M4 `# O0 E$ h: x/ t
$name = @$_POST['char'];
" b, Q5 u$ K! `1 D" O0 I  m( Q9 z9 R$ItemName = @$_POST['item_name'];+ ]  e( f! J( g
$ItemAmount = @$_POST['item_amount'];
4 \+ H; X) ]( ~9 {8 I$ItemId = @$_POST['item_id'];& y. p+ W+ o  \( |, P
$ItemUpgrade = @$_POST['item_upgrade'];" i3 H- S+ f: }. B6 v& {
$ItemElement = @$_POST['item_element'];
( V0 K0 g6 [8 s' p+ E$ElementUpgrade = @$_POST['element_upgrade'];, T/ ]% ], U5 K5 Z. l1 n2 m
$ItemPierce = @$_POST['item_pierce'];( n4 Q6 z# h  c- p" [4 p  c
################################: T. m0 C  @4 k  k5 g' n' y
% T) b# L) s( n  t. ~9 D5 Y  c
//Check both variables for empty value% F2 R) F! n' F
# j; ]4 g$ R6 w: Q
if (!empty($_POST['char'])){
( j& y; j: Q- R8 Q3 S5 S6 ~) n$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where $ Q$ b  J; X. h' C
9 @+ g) n% ?( {2 ^* X' J1 A9 ]
m_szName = '{$name}'");
, O6 P0 K# ?1 ^# D' c: \while ($row = mssql_fetch_object($find)){
: i" {3 G2 x! X; P: q- recho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";( u. K0 V/ M2 J" W, _
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], . K) f2 U4 I8 v; q2 d+ I& w
7 C' R# M( v+ y2 X& E
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
* {3 O! K, H' G0 L, u7 N7 |' K# D: f4 @) t' s
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
' d* B; c7 C) J* @7 n1 D( P! q
1 C' z( q' {5 u. p( Z3 xN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
, w6 c0 {  X( x) e. c' S7 {  l( M, R7 ~. I3 F) s
'{$ElementUpgrade}', '{$ItemPierce}');");
! x- O1 n; u+ g/ {+ y}% `9 I& p. Q' ^  S" o! R
. p) p1 P( ~# n) S8 W" u. N8 h$ X
}. |8 \) h" R- ?  ?

7 G+ G. h& s# t0 h}
5 b3 o0 z: G" T5 F& U3 J2 u
- o9 I% D, G: D! K0 \$InitForm = InitForm();# E! T  U  r) w
$Listener = PostListener();
4 R  J/ S8 Z- x8 [) Y5 w3 q* {' o8 h0 T
?>
$ M; p9 g, s% x# f6 B: ^+ J. _! v% j% e: I' e( Z
" @2 u0 Q! I6 s( L- {% q3 _7 Y
. f) O# S0 n3 k

- ?6 F% m3 S% k  O
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-28 02:18 , Processed in 0.067506 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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