飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1088

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1088
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
. x$ F! I7 G- yfunction Connect () {, x/ Z  w" D2 E) `7 x
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
1 j# Z; j0 \% t2 s* R, e  i* ]! q5 J  L* ~
Failed.');/ ?6 ~8 A  `5 N. O+ X; h" Z/ N  T* w' h
}3 ~+ I7 N- u+ [1 H: E
Connect();- z  m% U% g# p: V- F
! j9 R, j  I3 y  e9 ]+ Z
function InitForm(){- k$ Z& |9 l) v
//layout for the form6 r/ L( a6 w# x# o4 k5 C
echo "<strong>Send Items.</strong>
2 S( z' x, Z+ G<form name='select' method='post'>" A, Y% J8 N- m' A0 |
<lable>Character Name</lable><br/># N0 ^! X" N1 }5 f  p
<input type='text' name='char'/><br/>
4 u; d  D* j" u- K* s% Z, Z3 G<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
: ^( @7 m+ w7 I2 R/ g3 c<input type='text' name='item_name'/><br/>% s/ [1 D6 i% W
<lable>Item Amount</lable><br/>
" _" G* S: x5 V' [* Q<input type='text' name='item_amount'/><br/>( I, r: B1 U8 G- M% j
<lable>Item Upgrade Amount</lable><br/>
5 T) q) p. m. o; i+ M: r- a- D<input type='text' name='item_upgrade'/><br/>% Z: G5 d0 f: D3 j& H8 z; d0 d
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
3 [6 F" h5 `: m8 T% X: A4 u$ m
* ^- i  {) l+ @; k6 [</lable><br/>" a1 m/ F0 b6 I! {1 u
<input type='text' name='item_element'/><br/>
. `- V6 ~- v* z$ p4 u<lable>Element Upgrade Amount</lable><br/>
; `7 m) Y4 w; \6 y! B# U* N3 J<input type='text' name='element_upgrade'/><br/>3 O/ \5 F) s! x) X& E& |
<lable>Pierced Amount</lable><br/>
3 L3 o4 W# h/ b6 T5 @5 L9 e4 Z<input type='text' name='item_pierce'/><br/>
7 C+ h2 b! q5 {* g<input type='submit'/>6 j$ [) R1 U) {
</form>";
# L" ~/ \  K* L+ \! `}
! E) y# a* K, U- B( H. V
& b9 w' c) e1 N/ n6 d" V# }' nfunction PostListener (){3 r& o1 {" B) Z4 G! n. b8 Q6 h
//Add more post variables if needed and add them to initform() function aswell
- ]" N' ]; Q/ v7 O; L7 _% L& q1 q) a6 z7 l9 D- K4 G
################################  v7 b0 n. g: L
##### Connection and Post ######! d- l3 T; N, y4 _9 b' D6 X3 u
################################
* n, J1 b% p- J" Y: ~: x1 V4 R$name = @$_POST['char'];5 t4 r  Z" V7 k; B
$ItemName = @$_POST['item_name'];
/ p9 @5 T( P: l( n$ y% z% E& q' T$ItemAmount = @$_POST['item_amount'];
# m; ]9 t' S) S" q7 N& i1 a$ItemId = @$_POST['item_id'];
) E# b' u& K3 G3 f$ x8 g$ItemUpgrade = @$_POST['item_upgrade'];
: \& y6 s7 V! i) o6 a$ItemElement = @$_POST['item_element'];) P: S0 w8 J, `5 U' B7 S
$ElementUpgrade = @$_POST['element_upgrade'];
$ L* W  k8 v* ?/ t' o: h$ItemPierce = @$_POST['item_pierce'];) S) r# w6 L" x) k
################################
& Z' ^0 l; b! H4 U8 o  E# K& q  N4 H% n! u5 F, f1 z% v: |
//Check both variables for empty value
# r, I6 o3 x2 u9 J0 R
2 ~6 X: @2 `4 Dif (!empty($_POST['char'])){
/ T! @8 ?+ K/ O. F& Z& G9 K$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
$ x: m0 T3 Q& o
( F; V# N9 S5 Em_szName = '{$name}'");
. h% F5 K6 v! h2 f) f; P+ C7 `/ c7 Iwhile ($row = mssql_fetch_object($find)){9 k* _( g; {9 h1 i4 n3 z% p
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";/ P+ p4 |2 u9 x' a
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
8 i& U! o' k- \9 W3 @# ^. z9 G/ f, U+ T
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
9 z# u& ^, j1 {
7 \! W/ ^. b5 |8 m[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
( u- w/ e% ?& p1 n% s" A
+ j; b4 v$ g' N/ IN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
" F% i5 L5 f! k+ v# N
( c6 u! A  r1 ]  z1 Q/ n; `6 g'{$ElementUpgrade}', '{$ItemPierce}');");
  W1 f+ {) Q+ j}( @9 |: e% C, b/ ^; X
; d+ I6 T" G* i3 ~! N: b
}2 O. j6 R( f5 K

+ s; N' D% k- n5 ?& j: f}/ l' f7 l. M. R9 {
* s! r: n! W6 ^" y3 I' R
$InitForm = InitForm();% }! J% b: L7 U! N; a
$Listener = PostListener();
1 G: a$ L. t! O: L( m
  c6 K9 ^# A. F3 t( w?>6 K. k. ^( h1 o4 l: N0 h3 y

) g- \' C$ G: X: b+ U& k. }0 v3 ~' t# e: Z  f+ {9 e; U

( s' P/ N. }/ [' ^* c, C# [" r6 M  Z2 T& q* U/ `
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-25 01:32 , Processed in 0.059312 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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