飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php' x9 q$ O9 i8 m7 G  p2 `# i
function Connect () {0 I+ p" A% ?* X4 U5 c, }
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
/ r7 _4 i4 |' I( {4 J. @" j2 g4 A% m% d/ |* T* r
Failed.');& Y9 w) H  N& L1 u; e% v
}3 P. I4 p4 K" [; ]2 y
Connect();- }$ A  W. @7 _4 r
" X" K, I$ d% v- D
function InitForm(){
* B( L$ e% d: i//layout for the form
$ E6 u+ Z, f2 D% ^+ U  v. Gecho "<strong>Send Items.</strong>
. {: P- X8 p4 [' w. u  F( l<form name='select' method='post'>
' Z+ v% W4 i# r<lable>Character Name</lable><br/>/ j; O; N: ]+ D: V% T
<input type='text' name='char'/><br/>
$ Q4 E1 H4 x/ s/ k  o) Q* A0 ^: T<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>6 N) y# O% O5 t7 `
<input type='text' name='item_name'/><br/>
$ X* a! i' Q! `6 F5 t<lable>Item Amount</lable><br/>
; _3 p: H9 M) F" T<input type='text' name='item_amount'/><br/>( r0 R' \3 D  X5 N. t$ a3 w- Z5 M
<lable>Item Upgrade Amount</lable><br/>9 T% E/ _1 a5 f/ b2 L
<input type='text' name='item_upgrade'/><br/>" s/ W) T9 J' y6 f2 E7 _* G
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
- t, ^, a) o/ _: a' E$ J2 B- i9 ^! g+ e4 ?
</lable><br/>
1 i, A" k  H6 f% Y" ?4 V<input type='text' name='item_element'/><br/>
: W3 `+ Y" s( @+ H$ y- S' @<lable>Element Upgrade Amount</lable><br/>
+ c% ?7 a2 F& B( R<input type='text' name='element_upgrade'/><br/>% `2 s( j& m$ W/ l) |
<lable>Pierced Amount</lable><br/>
) }2 p$ ?' H- W9 s" V<input type='text' name='item_pierce'/><br/>
7 O& c6 p. W8 c( o<input type='submit'/>
+ Q" ^5 K) r. @0 W6 L& a</form>";
# b, u, I+ C6 B  j; r0 t}
( b# y1 k+ n  I. C
7 x& q3 @/ O" r0 Z) x. G" {function PostListener (){
; l3 F  {# K- ?3 h  O/ R, s( {//Add more post variables if needed and add them to initform() function aswell
! J4 U6 ~8 r# n+ c9 m+ ]7 W2 D1 [3 N' e9 L! g" X) T0 N9 T
################################
1 k: \7 R( v$ E- `# u$ n; u* C##### Connection and Post ######- X6 X$ ~' r' D" S( ^" ]
################################0 Y; Z; S, u% k6 R) f. I& Q2 ~* J
$name = @$_POST['char'];
. ?9 _3 ~# t. d+ |5 x, C$ItemName = @$_POST['item_name'];
  v! V* `3 _2 {! g$ItemAmount = @$_POST['item_amount'];5 R* }- J( E2 o/ d
$ItemId = @$_POST['item_id'];( y5 Q1 E( z5 ^3 X
$ItemUpgrade = @$_POST['item_upgrade'];" ]3 g: l0 L( M; R9 v4 b% ]) b
$ItemElement = @$_POST['item_element'];0 ]9 h& k+ D+ u6 }# J- f# o' Z0 l2 ^
$ElementUpgrade = @$_POST['element_upgrade'];
" Y/ t: G- C, X4 ^: T7 r; U/ Q9 X$ItemPierce = @$_POST['item_pierce'];: ]8 s3 E" {: q4 x# f7 i3 n4 A
################################
& H  _) l7 R3 Y- I/ ?/ p* o; }; B& _/ r. z2 [5 p# L+ m, C  Z$ j
//Check both variables for empty value
  J$ J8 k9 k( w5 O9 U2 c
1 O: ~5 Q4 \" }! T4 L3 [if (!empty($_POST['char'])){
, j+ R0 ]% s1 w3 A9 T& u$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where + X6 B: Q0 L7 J+ Q. P

0 @0 D% ^- l& I4 z/ ~. |: }8 H8 h( Tm_szName = '{$name}'");
6 [$ T. Q9 n# Gwhile ($row = mssql_fetch_object($find)){
$ t) f) G. L. Aecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";0 n' [2 s* O% n, ?. X
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
4 }2 |6 \1 M( i' i
7 i( ]% X: f. T[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
4 v' f' N8 t# u5 Y8 S
6 Z  x& y, k" v6 |0 b7 O# a[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
. \6 E& V5 z# u* G- w
: Z' H- t7 X1 H; Y0 \2 iN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', . a/ L8 T/ y0 I9 ]' ~

$ E& c2 j; g& N'{$ElementUpgrade}', '{$ItemPierce}');");! s* _( s/ M% @9 D* x5 J% R* \& g
}
/ z/ ]0 C0 p& @) A, P
1 u: p# M! U* c5 k: a. K}
; m" O. Q/ H& @4 p
, P$ P8 Z" T. t' F2 G}
3 t  O7 a1 b" [3 j: ~# V% {$ |. {5 f: Q+ k
$InitForm = InitForm();
5 ~0 h2 m$ x3 |: `# M6 A8 O$Listener = PostListener();
4 f" A0 {6 B* |
# N! H3 f4 U5 {7 a+ y: p?>
4 q. P" U8 z. d% v: a. @# m  D& _; Z' S' @+ d6 v
5 J% W0 g' G1 t1 J" y& o' x
1 a' p7 b( r  V* @

" f' n; C  N$ K5 M, t
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-22 09:53 , Processed in 0.065885 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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