飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1090

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1090
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php3 }! ~" b) h; D
function Connect () {
( G( P7 J& ]2 q2 f8 Cmssql_connect('Server','UserName','Password') or die('Error: Connection to DB 0 }1 o  I, ]* U/ e8 n% K

' M% J+ B( s# N- k' `" f. iFailed.');- v9 o, G8 p; i8 y( s: e# u
}
6 T* A1 B$ {. v3 \; V7 y' w& cConnect();
! C& c* @) X2 B: I6 C6 J
0 ~! ?9 ?# o; {2 m! M% ~0 dfunction InitForm(){8 {( o% i' x) m- ^- G
//layout for the form
6 ^* V8 \8 C; W! P3 y& c/ cecho "<strong>Send Items.</strong>
, S1 t! E8 U4 t<form name='select' method='post'>
6 B& p& ^, g+ b2 L<lable>Character Name</lable><br/>5 V. V( \9 E' H0 i6 A4 s$ y2 A, W- F
<input type='text' name='char'/><br/>" V( H1 f8 }* K# J2 p3 }0 x' C$ H
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>  O- h' z, ~- T5 O7 |) q
<input type='text' name='item_name'/><br/>
  P9 g2 @/ t2 B* q+ X<lable>Item Amount</lable><br/>
+ H% V- J* z8 D% v% G" m<input type='text' name='item_amount'/><br/>3 K& z$ H6 s: K( R
<lable>Item Upgrade Amount</lable><br/>
1 y$ l( t  ?  j, L1 q3 \1 S<input type='text' name='item_upgrade'/><br/>
% A/ S9 O/ f, t4 a" T% W5 ~( ?<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
9 T8 M9 x  [5 B) r# q7 c6 X
; Q( G" w( W1 t: [</lable><br/>
; j$ Q5 v$ O7 ]! {/ t2 O" `6 G<input type='text' name='item_element'/><br/>" f; b# }' b7 M4 R, O2 H/ ^
<lable>Element Upgrade Amount</lable><br/>
. \; _# H3 A& D1 l6 B- H' t: F8 J<input type='text' name='element_upgrade'/><br/>
9 t+ }! d: ]' c4 |3 z* J<lable>Pierced Amount</lable><br/>7 g! r& N5 c' k3 e2 O- K$ Z
<input type='text' name='item_pierce'/><br/>
+ g$ p5 \2 \: o' d. q<input type='submit'/>
( J/ J, X) |4 G. C</form>";% Y2 H# X* N+ R0 {& ]2 i
}
- f/ c  v1 t( g1 g- E9 L& N/ y' N, v) _; n' m# Z0 O- i" a# z
function PostListener (){
' }% d3 ]5 _: B//Add more post variables if needed and add them to initform() function aswell. t% i. S; L8 a: h5 |! b) [3 r3 H

7 x4 n2 _7 \; e################################* b( f4 W5 j) h. [9 [
##### Connection and Post ######
3 s" o; r* I, D7 E+ Q################################
# P7 \0 t  `+ w3 b' }6 b* i$name = @$_POST['char'];
4 f) n$ h7 _: j$ItemName = @$_POST['item_name'];8 g+ f3 B; h' H6 }# s# c
$ItemAmount = @$_POST['item_amount'];. U! ?2 R8 u, |
$ItemId = @$_POST['item_id'];: Q: _& G& e+ G. X1 s6 t9 M' Z$ H9 ^2 d
$ItemUpgrade = @$_POST['item_upgrade'];
$ b9 d% e' x0 ~) R1 i: V+ S* t$ItemElement = @$_POST['item_element'];
$ A# w/ z4 w! {# j" m$ElementUpgrade = @$_POST['element_upgrade'];$ G. v6 K! ]/ s! g
$ItemPierce = @$_POST['item_pierce'];% G$ _6 j* r/ Y8 _' c
################################
: w4 A# Q0 E; E4 T
; J  K. `) i) U8 ]& H//Check both variables for empty value
3 x# @4 R/ b8 i
- C+ A  v8 Z" v- Lif (!empty($_POST['char'])){
0 a$ r- R9 s' \8 ]& g& v3 ?$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where 6 P( X, @+ K: s9 g0 |

1 C. `  l& [8 k) Zm_szName = '{$name}'");
0 Z( z& y( @& c: Y. d7 Wwhile ($row = mssql_fetch_object($find)){$ `( J! `$ z/ F  [# s
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";" t# b  [5 a. L9 w- F. G
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
4 G/ ^7 v) y) v2 Y: j6 Y# c2 |" x6 T
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 2 o/ F6 m% S( N' d

; ?* w5 w9 L( t( F; K& z[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', " p, }3 Y5 a8 j# N
8 p) C8 F- T9 w: v5 f
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
* f6 s% \* E* e" V+ e! w2 Q
$ s, y% Z2 J- i" ?5 m8 Y3 Q'{$ElementUpgrade}', '{$ItemPierce}');");" }& T2 `8 Y, q$ F. n0 B, U  e
}8 R+ x/ Q% R+ k+ j% a) K% q  z
& n; q( N8 [" W8 ]) T
}0 Y: K' O$ [, \- M" P" G# b

) l$ d0 C/ P' e& Q* `2 J}
- }# I3 |2 t0 J2 y
( r. A  s; B+ f2 C4 `( u- c$InitForm = InitForm();
& W$ o6 m* }! O; o8 M- M$Listener = PostListener();0 k2 W9 J7 h# \7 G; }

4 B9 u) A2 }- R4 {6 J' [* i% S8 m) W?>: Z0 O, o1 ?( F2 R, d8 P, b

5 a7 w; ^* P% `8 q2 w. \9 i1 A- Q0 v8 B6 s% w

5 Y0 Q1 e! w" h! x; T' C" L0 [/ F% |$ n% a# l
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-28 14:27 , Processed in 0.060327 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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