飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1088

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1088
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php  W' ]$ F4 f, W/ g  E$ Y
function Connect () {
7 I# m, d9 B+ r# O" g1 m& Rmssql_connect('Server','UserName','Password') or die('Error: Connection to DB
) c7 ^& U" T; r0 P& ~+ j8 y3 v7 N5 K# g8 Q9 J
Failed.');
/ |: f6 U) s  ^4 N* Z}% c: s1 P9 I7 C$ y. T& @+ V5 [1 H
Connect();
1 ^0 e& F2 F3 X2 x( W
* q9 {: C: _1 p  C9 Lfunction InitForm(){4 `, I$ Z! M' J6 ^# F+ v2 {/ D
//layout for the form% l0 ~5 V. H  {% x* C
echo "<strong>Send Items.</strong>
  a# B. }5 |. L7 e1 L. }<form name='select' method='post'>7 t) H: ?* l" W. L3 C+ R8 q# P
<lable>Character Name</lable><br/>
7 h5 B- q* E. f3 ~- J8 B- T<input type='text' name='char'/><br/>7 e: G! K7 t/ L( c5 {4 u( K
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>: G8 G8 R, v/ j0 e7 e9 M  M
<input type='text' name='item_name'/><br/>+ D) `) h9 J* d4 p2 O
<lable>Item Amount</lable><br/>
& W1 s7 Y7 u4 p6 c1 @( P<input type='text' name='item_amount'/><br/>
: h% \/ P- b# z<lable>Item Upgrade Amount</lable><br/>
3 i8 p7 P* z6 k3 ^; D<input type='text' name='item_upgrade'/><br/>2 G$ h: R2 H4 n' n
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
$ o( X& o& @1 n7 o! g0 T; q0 ~3 v7 j2 T3 l& R* W
</lable><br/>
2 ~7 t" y: K' K3 W" j<input type='text' name='item_element'/><br/>: i8 m2 z) W+ x( `8 [
<lable>Element Upgrade Amount</lable><br/>
" N1 ~. j# P6 S7 ~% Z<input type='text' name='element_upgrade'/><br/>
% f+ B  l5 i) O0 v& R6 P<lable>Pierced Amount</lable><br/>
$ w# G! B- X7 I<input type='text' name='item_pierce'/><br/>
) O4 t) }( Y6 V<input type='submit'/>
7 N5 o5 ]# E: ?% Y. d0 X</form>";3 k  r! n1 |( n
}5 G5 [/ R4 g, f" O2 S

; n: e* |9 h5 O* j1 v& w* M3 lfunction PostListener (){
  o# i( F) O' ^* W; ?//Add more post variables if needed and add them to initform() function aswell
; Y% g4 [+ h$ H% j4 l
+ w* }8 |1 R) k# l! U* j################################$ W0 g/ R* f' h; E# C' B* W( d( o2 L6 N
##### Connection and Post ######* K6 s* `0 M. m  I0 _( N+ D' q
################################
- O1 Z0 `; G2 Y  f$name = @$_POST['char'];/ ^' n. C( o, s9 L8 d3 p
$ItemName = @$_POST['item_name'];3 R5 _: H4 @! ?; Y# l# I& b
$ItemAmount = @$_POST['item_amount'];7 B9 }) {3 T& V
$ItemId = @$_POST['item_id'];
' I* t, x7 d' y1 {$ItemUpgrade = @$_POST['item_upgrade'];
) g4 M( V" {, f$ItemElement = @$_POST['item_element'];
8 a/ M$ |7 P9 Y  h  F; v$ElementUpgrade = @$_POST['element_upgrade'];8 u! r" l# ]: h  t5 J/ q
$ItemPierce = @$_POST['item_pierce'];6 b* e. c$ {9 _4 ]4 {# L: y
################################
: |) h' h% F8 Q+ y/ _3 _5 I8 P/ d3 N8 E% |2 l( _7 [; e) l
//Check both variables for empty value9 @; X& ]. m' x! v7 _; o9 t

+ Z$ X& f  w. N/ aif (!empty($_POST['char'])){
& ]; T# x- L7 F8 W8 U$ b$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
, X2 v$ f9 Z: U& M: D
) T5 R' C0 L0 T* _% Mm_szName = '{$name}'");
! x( F7 W, G+ H  m! Kwhile ($row = mssql_fetch_object($find)){
5 G5 j$ a' }6 Zecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";2 e, U9 s8 \5 j" [/ a& v7 Y" k
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], ) V4 _6 S3 ~2 ]2 D( X/ |; q8 k
$ O( @9 r+ G5 }; c2 i: w" J
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 8 k2 d# {( c6 Q' O
# D! q4 M0 C: Y- a+ n" {  r/ e
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
( Y9 I6 a- Z4 `/ U2 ?/ p( Z9 y4 j; P- S) P9 j) ?4 g1 P  ?
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', % r1 E6 @" d7 i  ?# [: s- i. q5 K
5 Q) j5 k( {- R% b# W! Y
'{$ElementUpgrade}', '{$ItemPierce}');");
* {, K" x# @: |% {8 ~}, q' f' ~* r4 ~

( H4 x, y; Y4 K' U9 {4 H5 _1 u}
* {9 N( K# Y! {& c, I$ W) z& [
6 _; n) @* c3 S2 c; V}
8 G9 X; n. T+ [5 W8 i5 a- T: }8 b3 x1 x7 K9 Z" d
$InitForm = InitForm();
! q; c  D3 w: h" L5 t: q$Listener = PostListener();
6 j2 ^) U, W6 J/ E1 `! Y" @. o) v6 \; w
?>$ Z3 \8 ?: T( [8 y6 a" T: V
! N% H6 y7 Z! A& g* Z
, v# `! x% a- P' y: }
) C  Z- y- [# _5 g/ @/ ~& y
$ V  C. y; i! r! e. D  A
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-23 17:53 , Processed in 0.063166 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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