飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
" T/ Z* R7 g0 V2 Dfunction Connect () {
9 t3 E1 ~. S4 o2 P$ P- Amssql_connect('Server','UserName','Password') or die('Error: Connection to DB ) \5 f7 Z* Z4 d5 E. ^

8 w# N1 w7 M8 }1 \4 \: OFailed.');3 \, T; l/ @. V0 v, v: X
}
& |9 N) M9 F7 I  I* v2 FConnect();; r1 c! J; s/ V3 Z
, N, ]4 s5 l- m- }2 M" w% T
function InitForm(){! p) A8 L: r1 n& s* H( J
//layout for the form
, C1 h- U& ?6 [7 E2 o& E, wecho "<strong>Send Items.</strong>
( {3 z; {" U8 H& J( j' ]8 `9 G- d0 [<form name='select' method='post'>
! t8 Q( l- x5 s( k1 t<lable>Character Name</lable><br/>
3 j% Y# p! p' K4 e, ~6 i<input type='text' name='char'/><br/>
. [; y$ S1 s3 G<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>3 k0 J/ a# n; D' ]: ]& e& k) t1 d
<input type='text' name='item_name'/><br/>& |# ?0 T: H1 f) n) z1 I' C
<lable>Item Amount</lable><br/>$ B& v' e1 v* {; F# Q
<input type='text' name='item_amount'/><br/>
/ p" H* P/ [- ~+ C<lable>Item Upgrade Amount</lable><br/>
; p; I+ ]1 J1 N* a+ u<input type='text' name='item_upgrade'/><br/>8 L: Y" B( S# T
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
, ]# s: L5 e" e; g  l  M8 c. V/ S7 F
</lable><br/>* I# b; h$ W7 F! A4 A9 f; e
<input type='text' name='item_element'/><br/>
2 k, i! Q7 H* B' H. A<lable>Element Upgrade Amount</lable><br/>& g5 \' O3 [- M; l
<input type='text' name='element_upgrade'/><br/>
8 M, ^6 ~" i/ z& _  P<lable>Pierced Amount</lable><br/>
1 t/ j$ C; o8 F9 Z! |. K" G<input type='text' name='item_pierce'/><br/>
% \: @' M" D5 r+ t5 x1 {6 T# }<input type='submit'/>/ }) t* A0 o8 Z3 g5 B3 y3 K. }
</form>";$ [+ f1 F" B" C+ P; W: \# _2 W
}
2 j  x( b2 K( y1 x* v" J- k6 k0 a4 a- X- {* d* z& e
function PostListener (){
" Q9 V# K6 E+ f# ]5 S( x& ^$ C//Add more post variables if needed and add them to initform() function aswell
1 _& P3 m  q5 l0 v3 [: O1 `6 h4 E" B* H" N% x2 ]7 e4 Q( g% f
################################+ K# p( ^1 U" N6 B
##### Connection and Post ######7 G8 J0 r! ?* q8 y0 Q
################################
. }) h! p# Q$ }4 A3 t4 W: w$ s$name = @$_POST['char'];
% M% i& W4 A" {, ?( D" ~  H9 B$ItemName = @$_POST['item_name'];
1 O. J0 I! E( S% f$ U$ItemAmount = @$_POST['item_amount'];
9 C8 r" \$ b3 `  s2 z0 F: s$ItemId = @$_POST['item_id'];- `, N6 i! K8 X' U; ?
$ItemUpgrade = @$_POST['item_upgrade'];
& W+ T9 X0 {0 {( w* P9 ?4 o$ItemElement = @$_POST['item_element'];; P8 H( i- f3 T) {
$ElementUpgrade = @$_POST['element_upgrade'];
, W; X6 v$ M0 J& J) g$ p$ItemPierce = @$_POST['item_pierce'];
2 ~4 ]3 |6 M# x, C2 Y' o################################$ {. }( c  ~6 R5 x1 _
% J3 s! ~! p3 P2 G/ o( s; B
//Check both variables for empty value' h; a1 v. n- D4 Z$ R% q8 ?

$ V3 J+ [. y! Y9 Hif (!empty($_POST['char'])){$ S$ S& A8 G  p2 ?" J
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
4 r5 r6 u0 B+ C1 C2 o+ N1 c
/ i$ T) V2 y) F9 j, Um_szName = '{$name}'");
/ r$ k. T+ C. m, [" Gwhile ($row = mssql_fetch_object($find)){
- S: O2 l! A3 y: {6 m- b4 Decho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";  T2 F# `6 r" k: L* G
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
/ \; y/ C( V: i5 Q5 d- z$ u4 U3 N' W5 v5 R
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 9 L+ j& U7 B9 A+ u, `  Y) f
+ ?% ]3 @/ k5 p& W# P- A
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', - P0 \' k  r% j

& ~. x* [1 Z0 ^9 \N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
8 q* ]. e; A( [: |& `  ?; o: Y6 V- \' U
'{$ElementUpgrade}', '{$ItemPierce}');");
: F% T! A: F5 e" c0 ]}8 z' @7 n7 L- n& [) ^

4 B9 a) b, g6 j& h2 P6 V}
+ R  ?+ Q# s8 Z& \/ R0 |4 s- N6 x' Q6 f6 h6 }+ J' ~) `
}
) c4 r1 y* L/ X1 s3 [9 U% [$ L8 m2 D
$InitForm = InitForm();
$ F5 J# U3 R- Y" C' P6 i% P0 z/ F5 d$Listener = PostListener();- U+ c3 f8 a. Z2 V$ ]! j

6 L5 Z, \8 h3 t/ z: d?>0 m: c/ \9 Q( x8 X+ H) |  [
3 V: J1 A8 T2 G7 Q

7 X6 b) v1 C/ ~& v# s% i
/ f& u5 V  N) W; m$ ]6 v6 Z6 P1 j  L; F0 u( w$ U' s/ {
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-9 11:18 , Processed in 0.067626 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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