飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php3 C5 d, D0 c5 H9 m+ f7 h7 t
function Connect () {
+ {4 K9 C4 E% f; amssql_connect('Server','UserName','Password') or die('Error: Connection to DB
8 c3 z8 a8 k# a7 F4 i
4 q( |$ X' G/ p  P) ^" \$ rFailed.');+ ]/ w' J& r3 k$ E% R
}
8 D  k0 P" s% fConnect();
* j) M! j& n5 v& n9 Q9 C; W( n* L. A' ]7 d
function InitForm(){9 m6 R" Y' I- R" I0 i
//layout for the form
0 \) O# Y2 }0 I3 B. A& d, Secho "<strong>Send Items.</strong>
: u0 `4 H- k1 O; e, S1 V' A7 \3 E7 i, C<form name='select' method='post'>& Y' p' @3 {5 Z% t
<lable>Character Name</lable><br/>
  ]+ ]  x: d( E$ }* v/ L<input type='text' name='char'/><br/>
1 [: @, S6 B6 n$ x5 t<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>4 |. |* @# t" q$ Y3 [
<input type='text' name='item_name'/><br/>  R- \4 I/ x0 D1 ~/ p
<lable>Item Amount</lable><br/>" _* v% M) N9 _! R" p
<input type='text' name='item_amount'/><br/>- q% c. \7 x) j8 X4 b7 ]+ k
<lable>Item Upgrade Amount</lable><br/>/ ?( L6 I$ D; o
<input type='text' name='item_upgrade'/><br/>8 F" R2 E4 j7 H8 U( N( x
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)1 I0 H  S2 B: g5 C
, h+ [* i) L! Z8 c) n+ s0 H
</lable><br/>$ N3 q1 X& m- e* I  V7 d
<input type='text' name='item_element'/><br/>
" d1 v. w6 S# [2 M$ F<lable>Element Upgrade Amount</lable><br/>
- y( ~* i) ]1 |<input type='text' name='element_upgrade'/><br/>) g* ]$ Q$ c. {1 e
<lable>Pierced Amount</lable><br/>0 ~" u7 B( L5 E* V( ]
<input type='text' name='item_pierce'/><br/>) x$ G2 m/ W' O, M( E- S" s
<input type='submit'/>7 V! a2 _! }" H) C" V
</form>";0 E4 `, c. t7 D
}
& F: I' ?; V7 d" ^+ [; w7 Y7 F  R9 v6 R& J
function PostListener (){
. k) }% I6 z1 _# Y0 I/ F- m//Add more post variables if needed and add them to initform() function aswell
2 a3 v& @8 x- I) w: b, B9 m& q7 g$ p8 T) {7 [
################################9 r( {3 D' e  ?' ?! L
##### Connection and Post ######
  |  `; T) U4 Q% i################################
4 B1 X5 X- u% e1 e$ ~$name = @$_POST['char'];$ m8 W# x# c# h3 X+ c8 e
$ItemName = @$_POST['item_name'];- I4 _2 y# ?- O: z8 u/ t
$ItemAmount = @$_POST['item_amount'];+ D7 z4 m  a/ W) A
$ItemId = @$_POST['item_id'];+ p$ E- s1 q. X, @
$ItemUpgrade = @$_POST['item_upgrade'];, W5 g4 @1 t0 \' l0 f* C' }" z6 \4 [
$ItemElement = @$_POST['item_element'];/ H7 U% S0 p" j' W% e; P: _% t7 K
$ElementUpgrade = @$_POST['element_upgrade'];
& D& y% @8 m8 ?, _! D/ K3 a3 }/ z$ItemPierce = @$_POST['item_pierce'];; N' d- L! V6 G5 V: v% Z$ v
################################" s" N! r4 |! D% ?3 t

& w/ o% x  u. a$ P8 e. [//Check both variables for empty value! B, f4 w6 K7 _9 Q  n8 H) H. \

5 V' H7 f+ [7 b6 m- V& y( \if (!empty($_POST['char'])){
; n8 Z# {: X# S. @2 n: N5 B$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
  h4 s. o* }: j/ Y7 U) K6 ~3 u! P& A9 b# P7 M3 w! A
m_szName = '{$name}'");; t6 p1 F2 {2 S* U5 u* j
while ($row = mssql_fetch_object($find)){
1 a: E9 \  }- n  V# h3 l- r" ]echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
! R. K: k! ?- b) \' k3 b# X* n$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
$ y3 {$ e2 W" q4 `
' u1 ?5 Q7 k3 ?7 y1 O8 d) h[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
3 y0 @* V7 l2 n3 P# O7 r& d: W0 y3 X6 i3 R/ s
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', ; B% f. G/ r$ F- X2 A1 E$ v9 N
$ ?1 u9 [% x) B) m# e% C9 b; k
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
7 {  D! U& ^. k; g1 }3 d. g. [+ b
& p" W5 }! N! @& v9 v. z! p. V5 X'{$ElementUpgrade}', '{$ItemPierce}');");
- W. C& X, H4 C9 E}4 p, V: t) p1 D9 B/ N8 j- s2 `

7 e% W2 J& l9 ^0 J1 L}
/ n- K: [4 d0 Q' O7 `3 Q( t8 ]+ l% j+ V6 D4 t
}
5 b  N3 T8 h3 q( _+ H) r5 G' R. a+ f/ F9 w& ?2 P, M; i: i4 Z
$InitForm = InitForm();4 p( H  g* ]( V, H& [( j
$Listener = PostListener();
0 |, v# K2 W/ `. T; ], Q+ a6 Q4 u% |
?>, t; ]4 p! f6 _3 [; ^8 }  i, q

" e  Q8 F4 Z' l" T! e0 S2 \' R# g6 M& G+ u+ @3 B+ {
7 g5 }& _4 X$ w: N% ?; z/ m/ J
: t$ f( d9 X6 S
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-22 20:36 , Processed in 0.058474 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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