飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php5 c) b$ L% c; }3 _: a
function Connect () {
8 s5 G: P; j2 Q- }0 p7 z- imssql_connect('Server','UserName','Password') or die('Error: Connection to DB
9 I6 x' X/ R; E+ [6 e; w$ C" H, q: ]2 n1 M; ]; F# z& I
Failed.');4 C! ?# `1 k/ q/ N
}
1 ]1 u7 z5 x% k9 W  r5 ]Connect();; _5 ]! u- \7 m3 y

1 f5 s- K! b' m3 k3 tfunction InitForm(){
  `* t" x" y: a$ K//layout for the form
2 P  Z) x8 [6 O1 Becho "<strong>Send Items.</strong>
4 E  F3 r) v. n<form name='select' method='post'>* Z: M+ j! V4 ^0 N2 D
<lable>Character Name</lable><br/>/ ^7 P9 @. y/ M3 y
<input type='text' name='char'/><br/>
7 N6 C0 t4 B, D/ F0 U; H5 T<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
  p2 x/ {' m1 \+ u) }/ B: ~9 ?8 s<input type='text' name='item_name'/><br/># e& \" m. ^& r# Q6 d
<lable>Item Amount</lable><br/>9 D8 v. C2 d) c
<input type='text' name='item_amount'/><br/>
2 l" R: n. C4 U) K0 v<lable>Item Upgrade Amount</lable><br/>. q+ o( P* U. o1 P, }7 B4 w" w
<input type='text' name='item_upgrade'/><br/>9 f& f/ y# k" Q- K0 }+ e
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
1 A0 m8 l* p1 r7 c6 x( F. H' C1 w, v! Z" {9 L6 K8 J9 t$ Y1 C6 l( N
</lable><br/>
3 N4 S$ _: {9 {) |: c! g# F<input type='text' name='item_element'/><br/>( U0 ]1 E4 g/ ?* r1 m
<lable>Element Upgrade Amount</lable><br/>
8 ?8 ~( B% `" m4 {<input type='text' name='element_upgrade'/><br/>) h7 H7 k  C- [2 J- s
<lable>Pierced Amount</lable><br/>' s/ M' M' D) {/ V. P
<input type='text' name='item_pierce'/><br/>
3 Q. o' U2 N' W. H+ l/ U& [! Z<input type='submit'/>
( X4 Y, z/ w0 v) e2 s5 Z</form>";
+ X+ G; Q8 d6 W}
) v$ R; @' F2 h  o, p0 f$ i0 P
1 d% E1 y: d/ ^, tfunction PostListener (){4 u: ]" x- C* I$ \' G# ^
//Add more post variables if needed and add them to initform() function aswell0 W* I# r' J! {9 W; `0 v2 n

4 G5 g/ M+ W# ^& x8 r) B################################
- v  \8 z9 w4 C. W4 C4 m5 ]: K##### Connection and Post ######
, C3 @9 @0 f8 F% m, ?1 }2 ^################################# h& L5 J# f) t4 u) @4 Z, N! D- l
$name = @$_POST['char'];! ^' S, |# m9 Q8 u& E. n# I
$ItemName = @$_POST['item_name'];
9 B3 j, V8 L' K) H% f) z- T$ItemAmount = @$_POST['item_amount'];  m$ o+ Z5 Q/ d) Q
$ItemId = @$_POST['item_id'];
1 {0 R; Z" S7 V$ l$ItemUpgrade = @$_POST['item_upgrade'];
2 h. v$ }6 G0 J0 U6 |3 ?0 I$ItemElement = @$_POST['item_element'];$ ?0 i6 [1 U4 E, t' f- G# k
$ElementUpgrade = @$_POST['element_upgrade'];. _7 C: T/ q, h; G; ^) }
$ItemPierce = @$_POST['item_pierce'];
  i1 l1 k, @, f$ c################################9 B9 S, I$ [* M4 p5 p5 D

7 p( b2 b! J' V  e% u/ x//Check both variables for empty value
, b+ p) B  W% Q! o& q  b% v1 S% R' f9 B+ ^& M6 m) g/ ~+ \( L5 d
if (!empty($_POST['char'])){
; ?/ S7 d9 e1 Z: P' Q4 f9 P) W' s$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where # x4 f$ t6 L! W( h& b$ w

' p/ ~) n' x; Q1 y7 S0 Dm_szName = '{$name}'");8 e: o( T- K" h! w5 o+ f8 J
while ($row = mssql_fetch_object($find)){) e2 h  U" S5 a  y
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
  C6 n$ l0 N: I( i' w& B7 N$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
9 j- Q: b/ l) S: _9 M2 d* D; Z
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
$ B& T4 T/ V( j' ?" t  z1 H  u3 K* P+ _6 y
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', 3 ]8 }4 e) V# d7 W, F! {2 c& V
2 Q( W2 J' F+ @# n' O7 Q' C
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', - e  {1 ]" U* w0 h; A( b$ \
2 A6 f: Z# t$ N6 q
'{$ElementUpgrade}', '{$ItemPierce}');");
* ]1 F% x0 E$ y0 g}
& s5 u% E, f9 y2 r! R0 A* J. D" w8 L) i* ~
}
" M9 E3 Q/ M4 Q- r% O4 T* k4 y( G* O9 t$ {9 z+ ^# C8 q
}8 G" t! B7 Y2 f0 _6 N2 y$ A
$ N. Q# ]: q2 \* c: |' @
$InitForm = InitForm();7 H+ @" V$ @/ H' u1 F9 K
$Listener = PostListener();% w$ c: ]3 B, x3 J5 y. A0 f3 {6 |5 @. k, Y
# T( O5 x+ s: ?) n: I* D1 c) X
?>' u- i. |- U6 |9 g5 u
+ i" L1 A! m2 y

! k! v5 x" r. z# v" `( Y" {
( C3 l9 @( ^6 L% D
0 n2 O( q( e3 E" m. |
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-11 14:03 , Processed in 0.078864 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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