飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1088

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1088
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
<?php4 X, J" o6 H5 P' }: _+ p
function Connect () {7 R' Z+ C5 v- q* X9 o
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
* g- X# S* g4 S7 S8 }7 \9 ?
3 m# U* F; Q+ a) e; r$ q; pFailed.');
$ g* ~& f2 L" K. P0 ~$ [* F}
/ m" N4 j- f* e/ \& F9 ZConnect();
! k- k4 B) y" J* F" K1 h0 k8 {* O' Q) @* L
function InitForm(){
1 C% n" K$ L9 i3 p//layout for the form9 h1 q, t, D, |2 b8 V; C
echo "<strong>Send Items.</strong>
$ Z1 f9 v) p5 t) E<form name='select' method='post'>
2 g* C7 O0 U) E  m, y<lable>Character Name</lable><br/>! i. j# h% \( Q/ a
<input type='text' name='char'/><br/>- x! f! ^7 ~5 O
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
% t6 H; O8 Q& u6 X3 _1 P2 f<input type='text' name='item_name'/><br/>
0 N" D' @5 ?+ Z0 m  [. {) y9 R# R<lable>Item Amount</lable><br/>
& u" `( j) f/ g5 h2 Q( C* G" }<input type='text' name='item_amount'/><br/>
9 H" Q, s3 ^0 d<lable>Item Upgrade Amount</lable><br/>* g! p% ^7 \: V+ z; ?
<input type='text' name='item_upgrade'/><br/>, R# @' D, a  ]
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
8 _& U& v) Y0 E- u2 A7 k, w. F" R
! B, N! I0 `4 e- z, n' Q% L" k, A</lable><br/>
$ w. d5 \  M& a. `( w<input type='text' name='item_element'/><br/>, ~' a  r4 @7 G% O. i' m, e
<lable>Element Upgrade Amount</lable><br/>
$ W  S( K! _! a5 ]3 [7 @<input type='text' name='element_upgrade'/><br/>9 f6 G) a+ @$ @% B/ R
<lable>Pierced Amount</lable><br/>
' T) Z) |' w5 D3 J& j( s- O$ e<input type='text' name='item_pierce'/><br/>
$ p  a0 Q5 i- ^$ R* ]- P; `<input type='submit'/>1 y9 f- c. z0 G# w6 j
</form>";
/ q4 P7 w2 A) u# e9 s+ ~  ^}; c% N3 d+ G4 I
6 ^* c- ]) |3 V6 D5 c' A
function PostListener (){% v! n5 c& o* R' f
//Add more post variables if needed and add them to initform() function aswell, K1 r4 l$ f, |: y  `, i8 h

* B5 |4 u, s: ]: e, V! N################################1 j+ q% b0 X5 s' o8 o' u- L
##### Connection and Post ######3 z' m; |" `! e3 E  ?) ?
################################
; U: q' |% A; G4 l2 x$ r$name = @$_POST['char'];
& k3 j) H* o7 i, V4 z+ r$ItemName = @$_POST['item_name'];
8 y% i/ ]' v" w$ItemAmount = @$_POST['item_amount'];2 B; |* ~" ]  N3 U$ H) n# e5 U
$ItemId = @$_POST['item_id'];
  G$ L+ D/ i* Q* \8 ~$ItemUpgrade = @$_POST['item_upgrade'];/ }  e1 O! W9 I+ r; I8 S3 _* I
$ItemElement = @$_POST['item_element'];
5 Y; b" B' m  \" M$ElementUpgrade = @$_POST['element_upgrade'];( V( }% _% C8 n, X
$ItemPierce = @$_POST['item_pierce'];) a: _0 e* L* s  O1 X
################################
5 c/ \) ?; b- ?& R" M2 @1 Y# ?+ q! f
//Check both variables for empty value" [+ s. l& t$ y

4 i! H' ^2 O0 S, M% Kif (!empty($_POST['char'])){
0 L( z: X' y2 \! N) ]% g! P0 C$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where - c3 g' n- z$ {& O% t# Z8 j0 O) n) X
% @3 Z* V3 \: k9 E9 X
m_szName = '{$name}'");
5 g) a  \4 B) T' kwhile ($row = mssql_fetch_object($find)){
- e- t9 E! y7 U2 U5 k* Eecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";2 \% z' f. y& e+ t% E' }) G
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
4 b6 L! Z8 c7 [9 ]9 z! K! G' [1 Q' v. A
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], ) j; x1 @+ r( ~+ |* s- K! i
  D2 U, s. |% r+ o) m/ p
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
. R' |( E# J, q& a/ s* A) U& |* ?: a5 X$ b/ _
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',   o( U, d6 ~! r0 o" t

6 J$ T: c+ j/ w1 d( @) Z" p4 G'{$ElementUpgrade}', '{$ItemPierce}');");
9 v. L" N0 i! t+ z8 U; m% T}
5 V' a1 \( y2 f3 c3 v" C; r4 H& N; r4 O
}% n" b6 i8 B0 S. O

- p) n; V! Y5 j4 ^8 V- p}
, d4 u# q, v0 d: D, L) P: g* S8 ]6 }  E: j
$InitForm = InitForm();
7 i/ w+ C2 [( i+ {( P" \2 l9 K$Listener = PostListener();# d3 u* k: g$ r% d: _$ M- t+ |/ z

1 l3 D2 f0 b1 V; M4 F# ~?>- v2 j5 x" V2 m4 ~$ d& T! n
; ~( A7 u5 J: G& Y
9 y5 T( U& m3 f; {! j/ b9 y
8 X. B& j- N- w8 X3 Y" h0 S( _7 x

; A0 k7 j! p6 V$ k
回复

使用道具 举报

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

本版积分规则

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

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

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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