飞飞世界论坛

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

物品发送脚本

[复制链接]

200

主题

203

帖子

984

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
984
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
; Q- ~! N: y5 p& S1 Dfunction Connect () {
8 _2 [  c* i8 n* S% u0 mmssql_connect('Server','UserName','Password') or die('Error: Connection to DB
) J0 f! B+ g2 `! o8 Z' {! ^: r- x. @$ ], ~0 w: N/ x0 M' ?
Failed.');& w( A, y& v- \6 }2 N9 v" k
}
5 J$ h6 l% B' SConnect();
) k; \3 H, c  }8 d) |/ s' H0 ^& e- `1 j( o0 w% b
function InitForm(){" S0 ?* I7 ~0 P
//layout for the form& `  ~6 [9 I1 N: M7 _# Q- H2 Q
echo "<strong>Send Items.</strong>
; r  L# T) y- Y<form name='select' method='post'>! g5 `5 V0 y4 H9 X) c
<lable>Character Name</lable><br/>
% i" f" J% g7 d; Z9 F' N5 }' `- H<input type='text' name='char'/><br/>; f6 I: V) N: G8 ?
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
+ w# V; k# v2 e$ N8 g8 @# E: x- J; V* ^<input type='text' name='item_name'/><br/>. U4 ]& I, }3 h2 E, p" }
<lable>Item Amount</lable><br/>
; }& S3 T8 k' S0 j4 ?8 l<input type='text' name='item_amount'/><br/>! j& q  U  n# [% \4 @% T5 ]% K
<lable>Item Upgrade Amount</lable><br/>
, E% q# l" ^% |' D6 Q3 _9 `! U<input type='text' name='item_upgrade'/><br/>
# k5 _3 N( ?- F<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)6 w2 g, m/ p5 z2 L9 d
; }$ B7 k  Y! t6 L. j  \
</lable><br/>" s3 \( G, u& d4 v. x0 D
<input type='text' name='item_element'/><br/>5 u( f: A2 X/ g, Y, v2 N; x
<lable>Element Upgrade Amount</lable><br/>
( S& Y6 i. h5 a3 o4 t1 r<input type='text' name='element_upgrade'/><br/>
% ^0 {' r. n6 p2 w( |( Y$ b0 T<lable>Pierced Amount</lable><br/>
  G4 r1 f, G3 D<input type='text' name='item_pierce'/><br/>8 e4 ?9 A! N& t" z
<input type='submit'/>
% O$ [0 M7 n9 J" o$ n</form>";
& r, R1 P% C0 n7 R! z5 e}
- [! R+ ]1 }. y* j% Y6 J( }* p/ w, g
# Q, k: c( Q( `* r1 b) b  M; ufunction PostListener (){
& G) c4 m* p$ X7 n5 h5 e0 ~//Add more post variables if needed and add them to initform() function aswell
# _2 x( a: I# r: E
' U6 o2 ^1 Q  c1 J- z' ~################################. D/ ^% z- `3 L8 Z
##### Connection and Post ######
5 @: X: Z5 ^, c1 v- ?################################; R% q, s8 ], B) e
$name = @$_POST['char'];+ C' v% H  o: ^7 e* w
$ItemName = @$_POST['item_name'];
; n% s: B) D- q& p* V$ItemAmount = @$_POST['item_amount'];$ a0 Z& V) L6 N) _
$ItemId = @$_POST['item_id'];$ s0 `& \! V; {: v. K( E/ `8 }* V
$ItemUpgrade = @$_POST['item_upgrade'];; h$ s/ ^& ]8 [+ v* ?
$ItemElement = @$_POST['item_element'];
- o8 G" X$ R8 i2 I6 W) Z  R$ElementUpgrade = @$_POST['element_upgrade'];  t3 \$ z; L, o
$ItemPierce = @$_POST['item_pierce'];
# \; S. V$ i3 T! \6 B################################
! c) T: b8 F4 c, @% H  Y. v
; R3 @- ^: `; e/ f* e0 v6 t$ K# H//Check both variables for empty value6 |* l, ~5 |1 s5 Y2 f9 v! ^

4 g& D7 Z, F' _, Uif (!empty($_POST['char'])){
7 ~0 L% b) E+ t/ U: [$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
) z2 e! }( B) h! r7 T: D* e2 I* q; ^: `
m_szName = '{$name}'");
4 K! T. ~% d! Q, u( l% J+ Y# {while ($row = mssql_fetch_object($find)){
/ J& V0 l- y& O/ r# s: Recho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";0 U& s$ J! w# j) f) k' z
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], ) P) S  T: u* I
9 F4 T& [* |; g# X
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
4 x' x9 p* N9 U# a
  z! {: N3 ?: T+ ]* i3 w1 d[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 7 l' ~9 F" S" ?! U, }! |' j

& M' J5 \$ c8 u0 g/ ON'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
+ \( E3 n. M! q, u% a
2 h2 t% e" [' D! m. K'{$ElementUpgrade}', '{$ItemPierce}');");
- X( v# P4 y7 P" @0 B7 B/ u+ r}* C) L7 e" r# L% j1 U4 P

( G  y8 M  g6 S$ x' ]4 T8 I8 h}& \- y: o3 S( f! _" \/ _
/ H: z7 |' o9 e% P- l' Z# R' E
}
* M% r: Q- ^" S$ a' \: p
! s$ \4 u$ X- ?& z, J$InitForm = InitForm();& `0 }6 y9 q2 ]$ P* P9 B2 ^' z  z
$Listener = PostListener();( |* p7 a2 a) d

8 I+ w5 w$ {7 o6 X' v( q+ i: V+ x?>
. \5 n& i! |; y0 o6 K2 }
, O& U  G' k) n8 C4 ?4 u7 P1 u* y4 N& c: n7 r/ R

8 D& j: [8 l1 t: u2 U
, b; N& W) v( ~; n( V- o" l0 V
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-5-5 21:19 , Processed in 0.057463 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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