飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
( ~* ^" ?  x: G- @) Q5 }/ ufunction Connect () {% I6 F/ m/ R5 d4 t( b9 H% B3 ?' }
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB 1 _/ w4 `, L# i  J% j% b( }) j3 S8 N' E1 a
- R! `% S+ ^9 H
Failed.');
' G; Y" R4 M( E# H% h) Z0 w}9 U$ j7 S! ^6 ^; ~  W
Connect();* ~+ I2 g' m0 ?* f& |
+ U( B. C/ {8 d5 ^8 r! x! d
function InitForm(){
* T* G) F+ A4 w8 m5 Q& [# Q4 w//layout for the form
/ z- c! C& O. \, gecho "<strong>Send Items.</strong>0 b  {  A; B7 Z# W5 s
<form name='select' method='post'>9 w) T4 A" h) o% P- t& f. T) H3 H& \
<lable>Character Name</lable><br/>
+ E. i9 k* j: T2 a<input type='text' name='char'/><br/>
0 b# a7 `  l# `5 v<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>/ H# F6 q7 q0 j- x0 ~
<input type='text' name='item_name'/><br/>% a* T8 i0 U' V: L. J
<lable>Item Amount</lable><br/>- {: R# t5 W  [. e$ {( g
<input type='text' name='item_amount'/><br/>
$ i$ w6 ?; r2 N<lable>Item Upgrade Amount</lable><br/>2 y) Z- M, T; [2 Y
<input type='text' name='item_upgrade'/><br/>
9 A9 T2 b/ x# z! L, G) k$ E4 x1 d<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
6 u. Q1 s9 T8 m; V0 V  b' L0 L1 T0 S8 G5 d  [1 R0 N( E2 }
</lable><br/>
# l6 F: U0 `$ _+ |<input type='text' name='item_element'/><br/>1 n/ f; H, a: v, a1 s! H5 U
<lable>Element Upgrade Amount</lable><br/>
1 `% s/ v- J$ A/ e<input type='text' name='element_upgrade'/><br/>
8 o8 R$ x7 \- M& c: B/ T: N<lable>Pierced Amount</lable><br/>
7 F0 U/ U# C" ?7 y0 a<input type='text' name='item_pierce'/><br/>% U( x7 {* R  H: t7 v3 W( }
<input type='submit'/>8 C1 c7 T) r9 M1 Y& u* u7 l; _' u
</form>";
+ u! m  C: I) Z  w5 G9 D5 |; T; g; _}
7 C' X6 c  D" s) C% e' n3 {/ D0 U2 D8 O; h
function PostListener (){) G: X9 ]1 K' w2 V( ?
//Add more post variables if needed and add them to initform() function aswell
/ b. H& Y7 r* W7 G9 R3 p% D$ j% ~0 a1 X/ I7 u+ f
################################
/ B3 t1 q! U" ^##### Connection and Post ######  w2 ^, x7 x: t7 P: Z
################################/ I! Z) g% R$ ?  `, p/ {
$name = @$_POST['char'];
& ]) G" D/ a- H8 f8 u4 l$ItemName = @$_POST['item_name'];9 ?" ?, b( s* Z8 J/ }
$ItemAmount = @$_POST['item_amount'];( H* V+ t+ W" _. S0 E" D, T  a
$ItemId = @$_POST['item_id'];+ ~3 \3 R: E/ I7 y0 {% j8 I8 j
$ItemUpgrade = @$_POST['item_upgrade'];7 p( ~- ?, p% c& S6 O
$ItemElement = @$_POST['item_element'];0 \7 D' E* r! Q- f& P
$ElementUpgrade = @$_POST['element_upgrade'];( ]+ v. ]" P( z9 |3 Q
$ItemPierce = @$_POST['item_pierce'];! V- h( w7 A* [1 w; K& {
################################+ z, L5 F! d+ j9 u
7 E1 `/ A+ H3 P# o0 L
//Check both variables for empty value* j3 q7 T7 ^; ]: r- H7 q& v
+ `& J0 v; J) v% |1 ]) A, ~
if (!empty($_POST['char'])){
. p! C: o) ~" w. ?) m$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where   A8 U$ K$ ^: S  e) i
: L9 v, x7 p6 A+ D, |1 O
m_szName = '{$name}'");
& t* F) E( Y$ Q) {* jwhile ($row = mssql_fetch_object($find)){+ a; Y# Z" g$ ?/ @* F
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";# E7 @  Q1 c6 T3 L* x8 S7 {
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 8 x: u" h$ T, n  ~" A2 _  x

3 @5 \. \* j% k% L[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], ! }9 @  t6 @& E/ ~6 X# X9 r- r- \
2 y4 E& I& ~; G6 m/ E2 {
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 4 f* \8 ]8 V+ q3 d

/ `$ b; ]" s1 S/ eN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
* E& m1 C' y( n/ H
  s2 O) j' }$ j2 [( l* z'{$ElementUpgrade}', '{$ItemPierce}');");7 W) G  [( X9 ~* F2 f7 B$ t3 ~
}! a8 u4 T+ J$ a. [% `* ^
. Q9 z  R9 n+ b3 h: w8 a
}! I# w" k0 b! F
0 r- E8 \2 p; O& n* a& Z- ]
}
  b9 O  `" g' _& s3 U/ l5 x0 S9 N/ B3 y% w. O. B3 P. K- X) Z
$InitForm = InitForm();
% i, D  A5 l3 [- J# }1 l$Listener = PostListener();, \  H" b% `$ X6 b, [
& N7 R; ?+ U; a
?>
$ M* N, E6 u* I  ~3 N- l  [5 b: l3 G

: y  {! I1 m+ W3 P$ U) A
# e1 R0 Q1 }6 @/ L3 k, t3 |; h1 a6 k6 o& U  i  @# A
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-20 14:17 , Processed in 0.066867 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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