飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
: k" [7 S) C7 V- Q! L6 A8 ~function Connect () {
) _2 q$ L% c( G0 j, Jmssql_connect('Server','UserName','Password') or die('Error: Connection to DB
% S  o* m2 e+ p: O) w' M- F! f8 {" o
3 r; o4 h0 H& H# F7 BFailed.');
5 d4 V0 G0 Y+ x& a/ c) [}
# E' `9 g  g+ ~: |$ CConnect();' e6 G$ @# L9 X; ?+ j

8 r/ }7 p8 T% g3 b+ F  c& W8 }% Tfunction InitForm(){) q! T) @: j# B2 R
//layout for the form
3 g$ N" q2 s! W9 X' |& M  o. oecho "<strong>Send Items.</strong>
8 V+ `8 Y) P7 w7 M6 ?<form name='select' method='post'>. U" I0 k" @5 \1 v0 A/ m
<lable>Character Name</lable><br/>' r0 g$ R1 h) s6 b1 w
<input type='text' name='char'/><br/>- R; ?+ x+ Y* D$ C0 A  Y" b
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
# l: s, {# `: P/ l<input type='text' name='item_name'/><br/>
" s6 {8 X% g+ ^% u2 I) [<lable>Item Amount</lable><br/>4 K5 [) [! g2 Z; c2 ^+ x  W! g
<input type='text' name='item_amount'/><br/>% t! s1 n" s; a- y
<lable>Item Upgrade Amount</lable><br/>; Y1 L6 w8 g& o% O& [
<input type='text' name='item_upgrade'/><br/>! x4 s6 N- U% q( G. u, D6 Y; m7 x
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.). ]* ~4 k* o! n$ ]! p& B2 ~) }
) K2 K; w, g; Z4 A( r% f
</lable><br/>
1 E7 w  [% r7 ~3 Z<input type='text' name='item_element'/><br/>1 `0 ~0 k) T, t* S5 T
<lable>Element Upgrade Amount</lable><br/>
% d: w7 Z* U" F) g* z<input type='text' name='element_upgrade'/><br/>
0 P1 N  L; c. J0 s<lable>Pierced Amount</lable><br/>, J; [! L4 ~5 w* C
<input type='text' name='item_pierce'/><br/>* h8 \4 U, z) Y- |6 T9 j+ c: T
<input type='submit'/>
0 m; e/ p/ F+ @/ N$ t- ?! Q</form>";: a; S6 @& d7 t& c
}7 ?9 T0 P4 T: Z! ?3 s
8 h2 L' R/ C. r' d6 a
function PostListener (){# r  n1 b3 U2 n0 G. V' F
//Add more post variables if needed and add them to initform() function aswell! V/ a+ f6 P' P1 z0 F

# C& Q# L/ n7 U8 ~9 @. Z################################$ p; u% ^' s  {
##### Connection and Post ######& @. f% R( N* b$ k& c
################################
* _- ^) g+ K0 U, a$name = @$_POST['char'];
7 K. _1 k0 n2 I" {3 j$ItemName = @$_POST['item_name'];
" S+ Y/ y  l4 s4 k" Z) @0 V& g$ItemAmount = @$_POST['item_amount'];
$ R& B: r/ _+ [% N9 ?8 ]/ ~5 J$ B$ItemId = @$_POST['item_id'];
* I' a! N, O9 {- C$ItemUpgrade = @$_POST['item_upgrade'];
' W" O" F: z9 x1 U$ItemElement = @$_POST['item_element'];
; a" S) y4 N  ^, j$ElementUpgrade = @$_POST['element_upgrade'];
7 W- o4 s! Y% q' M$ItemPierce = @$_POST['item_pierce'];7 Z# m; Y6 ~7 v1 P
################################" k* j; h" X9 o/ T% ?  |
" f4 z2 f- B: Y8 q; l  A  p! X  C
//Check both variables for empty value
$ |& J9 K/ r' H  l, h
" |; K# {( B8 {( U( T( v4 h% Jif (!empty($_POST['char'])){7 K) U% P+ }5 X1 y2 _
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
/ g4 [# b; F: k. D; y$ I- N
1 G. x  \$ k' p" D2 I  B  g" tm_szName = '{$name}'");) r& j- T% f" g# ]$ _8 Q( X1 C& [
while ($row = mssql_fetch_object($find)){/ n1 k1 p9 u. `" T% Z8 K
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";" `. X* Y7 C& x7 V
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],   t. a9 [, _' u2 X3 @) B

( a+ c2 D% \' n! q[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], - A( s5 Z, @% Q! x; Z. ~- o) H
4 W5 O$ h' `0 P# w7 f7 T0 U" ~
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
4 l5 Z1 j6 p+ ^0 m% e! E# s' G) S8 k+ |% m; Y' ^
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
  z1 F$ a& R  r
) V4 T& x. h- K+ W'{$ElementUpgrade}', '{$ItemPierce}');");
5 G( U0 s' t1 M6 k( q}% Q! S. b" @' G1 B

. R7 s0 O4 e: `}5 G6 h. [' y4 v& [8 ~9 ]& A5 y

, V# p) b' t: `# t  z}2 U. O! V0 l2 w/ H
* J0 e# ^, L/ q# l
$InitForm = InitForm();, X0 f+ m. U, L( i
$Listener = PostListener();
) E0 [0 E: L# d, e$ ~
6 b+ b. q1 j  v3 t, a?>5 ?: n. A7 q1 v
, ^/ l2 r7 b) a
% K# R, ^7 G" w# S
0 u1 D6 A) M. b6 i5 \* ~7 H

% E0 M2 s: e( E; J
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-14 18:32 , Processed in 0.058041 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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