飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php5 f" O  k4 t1 q
function Connect () {8 a1 I9 H7 ^5 M* m8 `
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB , d/ Z% h% F# N6 C* V" i

* m8 _9 Y/ I% E( Y1 B4 t& w8 hFailed.');# D- n8 k& I2 b/ Z( {
}
# I$ r, U) |  t8 q9 @Connect();
5 R: ?( M4 A- X. U4 X% V) |, }% I9 ^5 X
function InitForm(){! y8 j- q: N9 I
//layout for the form6 x2 s/ s% ~5 I& i& Y3 J7 T
echo "<strong>Send Items.</strong>* [* p& d, I' h; f6 `1 P6 [+ D
<form name='select' method='post'>9 s( M, E- j, E) G- }/ k
<lable>Character Name</lable><br/>0 N2 v# [5 |$ z0 P! h; W
<input type='text' name='char'/><br/>& D- P; b# ]( N: j
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
+ G" n9 r" X; i6 R1 [. ?  Y<input type='text' name='item_name'/><br/>
. t* d+ t" w  E: I6 ]7 c5 a<lable>Item Amount</lable><br/>- q8 x# U  ?) d; v" v; p
<input type='text' name='item_amount'/><br/>  g0 J: s6 {; ?. P0 p# R+ v. m+ s9 q
<lable>Item Upgrade Amount</lable><br/>0 U% c0 g0 T' b" y/ \3 {* _2 w5 _
<input type='text' name='item_upgrade'/><br/>
9 N. X4 e  f& p: j<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
+ m4 n3 G7 Z+ s6 E, g0 Z
% `$ q" T: f! e) c. v! Q</lable><br/>
( H+ f' ]% U! W/ w6 S<input type='text' name='item_element'/><br/>
  b% @8 J# ?% X4 Y2 }<lable>Element Upgrade Amount</lable><br/>
; U: Y. n4 ]- m$ }: }<input type='text' name='element_upgrade'/><br/>
' N' n! N6 I" e+ L3 f) J<lable>Pierced Amount</lable><br/>8 [6 F6 `) l' l; `
<input type='text' name='item_pierce'/><br/>
* Q' O/ Y6 m" S. k<input type='submit'/>
$ V/ f8 z. N% ^5 n% L</form>";
5 j( j! U/ t  N# d( Y' n9 y}
% G" v  F) S8 d; V$ F! [) ~
4 ]7 q) h, M5 }& _+ \# c) Q2 D) Efunction PostListener (){
  r0 K9 n7 f# p//Add more post variables if needed and add them to initform() function aswell1 g/ f2 ]  ?! ?, Q
6 t1 _2 [- ^/ ]. S/ o) r
################################) ]+ I  }2 g% c+ O6 m! v+ K
##### Connection and Post ######; G# h$ V- B0 s# z8 p4 K8 q
################################
+ V' {! G' F9 U* @: l$name = @$_POST['char'];
" y/ ]* q( K3 m; z0 D9 n5 ]  G$ItemName = @$_POST['item_name'];9 z3 {+ f+ G9 g9 j" [/ F
$ItemAmount = @$_POST['item_amount'];' `0 k% L& J1 g  P% T2 O/ C$ L
$ItemId = @$_POST['item_id'];
4 `! J8 x( l, X$ItemUpgrade = @$_POST['item_upgrade'];5 s( i# a0 N* _- v0 t  a
$ItemElement = @$_POST['item_element'];8 _5 K3 z, y- l6 k
$ElementUpgrade = @$_POST['element_upgrade'];& k& x; h; ~9 p$ L6 D5 \
$ItemPierce = @$_POST['item_pierce'];
$ L( _; r4 F4 Z8 V################################
! I0 X* W" b6 o3 S. G$ T
* A2 t' o6 \, g* @5 [2 h//Check both variables for empty value% \8 I4 I8 @9 Y
& S% p! @) r7 B2 v5 P, c1 E
if (!empty($_POST['char'])){& Q( B! z) x4 R- u% o
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
- V+ D8 o9 T# Z& M. p, Z& ]3 h8 M% d& [3 X* A
m_szName = '{$name}'");) C1 }9 j* x* ]) O$ a, x+ t: B  N
while ($row = mssql_fetch_object($find)){: c& |3 F! y/ f' ?3 q
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
$ r' K- i$ F" p( H  }$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], / |5 J  N( \+ y; n; ?

9 K9 f+ e: P  t0 q1 S[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
$ [& n, {% {: ~3 \# Y& l& V2 z, h! d3 u8 M  Y
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 9 D7 D5 D6 F6 f4 U0 Y) {9 ~1 h1 d
) U* H/ D' d! ^- N. B4 ]+ H
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
5 |1 z& J! d3 `: F) C
" B6 ~' }3 Y3 Q, w) U'{$ElementUpgrade}', '{$ItemPierce}');");' b6 V4 b2 Z0 T% s
}
8 Q" L' v" }1 S' Y# X
1 a  ^/ x6 E) V/ |" Y}0 @; n4 C/ n% d& L
. m, e+ k# ]9 G: f8 l
}) Y) _6 S% `( {
* l3 Y1 n( D5 o. i' {9 c
$InitForm = InitForm();9 A. o9 v0 D3 \) N4 {7 h
$Listener = PostListener();4 `2 t) `' _  c

9 C0 E* P* S0 W, {?>
7 q' O. U; ~* ?# j
7 g3 b; a% Q" p" x7 b. {
" r; D) u$ X9 E" v1 U, p" E! N& F/ O  e' l3 i6 q
* o  x+ b1 R% J
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-17 00:02 , Processed in 0.110188 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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