飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
0 o$ X4 c5 E/ K, U0 o  sfunction Connect () {
0 t& }* r) w1 Y1 lmssql_connect('Server','UserName','Password') or die('Error: Connection to DB
; ^( F% G& w2 C: y1 L( O- D" D  I5 ]/ K8 c
Failed.');( _% }% {2 B; T/ a) ?  R
}
* s; \, f: I2 M$ {1 w' R, h2 S7 YConnect();9 ~$ _2 H3 c  a4 R6 K8 r, \. c; B
* B# d0 a0 p- e
function InitForm(){
0 [0 Q- ?$ ~" c, G7 Z//layout for the form
' V: u) E% B' Zecho "<strong>Send Items.</strong>
- ~( _% v1 R/ V2 k: p; T+ u2 ?# a, T2 i+ X<form name='select' method='post'>8 \' `% O* N, H: Y- f- v
<lable>Character Name</lable><br/>
; H' f2 `. Y; U( |8 B& E' B<input type='text' name='char'/><br/>8 y) _+ e) y* `* H) b
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>" n2 a+ `9 d9 f8 y/ T' o
<input type='text' name='item_name'/><br/>3 ^/ E$ b& r3 M* `  |, w
<lable>Item Amount</lable><br/>: z2 O1 v- O" C
<input type='text' name='item_amount'/><br/>
; z& |: [5 U3 D<lable>Item Upgrade Amount</lable><br/>% l; O8 o8 Z! l( f! R+ q: K" D
<input type='text' name='item_upgrade'/><br/>
. |1 s. Z& ]. `% X8 |: I<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)2 w; n' [4 p1 ?3 @  }8 \& b; a

% `3 D! C1 |6 U+ u</lable><br/>
# D% a, Q- I# P3 v; _0 {<input type='text' name='item_element'/><br/>! r# N: z3 ?1 y) S6 H
<lable>Element Upgrade Amount</lable><br/>
, r) K9 a% V! t/ V# l<input type='text' name='element_upgrade'/><br/>
' V3 C7 ]/ E5 L. {<lable>Pierced Amount</lable><br/>
5 X6 v0 D  b5 L7 R  T' J2 H8 E<input type='text' name='item_pierce'/><br/>
5 L( z8 |6 B& w4 D* k<input type='submit'/>
" U3 z5 s- l' |' q& b: K* m. e</form>";
0 V' Q1 h( ]0 Q/ H! v' }}
, o: R  o# n: Y1 ]: n0 W7 \3 Q, F6 @* G2 w
function PostListener (){
. T( q" p, _# u: s4 t//Add more post variables if needed and add them to initform() function aswell4 ~* x/ P4 K" W% S

" L4 O5 x# b" W1 f################################6 q. R2 b4 i+ V/ b  A7 P
##### Connection and Post ######! F! T/ B, E& s& ?* }: l6 T( K
################################
. ]3 u  `6 y# b: s; a$name = @$_POST['char'];5 {* Z  B, L- v
$ItemName = @$_POST['item_name'];  T% I! c+ C9 ~7 X* z, S/ H
$ItemAmount = @$_POST['item_amount'];
9 `' K9 E0 M& D( F3 @% K* K$ItemId = @$_POST['item_id'];
" \' v* M3 ^* s( K! S/ F$ItemUpgrade = @$_POST['item_upgrade'];
7 a; X# w/ h+ \  i$ItemElement = @$_POST['item_element'];
- N0 I  |- ^4 F+ E' D$ J& E$ElementUpgrade = @$_POST['element_upgrade'];
: Q: B" D! G! u, Q. z6 r) e& V2 z$ItemPierce = @$_POST['item_pierce'];# j1 D, c" t8 S1 P- b# P( ?0 E
################################+ d6 |! ]2 B6 K2 L1 s$ x5 ?

) A) W& {4 U( }) n5 `/ G# K//Check both variables for empty value
/ `7 t: |+ K( F, ?! k
% o2 ^2 l2 N) q. m* bif (!empty($_POST['char'])){/ Y7 N8 O) U/ Q" x# E; p7 q
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
) D  h* }0 [  R" V# i( U* |; |3 D. Y/ E( o0 b2 q( B
m_szName = '{$name}'");- k% Y6 T% `: t7 M0 M+ L
while ($row = mssql_fetch_object($find)){
( j/ L! Z  w8 Qecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";9 y( I6 X" I6 V; D! f, N
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], / J5 R* w. }- s& z3 }
( N3 A5 L4 F; {  b
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
  u+ H8 ^+ E4 C+ k' W! h# W( w4 u- R% s2 v( q" _
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 3 n+ {/ a/ n5 A  J! k

( `" a' r; V& L7 X$ jN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', 7 C) H! A; s0 s& o2 p* r

0 ]8 P) V) w, U+ @% ?'{$ElementUpgrade}', '{$ItemPierce}');");5 V/ w/ A0 a" E% G/ l
}
6 k9 g8 }' Y$ E1 t9 D$ ]6 ^4 l- z
}$ N/ E, B) k( c% K- Y0 ?7 `
$ U3 M% E, n* F
}3 W6 ?3 B) E5 q- c
$ P# j/ O! L4 M4 P: [
$InitForm = InitForm();
/ f5 u9 t* o! X# o$Listener = PostListener();
5 C, _# g/ j  Z3 E' Q- a9 E: |
4 Q. W, z  C1 F6 c5 f?>7 c2 z2 w; N; o# I
; k7 Q& Y; ~5 ?
+ j8 L! [6 }  ~4 ?) j
4 k0 }( U/ y( Q3 O5 C

5 q. R8 d2 t! B) d1 p8 f
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-12 09:59 , Processed in 0.077928 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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