飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1074

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1074
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |正序浏览 |阅读模式
<?php
; Q$ }- C! V3 R* |! |function Connect () {
" n) N( v6 d  j2 Q2 Smssql_connect('Server','UserName','Password') or die('Error: Connection to DB
6 ]. f( \6 ~7 {, `7 Y  p
0 n! t- U0 l- W, P# ~Failed.');
+ G2 d  [; J$ \. p! @" H) K}7 P) T$ a  s- G
Connect();
  q8 Q& g9 ?: ~; f9 X" E. P7 I, I7 b, Y! J
function InitForm(){
$ M( a! J4 a4 q7 G6 j//layout for the form
$ \% w0 m; M5 l' u! Q5 f1 xecho "<strong>Send Items.</strong>! r+ b) Z# }# L0 f9 w
<form name='select' method='post'>4 X! Q% a9 B; |  V9 ]
<lable>Character Name</lable><br/>! s! u4 \" c6 ?1 q
<input type='text' name='char'/><br/>
0 Z; K1 z  a! v, E& ~& h! v<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
% w: h( d; B4 b( m2 {# y) W<input type='text' name='item_name'/><br/>" G2 r% ?) N/ Q; V: O# b( R2 [" t
<lable>Item Amount</lable><br/>
# R/ q! ]) Q& T<input type='text' name='item_amount'/><br/>
, y+ C8 y. `* Q6 H<lable>Item Upgrade Amount</lable><br/>4 T$ s4 Y8 Z9 a6 c7 D
<input type='text' name='item_upgrade'/><br/>
2 T5 p0 [) z5 u& w/ S* `<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.). p& q' N( b: s7 b6 \; j  E

5 E- q9 |' e2 G% m' A</lable><br/>
) X( s! ?8 K& v! l7 @" \) B8 E& x<input type='text' name='item_element'/><br/>
9 ~8 K; C/ A' t' g1 m3 O<lable>Element Upgrade Amount</lable><br/>2 t3 q( Z( m9 X5 i% g# g& f+ l
<input type='text' name='element_upgrade'/><br/>
, r6 Z1 E' o" q0 m$ ~<lable>Pierced Amount</lable><br/>
8 q) j; n  P9 m7 r0 J<input type='text' name='item_pierce'/><br/>. N3 @. e+ G0 u$ `( F3 [" V) }! |
<input type='submit'/>3 |. g# u! V6 m7 W
</form>";0 d# W; E/ d: M& W. U9 h' B5 ?
}* V5 A8 r& m3 e) X  W

( _. c& |; o3 T  hfunction PostListener (){" k: A- L, s* j* ^( V
//Add more post variables if needed and add them to initform() function aswell6 p/ }  R7 o8 s

6 ]8 d4 A0 E& D2 Z7 h; R* V################################0 Y: h' Q6 H* S9 ?
##### Connection and Post ######8 T( ~8 D& e/ E8 p" |
################################0 Y# s6 R3 F9 b/ I3 N
$name = @$_POST['char'];
( o9 W% g$ B7 X! m0 S$ItemName = @$_POST['item_name'];6 h7 U% F4 S/ W+ Y
$ItemAmount = @$_POST['item_amount'];( ~: u6 Z1 C) Q  |8 y; E
$ItemId = @$_POST['item_id'];
- K  M+ v3 r$ p7 B) ^+ |$ItemUpgrade = @$_POST['item_upgrade'];
! ^0 P' h& g. @1 ~7 ]0 X+ z$ItemElement = @$_POST['item_element'];. ~$ P  t. z/ |. H* \% R/ J) {
$ElementUpgrade = @$_POST['element_upgrade'];) Y3 @+ @% i# N! b
$ItemPierce = @$_POST['item_pierce'];
( ]# S+ H- |9 d. ~1 z4 M* }################################- R* \  b% J/ m. d4 S7 H; F
9 j; J0 U4 ]% k
//Check both variables for empty value& C, w) ~6 }, Y5 n+ u5 m

! M8 E. L( r9 _0 [if (!empty($_POST['char'])){
* Q. n* ~3 r% J1 V$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
4 `! B( Z0 n8 ~$ F* K. Y4 ?6 `9 S5 y( L9 E6 w9 H
m_szName = '{$name}'");
8 J4 f7 f7 t' p9 E% ]2 Nwhile ($row = mssql_fetch_object($find)){) e. S  |3 k! j" {7 W) H
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
9 x+ ]3 w8 X0 L9 g& \0 U8 F2 F, ?$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
+ q3 S! W* E# h0 F( m# n8 f6 B. D1 a- I/ c0 ~
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
. q+ D" N2 I' ]/ w/ e( D: R
7 ?8 ?0 w% K" B& \! \9 A[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
1 z) [% A6 {& H4 O7 f2 ?7 z" V: V- f  c2 U
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
& W; V: A& `' N
7 h2 ?1 d, Z; P'{$ElementUpgrade}', '{$ItemPierce}');");+ k. k. I) h, T; t0 c+ O6 b% ]
}: p. E6 H7 U; H! |
# A$ s) R- N! |3 Q
}
7 w$ x  ~6 g' G3 m7 v: W9 `
7 Q3 ]; \6 @- @* m  S% h1 v5 i}
8 h% f) v  t2 h0 d7 i8 ]+ f7 I
! C4 N9 h6 U1 P: ^2 s. l6 f$InitForm = InitForm();& ]' F0 M4 X. h6 }  F0 |! s6 P
$Listener = PostListener();
' w- L5 m: B" J% x. g; i
" T) A% r* F, ^* Q( O' Y?>
3 }/ K% m1 t9 G' x. b1 }' T  L. N) p& @. t+ y$ D4 C9 f, _

  r! ~6 Q0 p2 C  O
  i7 H0 Z+ d  D- o/ J% d3 k" p; |3 g! e# n" l4 |, J8 ^
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-10-14 10:41 , Processed in 0.066282 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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