飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
( C, C5 a/ m& a; ?  Qfunction Connect () {
; E$ C  G0 v2 vmssql_connect('Server','UserName','Password') or die('Error: Connection to DB
9 f- u- P4 w6 q
: S2 p' G( C5 [8 F- y1 B3 BFailed.');& H  i; P2 C6 n: V5 \' @( f5 w
}
, d. Y- \3 `: l) F) ]5 {0 o* A5 Y* HConnect();' [5 ?0 h6 d* t( {
4 I* N2 T+ l! A0 {$ r
function InitForm(){0 b% m5 U+ c: c( `* Z. j
//layout for the form3 ]# P+ J- H! c" j$ z" t
echo "<strong>Send Items.</strong>% e/ Y! [# o+ {! e" m5 `
<form name='select' method='post'>5 l  X) d/ I% U' X  U: ]; |7 N
<lable>Character Name</lable><br/>6 r# U5 `, |! k; s5 j3 ^
<input type='text' name='char'/><br/>. @9 i# e5 H9 _' U7 v& z
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
1 ?" `2 _  T  U* z/ o2 R  ]<input type='text' name='item_name'/><br/>! [2 t# S5 a4 F- {3 @/ ~4 t
<lable>Item Amount</lable><br/>
" e! C% L% M( ^+ `2 J8 _<input type='text' name='item_amount'/><br/># V6 x8 H, _+ [. q( |* \0 H
<lable>Item Upgrade Amount</lable><br/>
$ b* s1 L" n' I- d; T. W<input type='text' name='item_upgrade'/><br/>5 N1 x# g9 x$ N7 G$ L  D/ q
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
4 a( ?) s/ G3 O& M
- _+ j6 q) T: J4 Q3 N% |</lable><br/>
5 Z+ R, J# L; s0 S. X<input type='text' name='item_element'/><br/>0 Y" N2 [( c# a! v9 N
<lable>Element Upgrade Amount</lable><br/>: d5 g7 F/ T" V  G: y! d/ P. x; {
<input type='text' name='element_upgrade'/><br/>
( t: w- L, i* W2 r. _<lable>Pierced Amount</lable><br/>
3 U, d4 m% Q* l% B* {& m' G<input type='text' name='item_pierce'/><br/>
  R( C$ _- T$ q1 C1 F$ P$ ^( b4 q0 O; L<input type='submit'/>) q' n- V- s2 A) T- h2 ?& _9 n
</form>";
& A4 n0 U% F/ E% S* p}* O+ q8 G4 l. w7 n8 Z! \, E$ e! C
( |0 B+ y- P+ |3 M) c: c
function PostListener (){
! M2 G( V. j1 g, s" Y; e//Add more post variables if needed and add them to initform() function aswell, ?, r+ H9 B" k; x8 o. d2 b
2 b3 G0 e# J" ?1 o
################################& g  o7 ]: w" n$ E# e" I& ~
##### Connection and Post ######1 o& X3 f. a! ?
################################
2 X' Y; W# }5 A, ^; W4 R$name = @$_POST['char'];& D8 h* G& }! T9 e7 q
$ItemName = @$_POST['item_name'];
+ }& c- T3 X, l. T$ z8 d) C, f$ItemAmount = @$_POST['item_amount'];- W! h" G+ H8 `3 t  @
$ItemId = @$_POST['item_id'];& V  P" P, ~$ Q2 q- Z/ {3 N, [& X
$ItemUpgrade = @$_POST['item_upgrade'];
: v, U3 D1 z  {, F" u0 ^+ I) q+ E$ItemElement = @$_POST['item_element'];% @% T& Y4 D4 |
$ElementUpgrade = @$_POST['element_upgrade'];6 `/ m2 E/ e3 i5 p- R
$ItemPierce = @$_POST['item_pierce'];
6 O4 q( q9 [" u* r+ T################################: a0 ?2 B$ C9 G* J; C* ^; [; l

& S) Z7 N" V; }$ ~//Check both variables for empty value
+ Y  s' @3 R0 Y- k+ u( \6 U2 q9 K
& ^) ?( |! Z- a9 mif (!empty($_POST['char'])){
  q) H* E2 `8 v- M2 M+ t3 ~; e' u$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
6 V/ n2 P& |- L  o& l& R. ~
5 f* h  F. ?. s4 V2 S* Wm_szName = '{$name}'");
4 g$ }& ?& ~2 v/ B% z1 Uwhile ($row = mssql_fetch_object($find)){) x6 _8 ?! c/ Y1 D3 t1 d
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";0 r. a: `' t. }6 i' F- m8 [& s3 T
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], - L/ _; b' e" \6 o

, i: C% s& E$ C# Q0 |) r/ \[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], # e7 V  w# e$ P! l1 e' d8 s4 T( @
8 m# V! d7 e4 p( z
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', ( `4 U  {* R# c6 Z* j2 M
( @/ N( i: y0 J
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', ; Q2 B2 l5 {* ~1 N6 F

) b2 z' n# v. V5 M; s'{$ElementUpgrade}', '{$ItemPierce}');");
; l( ^8 }8 g& r5 {9 e1 W& t}' J# E; F6 ]6 c) W$ [
- \0 w' Z! |2 S: E
}( n6 [7 g7 G( z$ \" l
9 N2 B  N9 w7 l2 F
}' l- Z/ W, g) R$ Z+ C& t4 u

0 R- y& x" w( |1 U/ q* R" n$InitForm = InitForm();
  b* D, z. v; K# W$Listener = PostListener();, |; B1 }% ]2 S0 w9 [: `- K0 y' Y
. G& I4 M: ~/ a0 e# b3 [& j6 l9 d6 ]
?>
- e/ e1 `0 O0 A5 h% D" R
! N4 D2 d  I! B, s1 e, g) j  g  _/ |1 M' d' ]( _1 s$ p
8 W6 ^. m. |/ \8 @' z! }% U

9 C: \4 L! m+ p8 ~3 H5 P9 }5 `
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-2 09:20 , Processed in 0.060823 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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