飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
% ?8 w3 y; C1 T8 q# ffunction Connect () {& z1 J, m. D6 V
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
  j5 g; o" [% U2 F7 o+ [; b8 ?) r5 y) v
Failed.');
, ^6 O- U$ R6 ^, \& b}
! s. q2 X# ?* c1 sConnect();/ P1 s: t, h5 ~; n2 q
# i' Y! R/ `* {' v/ v) _. R: h
function InitForm(){
. _4 P& _  L" c; r9 U  P" R//layout for the form
7 h, X7 k5 y2 o; N7 ?: x* zecho "<strong>Send Items.</strong>0 v$ l! o. I$ r8 A, t0 u' }
<form name='select' method='post'>- Z) m, y8 z( z" {8 N3 t) U- k
<lable>Character Name</lable><br/>
$ l8 N/ t2 y# y3 ?2 }3 A! W<input type='text' name='char'/><br/>
8 ^, ?; d3 D) U, W6 R: e3 s<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>2 y' ~$ M: m; D
<input type='text' name='item_name'/><br/>
# o6 M- ]% e! A& `<lable>Item Amount</lable><br/>
* l* ~( W5 H" N( P' W<input type='text' name='item_amount'/><br/>
: R. c+ V2 V, `6 w<lable>Item Upgrade Amount</lable><br/>
- ]2 G6 R6 n3 @7 L4 U<input type='text' name='item_upgrade'/><br/>
; B7 o% c& \. I<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
9 i9 |* F" Y+ t3 n0 F9 L- U( |. n# x' k& g/ H" d- J! f
</lable><br/>; \9 U: }* z6 g8 H# f+ E# _
<input type='text' name='item_element'/><br/>
7 L% R5 W" _1 o2 ]7 I/ ~8 K# d4 T7 O+ C<lable>Element Upgrade Amount</lable><br/>- ?' n2 Q4 X9 L. G% j
<input type='text' name='element_upgrade'/><br/>; \9 V) }  ?1 T) G% P9 q
<lable>Pierced Amount</lable><br/>
4 ]+ v: f& Q  M0 r<input type='text' name='item_pierce'/><br/>+ C( q/ g7 o# t0 i
<input type='submit'/>
9 Y9 g9 V+ K4 ~- D</form>";& g! }& R: {, A, \5 v8 V4 T
}
' O/ h8 A6 J) l& \# U- l" \. e6 ?  ]& u% P0 p# D
function PostListener (){
1 j! X, Y/ f3 J: |9 R//Add more post variables if needed and add them to initform() function aswell
# r& c! v. c- [
1 h" W% g- }6 n( e. M################################
8 n8 z- T1 Z# J+ m! u$ F##### Connection and Post ######
* H; u2 A/ \) U6 P################################( ~( \4 A. O& L2 R  J9 t  G# Q5 O
$name = @$_POST['char'];) Z5 n5 ~7 n6 e; P9 ?) Q( b
$ItemName = @$_POST['item_name'];
6 R0 _) q/ V* M2 [" q! q: R- f$ItemAmount = @$_POST['item_amount'];4 ^. \; c  R4 s. d
$ItemId = @$_POST['item_id'];
, e. `6 ]3 |3 k# K# \, E$ItemUpgrade = @$_POST['item_upgrade'];1 {7 C6 L/ G! J" f; v/ A- s1 u
$ItemElement = @$_POST['item_element'];1 r# J0 e. L% V$ y/ e) B) |( t
$ElementUpgrade = @$_POST['element_upgrade'];
- Q! s* P2 ^6 z3 {2 F$ItemPierce = @$_POST['item_pierce'];- Q2 J5 \) i* R* |
################################" B+ K" F' E& ?, _* ~

# z* F8 r( Z, q8 m' }/ H$ Q//Check both variables for empty value
1 H3 s/ o- L8 a9 W" p! e% ]8 }! k' C2 r7 E4 @; W( v+ C
if (!empty($_POST['char'])){" z7 |& t( X9 i. q& a% Z! e# b
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
- n9 R- K" ?* |7 {* x2 V  d  {7 @- H" M4 U8 |
m_szName = '{$name}'");' {: x  K1 V3 M* Z$ }# `
while ($row = mssql_fetch_object($find)){
" _- Z) o1 r5 ~, J% Qecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
, n7 F; |/ ], ~* \  T. k$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
: R# H$ r' y: L& v9 m7 u! j* g; M: j) _+ `% o( V( R$ w0 i" l
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], - r( c/ G  C* ]) w" c

' `6 q3 O% i5 a5 g* w[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', % K- ~% x, Y( O% O' D$ n) ?1 |

( o% {; H9 |2 T' p+ L. yN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
( S4 N/ V5 B: Q+ q) A
; y8 W: e! a6 z0 S6 b/ ]" e* E0 i'{$ElementUpgrade}', '{$ItemPierce}');");
, E- l; `! u. P% K4 Q. ~7 h}
3 u! S: S2 G# F4 ^! \2 ]% f& o4 R
: F# J1 c4 P4 t5 O9 Z- g}9 ~/ A9 u; g; C4 |, I3 u

( ?) _6 r8 s$ d! |: f}
% g! F+ m% w7 E( o
! k# Y$ M3 ^8 x$InitForm = InitForm();
6 X0 O# c: {: l' g# x* f$Listener = PostListener();2 J; ^4 x4 b* o  b+ @

, Q7 E6 @& u  v, I, i1 x?>
' d! c5 G7 N2 H2 L  h; G3 m& N; ?. S2 n, w8 n& H
. t! V# R1 y4 Q: ?! h
' B/ E/ l* i4 [

* G; z+ v) X6 x3 }4 H3 r# u
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-10 21:35 , Processed in 0.058096 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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