飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php7 L; a- o9 _3 P7 }
function Connect () {0 H3 z8 a% H5 p: Z- D- n
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB ; q$ [/ J- e% H/ i" y
* N( x! s) a4 G) ]$ U2 `
Failed.');: G$ `& m2 c* z' I6 j2 y
}$ X4 p8 Z  E& z. `( m  x
Connect();8 L% r2 L6 [8 F" D' v
$ I2 A$ S3 z6 c
function InitForm(){
' Q6 i# l7 ^9 y; B0 }, e* c//layout for the form; u3 I7 s9 u) b% a3 G& E
echo "<strong>Send Items.</strong>
9 U) X8 H/ A4 a+ @9 ^<form name='select' method='post'>4 y' }3 t3 ?0 q( H5 q$ a
<lable>Character Name</lable><br/>
; _; W2 i# p" u<input type='text' name='char'/><br/>6 Y7 Z) s8 s! q; s& X. B
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>- ~# g" }  z2 Y
<input type='text' name='item_name'/><br/>
8 O% A" q: {# m<lable>Item Amount</lable><br/>" ]: E7 _( G% B! w" v4 K
<input type='text' name='item_amount'/><br/>' A# U/ y, g" `1 E9 t& `  ]
<lable>Item Upgrade Amount</lable><br/>) }" c  [& I" `7 h) x5 z
<input type='text' name='item_upgrade'/><br/>/ F) p  y, p4 r$ p1 f
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)8 C% v0 J+ p' l# E) T1 N
4 F9 N! Y" M6 E
</lable><br/>1 ?5 c" x& g5 O0 x. b
<input type='text' name='item_element'/><br/>8 \: G5 s- _, x
<lable>Element Upgrade Amount</lable><br/>
6 A9 Z. I( f: ?8 G, I<input type='text' name='element_upgrade'/><br/>
  ~4 p6 Z, ~# c<lable>Pierced Amount</lable><br/>, O2 u9 t5 n: Y
<input type='text' name='item_pierce'/><br/>8 [+ e; H9 u& h+ S0 [. U
<input type='submit'/>
+ t8 J: F( C( _, u</form>";/ {8 e1 u4 m! O; Y. d+ e% P
}
  l3 E% E, I* x5 g4 g3 L+ J* G. w+ D! l( T, l8 c
function PostListener (){
. Y2 i& J& e' n3 h2 e# G$ f% J//Add more post variables if needed and add them to initform() function aswell6 u/ {: `2 X, `- L5 L

# x. S5 l( J2 M0 R3 E* J9 E; T################################, M% }  j  @, _1 L* V
##### Connection and Post ######. u) t8 y! Q9 T. u9 ?7 \
################################
( _2 v; v) ]; f$name = @$_POST['char'];$ U: P+ Q4 l( A0 _" z% h3 Z
$ItemName = @$_POST['item_name'];
2 _) q- ^# V- U1 ~8 i$ItemAmount = @$_POST['item_amount'];
5 `; ^0 A' Z- ]2 _1 A- ~$ItemId = @$_POST['item_id'];
5 t% T: Y9 ~0 P" s# I* ~2 x* Z# {$ItemUpgrade = @$_POST['item_upgrade'];9 b+ `* r9 K" A: q% m
$ItemElement = @$_POST['item_element'];$ ]6 T4 Z4 M; {1 d  R1 C! Z
$ElementUpgrade = @$_POST['element_upgrade'];
+ T: u" [3 ?, S7 o$ItemPierce = @$_POST['item_pierce'];5 E) P" v5 o. |3 d5 J
################################
+ G" ?+ Q% V, c5 @/ F
3 Q9 Y, r. s3 U- `0 t- o//Check both variables for empty value* F& \0 Z$ z2 a- [8 L- l

# ^" F5 E4 G7 m8 h8 `" J  xif (!empty($_POST['char'])){
. R" d' B# R3 w! F$ P9 A$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
. f+ E2 l+ u8 k  D$ e+ A2 `
7 G+ M6 {8 @, ]( F: ym_szName = '{$name}'");" k- c/ Q* J( j& N0 d  B/ S, I( W
while ($row = mssql_fetch_object($find)){
. \7 G8 L6 K7 ?  Oecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
/ A# g% i7 i; ]$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
/ A' G& I. O! Q# T5 A+ `7 W2 e
9 C" E% e# N- z# h[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],   ^! `) o# _1 ]( I) U
5 [# j: E9 V+ @# }% H0 _7 M! Q6 F
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
& I5 @: {1 G! \/ J; N. i5 d* i9 ]; ]# y5 o
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
$ h, S* _0 o5 s' B- r) o2 w! C9 P- \9 _. O- P' v7 N
'{$ElementUpgrade}', '{$ItemPierce}');");, _8 J% T0 z7 n  K
}; a9 x' Q, x5 P6 K2 S! y
: P! k# |- B' Q0 r
}. j' ^% P% ^( B+ a0 P; ~  K
: h6 |# x( }, U/ z( [
}
$ o9 [, }- F  v" M4 d* F' `( X. j  M+ \4 H4 i6 m+ s) {
$InitForm = InitForm();( f0 p: C& k+ d* l/ [% a
$Listener = PostListener();
. W: ~! r5 W: c9 f0 L3 g3 q' d6 I6 M- |6 Y& j7 d8 T; e/ D
?>! m; l# s7 |9 [% T

4 K4 ~7 b" i# \3 x
# q- Y  r2 \2 [9 m+ ?7 \
. ]- D3 J7 C6 [" d$ k
2 e* b  W7 j1 R+ M/ @$ D( x8 i" ~
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-11-28 06:17 , Processed in 0.058996 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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