飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
# o2 z4 E' T. N& y  I& m6 Qfunction Connect () {1 |7 }* T7 n1 q' g& b5 ~, @6 p
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
* V& p* x& e0 K: N  e
* I5 M5 _4 r9 X# mFailed.');
, G9 l3 ]0 D! H: c2 c+ Q}* D5 B7 z: j" l1 {- u- u
Connect();
. ^+ M& t' s) Z0 Z1 b6 A6 \
# q( }' l) S5 R1 Ofunction InitForm(){
# S' K; _0 d: x1 U) I& g( ~- e) |//layout for the form0 }# G8 {* H6 K
echo "<strong>Send Items.</strong>: }" n. _6 x/ M1 F
<form name='select' method='post'>. \" o6 f5 q; t
<lable>Character Name</lable><br/>& S, x' C4 s7 B
<input type='text' name='char'/><br/>- r. T; W3 a0 }8 ~2 Y
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>9 o. z. F* E( n9 |" L
<input type='text' name='item_name'/><br/>' U4 w& Q4 X1 \: }2 T/ Q2 O
<lable>Item Amount</lable><br/>5 L0 C& i+ r9 v- t9 U! p
<input type='text' name='item_amount'/><br/>
7 }, U( E. `2 @8 D5 q<lable>Item Upgrade Amount</lable><br/>
) n( k6 A, A9 |: |4 b5 }. z  e6 E<input type='text' name='item_upgrade'/><br/>
4 g  T! p. h8 D$ P0 w5 |( O<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
& `0 {% a# G9 A4 [, w$ B8 {, o
6 ]2 V) r, }5 A, r9 s5 T</lable><br/>+ q+ j+ o: @4 v; A1 g, w3 Z0 Q, ^, }
<input type='text' name='item_element'/><br/>( c" B3 v6 ^/ I2 {4 {% _- X" A5 _7 e
<lable>Element Upgrade Amount</lable><br/>- H& `# R! f( e* ?
<input type='text' name='element_upgrade'/><br/>
! [4 S# M. k* w" m/ p0 d" M! L  L3 L<lable>Pierced Amount</lable><br/>  n6 T$ @8 w5 ~' E- i7 W* S
<input type='text' name='item_pierce'/><br/>  C0 }$ F8 C( U, F  L, O+ G
<input type='submit'/>9 ~8 \0 d& X3 Y+ v& g9 w9 a; T
</form>";
# Z# ?2 R2 t9 K/ e( `4 y/ N}
" Y' a: e3 F- N+ m
! s% h$ X2 p; D3 jfunction PostListener (){
& ?' G# X0 S/ d5 q1 f//Add more post variables if needed and add them to initform() function aswell- d  ^+ \+ C' ], u- [
3 ?& n5 F7 V% u
################################
- g, \+ H; u$ s" ~##### Connection and Post ######
- z6 j5 V/ S- i) y, f################################5 j& q  E. W7 R9 |. R8 v1 r" s2 h
$name = @$_POST['char'];& a& s& V: ?7 \0 v. U! Y
$ItemName = @$_POST['item_name'];
# _  Y+ S4 J; Z+ P/ r$ItemAmount = @$_POST['item_amount'];; R( P3 {) k* Q# b2 ~# w5 H
$ItemId = @$_POST['item_id'];2 T; F; C* a3 s1 E* R  H: W
$ItemUpgrade = @$_POST['item_upgrade'];
/ z; E  z, Q0 a  T! X9 J$ItemElement = @$_POST['item_element'];
$ |, b- Q) H$ h( G$ElementUpgrade = @$_POST['element_upgrade'];9 Y7 ~! p+ X; C* |4 x
$ItemPierce = @$_POST['item_pierce'];, |7 d2 J" S, N5 f
################################
( a4 l9 M; x' n0 N- b8 R5 C$ u8 E: u; {$ @
//Check both variables for empty value
/ J! O5 j2 s" |6 d0 K7 `' H2 Z3 _+ p1 E9 N: ^. x  x% @  R
if (!empty($_POST['char'])){
- ]7 P! k: t; L. s( y$ o+ {! P$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
) s7 I1 `- N- E* e2 x6 _3 V0 I# U# [8 k( ~6 S
m_szName = '{$name}'");
7 }! O5 t; A/ m* e& \: D, c: L/ vwhile ($row = mssql_fetch_object($find)){
; Y) y& u7 N, A: U- n  o( o  b. Kecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";& z( G) J0 z5 \$ g! `3 ~* q8 M
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
; F# T! k! D" e% t8 Q
; k- J+ G% z+ z8 N# y3 j[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
6 Y" G: r, W/ n+ R) I7 S( ?: r" q0 K6 z1 ~
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
% e* V( i. d8 Q9 V& G7 ~! [6 C/ y( Y) E1 D: d3 O( `  p  a0 [% ?
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', % Y" ^$ O8 a6 O9 a$ m3 a+ N0 Z
2 Y, z6 [) m( M8 f: v* n
'{$ElementUpgrade}', '{$ItemPierce}');");
+ Z9 L( R& k( W& v' K  Q}
  s6 Q' k4 ^, W9 X. y6 W/ a
7 w8 u- `' T3 q}
" X0 \1 }2 U! D: U$ ^4 e; K
. @& I* u0 R! V; `}* W+ g. ^; z' \! n& N8 v

: t' z" s! M  E+ W* s% x" O  c$InitForm = InitForm();
& B6 w: d, C# ^; T: a+ u; O$Listener = PostListener();
! J. G; m' |% U7 V# r. {
: j( n$ O# }! ]9 o! f3 ?4 @5 {?>+ @1 h- I: r8 r' y

0 A3 b# S2 b3 K4 X" o7 p. i. `9 S8 ^" W5 K. E, V
  t2 F- h# n/ h' B' h* y
; R5 {% p+ y, d% }+ y! d6 r
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-13 09:54 , Processed in 0.060470 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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