飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
5 k) U6 ~, y$ Q" y/ z  Kfunction Connect () {
5 c2 h; W8 d5 D1 U' E) umssql_connect('Server','UserName','Password') or die('Error: Connection to DB
; O% o) a. z1 {) V/ M% j! m, h) i" O3 \5 w. {; L9 C
Failed.');
. S9 w- A  Q" `/ q) f}
' n  G& k3 B1 @$ r5 lConnect();4 X7 t8 X* G7 T+ A

2 S+ h9 f% N4 L" z' z8 s3 @function InitForm(){
% Z! k* n- r: e/ Z//layout for the form
' r1 F  {2 e* t; k- {. f) ]echo "<strong>Send Items.</strong>, T% K+ g) L. X$ h6 ^
<form name='select' method='post'>
" x: s% e! w9 z; H) W, z" R<lable>Character Name</lable><br/>
$ J3 }0 {4 }! }: U& \<input type='text' name='char'/><br/>2 h& P4 x4 {' v- A
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>7 u0 x0 ]) k% S2 z: b: D
<input type='text' name='item_name'/><br/>& \2 m2 t# }' Y4 |! C' o3 Z
<lable>Item Amount</lable><br/>
; V, o3 ]: W4 g6 ]<input type='text' name='item_amount'/><br/>
6 g! O4 A  O6 U6 `$ E1 D<lable>Item Upgrade Amount</lable><br/>
" N' E4 D( v- |: n! {<input type='text' name='item_upgrade'/><br/>* h) L2 I. o1 v
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
5 R- f# C& y/ ?7 ~6 J0 s0 X( S3 K" \8 o
</lable><br/>+ @& R5 ]2 \5 A/ q% u2 x5 o
<input type='text' name='item_element'/><br/>
; x# U/ {, H% y" r<lable>Element Upgrade Amount</lable><br/>; X1 L% c: p: i7 b; g/ H5 Z
<input type='text' name='element_upgrade'/><br/>! O& t! B/ J7 g0 x6 v
<lable>Pierced Amount</lable><br/>2 ~1 ?; c1 e3 M1 g; N. @
<input type='text' name='item_pierce'/><br/>
7 f8 |6 {5 N- |7 v<input type='submit'/>
0 I  K4 F, T" D$ }9 R</form>";( d" w3 w3 o3 p/ V5 E! y/ H
}
- Y# D$ {* j1 V9 z9 U! {7 K" X
/ X0 p( @" @0 g5 Q, j1 O7 F. n$ Lfunction PostListener (){
# ?$ ^6 O; I1 A' g//Add more post variables if needed and add them to initform() function aswell
# L6 e1 C; i& O: s1 F2 Z% M- e; D8 ]! ]0 K( K
################################3 `- c, d' y9 G$ y& e6 A7 t0 s
##### Connection and Post ######- f3 G+ c1 p3 P- d4 J
################################0 T7 x' K+ w4 f# M1 y% P* ~( g
$name = @$_POST['char'];
" T1 _; z5 \* T' ]& V# E$ItemName = @$_POST['item_name'];* a4 q0 p& X" o1 E
$ItemAmount = @$_POST['item_amount'];
- X3 b' m1 j6 p- T7 X* G$ItemId = @$_POST['item_id'];9 v$ g* [* M7 J# t
$ItemUpgrade = @$_POST['item_upgrade'];
" K  {- P. w+ Y% C3 T4 D; r; M$ItemElement = @$_POST['item_element'];
1 B: w  B) P, B. X2 Z, L; j2 m$ElementUpgrade = @$_POST['element_upgrade'];
+ \2 r/ G6 z+ N2 ]# f$ItemPierce = @$_POST['item_pierce'];! d9 |+ j, J8 e8 ~
################################
* I* Y% ~1 z! g! o' i: |& n! a
/ y7 p1 p/ r& q' _//Check both variables for empty value
: n) U3 x! x- l5 z/ v9 u  o- S; |; a4 N
if (!empty($_POST['char'])){
0 P' n" m* s' A& I$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where " b0 g$ q, D& i5 L
7 B) u4 B" w) V& S5 }4 R: c
m_szName = '{$name}'");. w. L# t# P6 R' J. @
while ($row = mssql_fetch_object($find)){
8 m  }5 k$ [' o  j+ cecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";9 x9 N' M- `& t7 h7 Z
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 7 z# O4 J) R; M: s. X- F0 ]7 c
, q" G) \  X' ~' O4 a3 R
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
! w# s0 U9 v, |! ^& F8 l  u( U2 v: b/ K! c8 I
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', $ `' _6 Q! V" J2 [& ?! p" E

6 Q# y! I" j$ O+ RN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
9 W- a9 {+ Z: X+ Z; o# {; q* n( Z0 N/ J8 C  a9 N% K$ W4 X
'{$ElementUpgrade}', '{$ItemPierce}');");
% P1 ?- C. |( ]( J}6 Q( m5 c- T" Y6 n& {

+ W$ R0 ^1 a9 a- d, ]1 u  X}1 w3 o( P% X9 y3 Q0 k( _- ]5 R

% i, U; w7 J( q" w9 [" [! N& S}0 G1 a; x6 x3 r' b) \, L) y
8 `( h6 Q9 ?! M' f- \# r8 ]$ }/ k
$InitForm = InitForm();
/ t5 K) J4 o8 T& m) ]" D8 t$Listener = PostListener();
" D6 [, Q3 A6 H( x$ m0 X2 q( c0 u, @2 J" V% s/ R: c& h
?>
% L' ~) ?' a# l, Y8 j1 s( D
# \% q0 |& W. U, y* [: @: d7 v. S
+ ~$ c0 w% \) p
1 V3 b( j# z9 o; D7 a% a- j' [
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-12 12:56 , Processed in 0.074172 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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