飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1088

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1088
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php# o6 ]9 S( Z$ P3 Z! v, g0 {
function Connect () {/ k: @7 j& n" ]& t
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB   Z2 K2 C2 h# y8 ?& j7 P4 A: `$ w
$ G" G, X4 A! V9 t
Failed.');
( Q* a/ p3 s" j. ]5 {& H}; J5 k! b% Q8 U- }* u) {
Connect();- v' N) A0 T1 F. P; i
% F) m4 Z5 |! Y9 h' \9 A
function InitForm(){
, o) e" J0 P& H& x' ~# ]//layout for the form
( U$ u) ~1 S$ `* x& _echo "<strong>Send Items.</strong>1 a& I8 Z& B6 c
<form name='select' method='post'>
5 F0 n4 X' n% R/ c2 P2 A' Q) n9 {2 W<lable>Character Name</lable><br/>
: {1 `, o. u9 x; S" G2 q7 ~! s<input type='text' name='char'/><br/>
$ R/ b. s8 ?' G0 v; c$ Y<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>- _7 m  C* X+ W3 ]# h' T6 K
<input type='text' name='item_name'/><br/>
2 y: }" J9 i2 G$ I<lable>Item Amount</lable><br/>& B, a( {; C& h$ ]+ T0 P
<input type='text' name='item_amount'/><br/>
- R" a8 d7 p. A( \/ u<lable>Item Upgrade Amount</lable><br/>
( X- J6 d1 }2 t' `4 E3 `3 ?& _<input type='text' name='item_upgrade'/><br/>
8 o$ O* s4 U9 W) B7 {1 z<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.); j9 T% j4 V- e9 u
# J" z( p6 Z, ]+ Y" P1 `' Q! y, ?( z
</lable><br/>
, @. W: W; @2 T; o5 N<input type='text' name='item_element'/><br/>8 P  N+ m! `7 X' e- z9 Z
<lable>Element Upgrade Amount</lable><br/>, j8 }$ f! S% N. R
<input type='text' name='element_upgrade'/><br/>
) V; M+ m5 @# g! W: j<lable>Pierced Amount</lable><br/>
  n, J/ D7 g+ d# N0 R& R- I) p<input type='text' name='item_pierce'/><br/>
- ]" ~% [1 D* }<input type='submit'/>
  b1 h2 H/ B$ E) J9 W( a</form>";' o5 o6 x, J% r' I& r
}
6 {; e% P" n2 `; ]0 x  ^8 w) w0 P
- z) g4 ^6 p( Tfunction PostListener (){
  t" [- K9 v6 ?; y//Add more post variables if needed and add them to initform() function aswell2 w+ a1 T9 `8 P9 J6 Q5 H

) k- r, \7 r0 ~( s' K/ w) u################################
: p- x5 w" T! _- ~) L; E0 S+ t/ N##### Connection and Post ######
  \9 I3 c( Z1 H2 b  t################################
1 u& A- p% J$ E; }9 X9 ?$ P$name = @$_POST['char'];
$ y" V( a1 `& A& G9 w$ItemName = @$_POST['item_name'];6 Q9 J; d, T5 g* ]( W8 N* p
$ItemAmount = @$_POST['item_amount'];4 t9 ~& q# i7 V4 _3 t
$ItemId = @$_POST['item_id'];
  Y, a) L+ C$ W5 [$ _: T$ItemUpgrade = @$_POST['item_upgrade'];
7 j! A! g' x0 C$ItemElement = @$_POST['item_element'];
0 A: I$ e  X0 C3 H2 F+ Y$ElementUpgrade = @$_POST['element_upgrade'];
& I2 R' Y. X+ x" D+ c1 h; M$ItemPierce = @$_POST['item_pierce'];4 h: I, W! d' v
################################
3 G& P( C+ D: h; w1 i* g- C$ M+ u! [4 Y
//Check both variables for empty value
! i" q0 Q* {5 I( i. j+ w
( D% O( Y( `* A# b% {if (!empty($_POST['char'])){
6 b5 \0 w! K, c1 j* g$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where - n/ f; l- n7 Q6 c* ], U' ~2 h
0 w+ B% D: w9 C; ~% d5 l0 [
m_szName = '{$name}'");3 C: b- d, B3 T1 d) k- y
while ($row = mssql_fetch_object($find)){
: @8 v. }9 U, |! F9 k3 |echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";  Y& n! E$ B: q% R
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], ( [9 `; V' c& r& W( J2 ^* [6 I: v
- b4 H% y- g2 O9 I# h1 R
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], , U8 Z  J! v# C* {, W

( L/ x  i; b" S[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', * K% h) p9 x# ]7 A8 w' P* C

$ f1 k2 z$ Z* uN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', 8 H$ Z) {* k* s
0 ]3 m: Z! l  w. Y
'{$ElementUpgrade}', '{$ItemPierce}');");. z+ U9 o$ _3 I, H+ T# U
}
0 O  t: v; r  }# h1 g
* p0 S" I# f& P3 C6 X4 H}
- Z( K: W: r4 b1 P$ q! ?3 x2 e2 Y4 g: W: W9 H
}: g" R& I& E8 ~" E, p

+ l9 Q4 u+ b! U6 Y) Y' [, U0 M$InitForm = InitForm();
/ @7 W, J8 `. C/ c0 y$Listener = PostListener();
9 x/ m  s' C$ R+ L
/ y2 T  B9 b0 V' e( {2 [$ s9 i?>
2 F3 \# h3 Q6 I2 _& X2 D  R% \3 }. t1 {( ?
% X" U9 l6 z2 S1 A& a& Q* l6 ^
  l9 _2 n/ b0 X/ N5 t
" w4 ]+ b- K- `- N) _0 b2 b
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-23 00:47 , Processed in 0.060268 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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