飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
1 g0 P' Y  O) {function Connect () {/ F& L/ w9 P% U6 r
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
/ `* B0 s! K: @+ n" r& |5 T  z$ d  Z7 @1 g
Failed.');
1 R2 P; p( T' s' f9 k; G$ H}
0 m8 n. F& x6 T, w! yConnect();9 Y) W  `! k- @- ?. F6 z4 e
' ^7 A6 p8 n1 s# ]
function InitForm(){
; ~4 M1 [/ z1 o5 T//layout for the form6 [$ _* {3 I2 h, `  r- }) B" J( ~
echo "<strong>Send Items.</strong>( o( h& s7 E- g5 a( J
<form name='select' method='post'>
5 t; h( t: o8 S<lable>Character Name</lable><br/>& j( g0 C* p) D8 u
<input type='text' name='char'/><br/>- B$ q: W; l* e* q! y" q7 i& Q
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
- A* }8 _/ Z/ @) _<input type='text' name='item_name'/><br/>4 V& ^0 j+ d( N" m3 ]7 |
<lable>Item Amount</lable><br/>( Z; e( i8 q; s& Z- R
<input type='text' name='item_amount'/><br/>
6 A" l: I% u+ h0 V<lable>Item Upgrade Amount</lable><br/>
: S5 A% L& b# U( w! D3 E; P<input type='text' name='item_upgrade'/><br/>1 D/ Y7 m" @, \
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)% s7 E1 k2 A, E. T$ ^

' f2 c9 ^) J2 s/ f</lable><br/>
4 g& j7 H- W) m' ?2 Z+ R<input type='text' name='item_element'/><br/>
/ n9 t0 v; H! ~) F! n/ m# q<lable>Element Upgrade Amount</lable><br/>
* U6 c$ p8 Y. J5 f- o  _4 f  N<input type='text' name='element_upgrade'/><br/>- v" [4 y, k. G7 G! q. _6 u
<lable>Pierced Amount</lable><br/>! h1 |9 p0 F$ j/ ?# j; M2 \
<input type='text' name='item_pierce'/><br/>' ^( f9 [5 v+ x" B% T2 K7 d
<input type='submit'/>
6 e6 p9 m& d6 n; i+ p1 o. X% u</form>";
4 i) _2 }5 X$ K1 C' W6 }+ ~' X% y}! }) P+ z. B2 K# @, h( n

: @/ H) m/ E$ S, ^! u1 afunction PostListener (){$ c0 {9 d# L2 e0 S' }
//Add more post variables if needed and add them to initform() function aswell
( Y2 J( b# i; h" N9 J2 ~; E/ |3 ?0 J  ]: C/ }8 x
################################
( D6 J) y2 I1 {' p6 J##### Connection and Post ######
) v3 {7 M) L$ P; v" y$ T- e, w################################
$ F0 u1 h1 J" x; k  |$name = @$_POST['char'];
1 ?1 |# X  a7 L$ `/ j# p$ItemName = @$_POST['item_name'];
) ^# O* s% F- s; O" v' h$ r$ItemAmount = @$_POST['item_amount'];0 i. e. ]+ I0 @9 w2 O6 Z7 y
$ItemId = @$_POST['item_id'];
* f9 P, T6 R/ A) w$ItemUpgrade = @$_POST['item_upgrade'];
9 ^: ~7 t' k' R% o% V$ItemElement = @$_POST['item_element'];; y1 `; h, H$ ]$ N! l; w
$ElementUpgrade = @$_POST['element_upgrade'];  t) U8 ^- j' u( q
$ItemPierce = @$_POST['item_pierce'];
9 y) x  i/ ^7 f7 f, ]& N' |################################9 q! I. D! n% G% `% T4 V% k

' d) F0 h& Y) v7 T# B) e+ c8 ?//Check both variables for empty value* @% O( d0 B8 l" W

. `2 E% `( n: y4 u/ i1 Y" oif (!empty($_POST['char'])){, \  s" ^9 @2 e! k
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where $ ]) L5 T- l/ E) f9 z2 w

3 Q  d) S8 J# x  km_szName = '{$name}'");3 P) o5 c" V! y3 i( d
while ($row = mssql_fetch_object($find)){
9 z8 l, X: P" Lecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";! N, Q) P9 X: ~/ o( b
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
4 S. u5 u) E/ x, p& Y+ s( o; x. f: J- b; s( k, ~8 j
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
% c6 O4 q" l# W7 p# N4 e* N6 ]7 H/ A. x5 \/ ~7 j" U3 g
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
9 D/ G7 F: Y6 d8 Y
% B$ ~( I  E4 O0 CN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', + ]  t6 @# _5 r3 q! X

% p6 y, Y; ~9 _+ s  f' E( R0 s) I'{$ElementUpgrade}', '{$ItemPierce}');");& i4 F2 @# a. e3 K7 ~5 V' Q
}
# y2 I& T6 h9 j6 j& k: P* O, I$ Q, V
5 n$ C) C, q* f3 H% n+ O8 V}
4 S8 U" x- o  r6 a" i8 b& j" b' h: H: T: G2 U2 X# T* X
}
6 A; J5 y/ c- r0 ?  ~* L6 i" {/ r3 R; k# o* }' a
$InitForm = InitForm();) V( K0 B9 c' \" [2 O
$Listener = PostListener();  F4 y# f  y! L

! s4 R9 ~$ F* m5 r4 f* J?>8 {" m, y, Y# r# O- j. O4 H" r; u

: H$ v4 G$ c0 n' `4 Q+ E" ?9 ?. B8 k, `
: O* K) b/ m. T3 i% g! S! x
6 J& @9 Q: @* V( V7 f, O
, ~9 h+ Z2 V/ P- `4 \$ e
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-12 23:04 , Processed in 0.062982 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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