飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
. Q% `) E; |# E1 c: u( F' ofunction Connect () {3 r' J; G2 t4 U7 E: Y' t
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
! J2 C! M- ]: M" K) W' u5 ?5 J" T+ j  D5 w& L) z% F) I
Failed.');( A. v3 ?/ Z4 Q7 N! p) W+ h$ z: Y; J
}
& _5 ~, H. X& w  ?4 \0 }Connect();$ `4 n- V! c& E( n. L( y

1 I! W. B) V# k% q# Lfunction InitForm(){+ p4 w" Y0 R6 y9 Z6 E/ o0 f
//layout for the form# i9 H# J  Y8 y. ^
echo "<strong>Send Items.</strong>
# Z: \4 f! a) W/ {<form name='select' method='post'>; t# o4 z1 e- c% t
<lable>Character Name</lable><br/>
, A5 m7 w  ]  @# @3 o: T9 H<input type='text' name='char'/><br/>" i7 r6 o6 L# B: c# b7 g
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
1 c- k+ }# ~5 k- p0 `0 I: }# m<input type='text' name='item_name'/><br/>/ S0 l; p% G. w& L
<lable>Item Amount</lable><br/>  B5 B9 b6 A. }) F- p
<input type='text' name='item_amount'/><br/>. j  |5 L: Q; X
<lable>Item Upgrade Amount</lable><br/>7 \( F6 V4 e+ J9 C2 Y$ k
<input type='text' name='item_upgrade'/><br/>
. |/ V6 k/ F2 p<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)% c. U; C5 Y5 c1 {0 Q. S/ C  R+ C
5 n& Q9 I. U. E$ n8 B/ S
</lable><br/>
* {3 h* y" \/ s) F' x<input type='text' name='item_element'/><br/>
: v5 H7 k: O' P$ R<lable>Element Upgrade Amount</lable><br/>
, _* A5 ~6 |: i0 s$ Z, `<input type='text' name='element_upgrade'/><br/>
9 a, b+ X4 Q- ~( ]& i' u6 |3 h<lable>Pierced Amount</lable><br/>  O# X# H* U9 }% D
<input type='text' name='item_pierce'/><br/>; y, W* }) {' s& G
<input type='submit'/>, M# |+ o3 A7 y$ q) t
</form>";9 g' F9 E! S7 @. `1 m7 s, S7 q$ E
}
9 `/ Z1 q4 @  q: f! N3 I1 S$ ^0 l  Y4 ^  k+ ^; Y
function PostListener (){
# n$ W$ K7 I9 O1 K9 o//Add more post variables if needed and add them to initform() function aswell
  e- W1 b# L' b6 x- {8 K  `. h; Q& A/ c8 Z) Y  u
################################& d( \: W9 Z+ a8 D0 I8 s) Y1 F
##### Connection and Post ######& w% F& l% z( w) G. E  z: o
################################
3 o" X4 V% ~' e, M% X  x$name = @$_POST['char'];
, s3 i1 `, Q5 i( G5 K6 A$ItemName = @$_POST['item_name'];: P- p' h* e6 p1 Y( W6 O  L
$ItemAmount = @$_POST['item_amount'];% f) o7 `6 I. K' h( W9 ]7 Z
$ItemId = @$_POST['item_id'];$ R2 U) o8 R1 j& T2 {, k
$ItemUpgrade = @$_POST['item_upgrade'];
8 g7 Q  X, s* Y+ L$ItemElement = @$_POST['item_element'];
  K/ e2 h; J9 W) x+ l, i9 }$ElementUpgrade = @$_POST['element_upgrade'];
9 ]* D2 O# G. Q1 U7 z+ W$ItemPierce = @$_POST['item_pierce'];
3 R7 V- z% {% a3 e################################, s" p4 A& K: {+ \9 V2 U

/ ^4 H9 _% \4 o4 p+ f//Check both variables for empty value7 {$ b- R4 X8 z

; h- G/ n7 D2 fif (!empty($_POST['char'])){1 Y0 r% \% l& C7 ^$ d5 x4 P/ S
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where . J) a+ s4 ?/ a; f. F
  y. X: b' i9 R& }; F& I; f
m_szName = '{$name}'");
+ ]9 F: X, R2 ^7 X3 M1 y& twhile ($row = mssql_fetch_object($find)){1 O) E2 w$ g8 M# L! K; m" Z# t4 D4 k
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";2 j: E! N1 O5 t9 |% @( x0 t: A  P
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
+ l  Q4 {. ^, E3 W3 N. U, B6 U/ z2 w/ A/ y
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], ! R  D9 S* B) }3 D0 g, F0 @
8 b. C& T( P7 _2 l8 v  `
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
. _5 U5 L8 \  \) e' y5 a+ C# |
( L. v' w" w, \6 R( N" mN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', % ]& V' D6 n) Z: s
! U* K6 g5 j9 r9 {- g
'{$ElementUpgrade}', '{$ItemPierce}');");
* x  O& n+ Y# d$ E; e1 {}: u! c+ d; c, O* {
3 k1 O5 U& E$ a9 w# I4 C5 E
}
6 u3 a+ W- J7 R3 o; P6 O- R
( r3 D; v! d  }: x- x/ j}, Q! d4 X; Z8 S! ?
" A6 v/ q6 S" u1 F9 e; r
$InitForm = InitForm();
, R8 h' f6 J) h5 u% r7 Z2 E$Listener = PostListener();8 g% n/ ]4 `! Q; h, f; j0 L- g; M/ T
' v4 L# D1 m& ~: `  x
?>: h3 x3 Q# v5 I6 _

9 f( Z. Y8 z* |. M# V' _; N
: G' Q+ e9 w% U' ]" W7 B) Z# Z! [
1 d4 v5 J4 k- @& t. a
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-4 04:35 , Processed in 0.064264 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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