飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
<?php
, _4 _7 j  Y& }- D- U- V* J& _2 Bfunction Connect () {
+ [2 z4 {1 m' M) |% Hmssql_connect('Server','UserName','Password') or die('Error: Connection to DB 3 M1 T8 n3 g* ^. }6 Q% x' Q

& z, L, m( a+ O) U  S! W# j  [Failed.');
/ p8 ?* e, R( j9 L}
' L- G$ K# y" P" ^Connect();
8 N1 G2 G% p8 t% A, L  c4 Q+ X
* Z% |  `* E* a* l' A2 r# M- D8 C8 ?function InitForm(){' y& ^" A  k: C( M
//layout for the form" r( i6 O- T4 d+ M. `: s
echo "<strong>Send Items.</strong>
+ V! _) Z" D3 o$ |, F6 J3 {<form name='select' method='post'>/ a8 ^; M. m, e" g1 `# \0 E
<lable>Character Name</lable><br/># c8 ]" L. t9 d
<input type='text' name='char'/><br/>
" @0 {6 \4 m; N( c- q<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>5 o# |0 y0 W4 i
<input type='text' name='item_name'/><br/>
2 c7 Z# K: c7 `, j<lable>Item Amount</lable><br/>
2 l) J" q+ H! I* c! P<input type='text' name='item_amount'/><br/>' L* S) B! |7 p( M
<lable>Item Upgrade Amount</lable><br/>( @6 W+ q( F2 Q& A
<input type='text' name='item_upgrade'/><br/>
3 u3 G3 c- b4 M7 _& w: M# q7 Q<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
6 S7 T! b5 x" f1 Z. j
, p2 t, z) A/ S7 K" \</lable><br/>
4 g1 c2 ^. z) _; t5 n" Q<input type='text' name='item_element'/><br/>
& R3 D! Z& ?4 Y( e, C+ y1 P<lable>Element Upgrade Amount</lable><br/>
- k# d4 Q2 K* k5 M! W2 d7 O' a# L<input type='text' name='element_upgrade'/><br/>) {( p1 k! w, \8 Q7 S
<lable>Pierced Amount</lable><br/>/ L6 W  p: P  R( ~: a/ L
<input type='text' name='item_pierce'/><br/>
* q6 C) g8 ?" I( p9 L<input type='submit'/>7 @( W) ?& _  p
</form>";
% j1 k8 o6 t: J4 c* @}' k, z. B$ d* @7 h
+ |8 ?) Z2 g2 S2 i
function PostListener (){% o0 h" {. @8 M' Z' n0 P: e, J
//Add more post variables if needed and add them to initform() function aswell
/ `& ?% Y! h$ |% T9 y9 g" ?, B6 G% h" M; F, S% O+ W& ^: @
################################
. V  Q9 z& M( P##### Connection and Post ######. c# }3 n5 ?( [2 ?  G4 e
################################
$ ~' l3 f$ S3 `/ w1 A8 I6 n$name = @$_POST['char'];/ \( l/ x( |# A4 U( b& n
$ItemName = @$_POST['item_name'];+ E. ^4 k) j8 ^$ x, {0 |' [' Q/ Y
$ItemAmount = @$_POST['item_amount'];
  z% ^. g: c& Y% Y, p$ItemId = @$_POST['item_id'];
2 z7 E% v; J$ q/ O+ I- T$ItemUpgrade = @$_POST['item_upgrade'];- r- m6 ]7 h+ R0 ]6 h7 S4 M
$ItemElement = @$_POST['item_element'];
& v* p/ _) S2 C% _$ElementUpgrade = @$_POST['element_upgrade'];, n4 r/ O# I# a
$ItemPierce = @$_POST['item_pierce'];8 Z( `+ n  Q) u. W) J2 h
################################, B& H3 j! z9 M/ c" \% d9 I

, z) E0 u" K6 h3 |8 C& _' ?//Check both variables for empty value- O3 t- F' U4 i) @5 ~6 L7 M

) a. ^4 o/ x' N, O& I8 kif (!empty($_POST['char'])){4 y4 @6 Q3 r, p# Y
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where , m. w  H" P- q" \& i
7 `7 [/ Q* Y& y  h2 b& z- Q
m_szName = '{$name}'");+ |/ @% t  u" `/ \6 v+ }- V) c
while ($row = mssql_fetch_object($find)){1 q0 N9 f: `  t# l6 d! A  w7 s
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
1 k4 ~& E. X, m: P7 P$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
: C  u) @+ Z( u
/ L! t5 n2 y7 b( T7 ?[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], & H6 A3 d  N- x5 B  T5 `
" L5 U8 J" S2 M" V: R) s3 k  V
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
5 B: H% \  E# z) n) X) K' k
" Q( J+ e1 V4 ~N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
+ W1 e' N- \! O3 Z0 J% e- g6 U3 o1 _4 E
'{$ElementUpgrade}', '{$ItemPierce}');");
+ @6 w4 m8 \9 r1 X3 V}
+ q/ @9 B/ b5 x; I2 w: {& t* l% U* m1 K% ]% h5 z
}
/ }" l; x/ y- X6 q2 d0 W/ L' q, a$ O" t# k/ O: W+ f  T  G  u7 s
}: e" p6 ^0 u: b; @4 w! m  a- ~: G

4 v. B- I( o' x' A$InitForm = InitForm();. }3 Z6 Q* D/ N
$Listener = PostListener();; _; h+ ^% Z# h% w# F( x

$ i+ C8 M$ q; o9 C7 N& `+ }?>
" W/ E& F) S/ P3 m. J( Y* N1 M7 E; l; }! `4 f( \" N3 R) e" W
- ^+ G9 G( Y5 ~) I2 d. ]

+ G; |# ?6 P/ u7 Y' N( S: D: W) y( r; J! h( j
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-12 22:38 , Processed in 0.080029 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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