飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
5 \. R) Q% W9 |" ?; R8 efunction Connect () {
3 X- A4 `: ~; g8 M2 Gmssql_connect('Server','UserName','Password') or die('Error: Connection to DB ; \( K  l0 B" u+ V1 x6 l/ b

5 a& i1 T8 C6 T  v) `7 ]6 }Failed.');
# }) e0 ]( M$ [( w+ r}  g8 Y, G# ]# c0 e3 N- x* A5 J
Connect();1 y0 X% R+ [) o: @0 F3 j5 s5 k, _3 t
+ p  R* L* J  n! y+ S7 G4 `2 Y
function InitForm(){1 t! w7 q5 N$ W. S
//layout for the form# T1 g$ S3 j; i
echo "<strong>Send Items.</strong>
. O( e" b; U( ~2 \<form name='select' method='post'>9 r5 t+ V: j% \& I
<lable>Character Name</lable><br/>( K5 q' ~! m" ^( u7 c  d
<input type='text' name='char'/><br/>" S$ A0 Y  N* J3 i8 n  l
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>& R/ y# _7 B( @# W4 F3 A% _% P, R
<input type='text' name='item_name'/><br/>
+ N9 R, u9 |' z" F! I+ ^4 H, e7 z! o<lable>Item Amount</lable><br/>" O' s' o0 |  u- l
<input type='text' name='item_amount'/><br/>
+ \' J# E, g: z<lable>Item Upgrade Amount</lable><br/>& l3 K3 j/ g& g6 P! p; l: O  a
<input type='text' name='item_upgrade'/><br/>* T  r6 H$ l# r: H+ L
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
# f+ P8 E2 s1 D/ c: Z' A9 U4 l! m. {& z0 n6 o6 ?6 B
</lable><br/>/ o/ s! l/ K) E" o! g
<input type='text' name='item_element'/><br/>) Y& k2 g& w, n: j8 r( h
<lable>Element Upgrade Amount</lable><br/>9 F; A5 ~& y' V0 W+ z
<input type='text' name='element_upgrade'/><br/>
9 N  n' |9 `" ?% Y2 L! l7 E. ]% P<lable>Pierced Amount</lable><br/>
/ f9 A1 F+ _$ S" Z. i<input type='text' name='item_pierce'/><br/>
0 ?6 W! |+ \& ~7 b) _8 c<input type='submit'/>
7 M4 k7 J( o: e0 s3 X* G</form>";
% p5 ~4 J5 E- f5 J}
; d! U3 }: p' ~! \; T
6 i3 ~) I; u8 p; O# I% ^% |function PostListener (){& m& T, F$ v, q% H+ v: K
//Add more post variables if needed and add them to initform() function aswell
6 V4 G8 C* [) m2 t- s$ g# [7 |
, P5 A1 N5 @8 A2 w################################
# N+ D7 J1 I5 T( H. Q$ a8 i##### Connection and Post ######2 H  ^5 j  r% @% z- H9 y
################################# P7 c  \2 z9 c2 g0 P
$name = @$_POST['char'];
& X1 Y% {* l* g, b( }# K' Z$ItemName = @$_POST['item_name'];0 V2 n/ b( U& s, P8 P6 V% G& f
$ItemAmount = @$_POST['item_amount'];
. {% q, Z. m4 j" }4 d$ItemId = @$_POST['item_id'];
' o5 l1 m& U/ U- d, l7 [$ItemUpgrade = @$_POST['item_upgrade'];2 ~7 t0 m+ H; s9 }) f
$ItemElement = @$_POST['item_element'];
2 |' z* A' a/ Z$ q2 J4 j2 g0 s; m4 O2 s; Q  O$ElementUpgrade = @$_POST['element_upgrade'];# X! b2 L! P" v) y- g1 h2 O
$ItemPierce = @$_POST['item_pierce'];
3 Z% T8 t9 ^. @& J8 b################################& a+ g% h' U/ j! e
" Y( R, q6 W8 k) {! u7 ^
//Check both variables for empty value7 `9 r  h8 b$ s2 R8 J

; g& ~* L$ D  s/ r$ X5 a+ vif (!empty($_POST['char'])){) Y2 L4 y3 s# h1 N6 j3 x
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where % {# n8 \  g$ e6 P2 t. Y1 y- X

# k# W! c- D: A" \% g' Pm_szName = '{$name}'");
5 _/ J; a; n1 E# j% B, k2 qwhile ($row = mssql_fetch_object($find)){. l& W0 ~7 w8 |0 y
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
2 S. J4 \0 J3 b, n$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
% J4 a/ s2 J' ^0 f- I2 e9 g6 i" [( V3 D; ]# W
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], - w1 Z$ M. t* n& S6 e; h3 p$ }. r

* |. e. ~6 S% j9 t( J[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
8 p$ z  F- v9 ]0 o4 u" n
) V8 A! \( n6 M: @! ?, ~5 dN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
) C* q& j5 o% q, w5 [1 t1 L1 J6 M7 A
'{$ElementUpgrade}', '{$ItemPierce}');");
! l3 ^( b8 Z% e& O}- r0 L# a% P& F3 y* ]4 x% a$ L& t
% r1 F* Q0 X3 }- j
}
5 y$ e4 `2 i  e% x  o8 z
9 A- Q" U, i: ]/ n- u}
& P/ N  ]8 \& I/ C: g! t( A: a: |
$InitForm = InitForm();
" [6 T9 F6 L6 k' b8 Q, k  Q% |$Listener = PostListener();2 S8 F: N+ I& q+ |+ d6 d0 @/ J
  r% c( v4 M, v) X4 m# f
?>/ o( \; U, s9 Z, P/ V, Z
+ D, x* j/ ?. |" ^  T

/ Q  J" W/ k2 E) |
  V& w6 x* E! M, X  g
& F  ^9 p. Y. b$ Y/ e
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-27 17:30 , Processed in 0.065540 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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