飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
; T5 d* J" a. B" ?& q& Ifunction Connect () {
% \8 q1 F4 I* K- p7 N' D9 \+ Xmssql_connect('Server','UserName','Password') or die('Error: Connection to DB 6 c3 F0 y$ K# I" l  n
9 s/ x# ?  \) [/ `
Failed.');
1 b6 T2 ~) U% k( a}+ w1 \0 i6 X3 Q" @  c4 j. y
Connect();
/ l: D4 E8 ]; F7 Z; P7 l( ~+ r7 k! m0 D6 F
function InitForm(){+ j( t0 ~8 c  M
//layout for the form/ `2 {7 e; e3 O- ^; V! p- G
echo "<strong>Send Items.</strong>
0 n6 X1 n' P# o8 K5 E% k<form name='select' method='post'>& M# b' g7 @9 _7 n7 a
<lable>Character Name</lable><br/>
% s! q* `' Q. x<input type='text' name='char'/><br/>
) ?( h. l* Z8 r" B" \% \<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
3 j# d% D+ t3 H& O8 N6 B<input type='text' name='item_name'/><br/>* u. _- ^! ]4 x. X* ]' J- t5 H
<lable>Item Amount</lable><br/>
1 ^5 w, A5 d: ?2 I5 d3 b9 K7 g% N/ l<input type='text' name='item_amount'/><br/>
  c. H8 q1 u9 h0 r" r$ g<lable>Item Upgrade Amount</lable><br/>8 a! s' M  X. _0 ?+ @; B
<input type='text' name='item_upgrade'/><br/>- h5 W9 X2 k0 }' h6 X
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)  N* y, T. G" Y1 ~( r( `

" S% H& N) n1 c$ l$ L  {</lable><br/>" u, O7 v4 m! u( M& ~5 c1 X/ z" G; V
<input type='text' name='item_element'/><br/>
3 z* L! e$ V$ R3 w6 a" e$ J$ _; w<lable>Element Upgrade Amount</lable><br/>
& S& D* f" E+ P/ y; ^; x<input type='text' name='element_upgrade'/><br/>5 z/ |. A! C' b4 t; P1 J
<lable>Pierced Amount</lable><br/>0 I) x( n8 H3 B
<input type='text' name='item_pierce'/><br/>
& H. L2 e$ `, |+ y<input type='submit'/>
, Q) j( e$ t4 e2 N9 u</form>";7 F7 F2 A9 H5 g3 Q3 \! U4 m/ |
}; _( ~+ ?2 E1 C$ @: `) O
3 A* |( y' R. U3 T7 |! W: `$ i/ _
function PostListener (){+ `- G0 P6 T& W4 F( c! l3 n, z
//Add more post variables if needed and add them to initform() function aswell
. N: x$ @% x) ?5 u1 @1 Q6 @7 _0 p/ {4 l; |8 v4 i& Y9 V
################################
2 x' Z! Q2 r3 p: D9 y$ G* N4 J##### Connection and Post ######7 H( y+ K( B1 K
################################
; {, H3 w/ _; q$ P/ c: ?$name = @$_POST['char'];
. h, v8 v& c: Q* G3 ~; B' h$ItemName = @$_POST['item_name'];
- ]3 T6 m- O  e" u9 N4 p, F$ItemAmount = @$_POST['item_amount'];  V/ W/ Y9 F0 [3 L4 h* j& F9 v; j
$ItemId = @$_POST['item_id'];
  I" q2 I) u( ^' r3 Z$ItemUpgrade = @$_POST['item_upgrade'];
5 E0 [) q6 x$ g' z$ItemElement = @$_POST['item_element'];
7 q% [6 T' y' r6 b$ {7 e) G# ^2 m$ElementUpgrade = @$_POST['element_upgrade'];
+ T+ C/ Z5 Q4 D$ z$ItemPierce = @$_POST['item_pierce'];
2 L' i. ^; F% n9 ^* j################################: r( R. L9 I8 @7 L/ l
) ^; g/ o4 y- I% v  B. E: r5 O
//Check both variables for empty value4 R2 y6 z, u1 }$ G7 C- Q

: |  c& X3 y6 d$ e" j" \2 Wif (!empty($_POST['char'])){
0 t0 E: ]; C" I: l- _# R0 C$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where % i6 m# G6 w" R7 h4 [

  S* h+ \* X9 l8 }) f3 k' C+ y9 D' Xm_szName = '{$name}'");& W/ M7 c* }  |% X5 G
while ($row = mssql_fetch_object($find)){6 Z; @" f& m$ D
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";5 t4 e% i5 j: C1 w* i, O  x7 T
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
0 T! Z- l# ~+ {  ?- A; \2 J4 @; N) S# c; D, n4 A9 b2 g# v
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
' d& H+ |" y# c& p, x6 e9 C& A/ ?/ [5 ]0 a" s
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
. @8 c7 `! y$ ~1 [+ Q8 U
% F; Y* {% p" [( G5 ^7 @N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
5 E' i5 c0 A5 J$ ^& m0 i
, v( \; E) Q; J; w'{$ElementUpgrade}', '{$ItemPierce}');");
' h( F+ c6 t% ^( }/ I}
# T6 Z9 R8 K, _. y# f$ W, X9 B& j6 _: G% K
}
7 f) f) Y( G0 W
  I: ]- L- Z2 m/ F}" p2 o- L6 o+ u3 e9 `1 P: f

1 e1 W, B0 w0 l" Y% Z$InitForm = InitForm();9 N2 H4 x# T9 Q* [% d" f  y  X7 \: I2 e# H7 J
$Listener = PostListener();
; E2 J% f% c4 W/ E3 h: `
* b$ U$ V* a( K- K- b/ t& P?>' j7 S% g  O3 T- ~

( f" N  H5 O, J2 O' O* ]) ^4 w
% r' o! ?; F) ]0 D' g& p0 ^
: ~; t0 U: h) |6 k  b8 l, H  d; C: n' T
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-6 23:42 , Processed in 0.061693 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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