飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php1 I. k9 L& o2 x  [- V# s3 p
function Connect () {
. @9 V1 N! z1 v4 v1 b9 R% smssql_connect('Server','UserName','Password') or die('Error: Connection to DB
  S+ V7 p' @: A$ E" w- A. S+ A
2 a, s! v. a5 F( M0 C, c0 D4 k7 G; GFailed.');3 V+ [7 E0 h9 r8 y5 i7 U1 t: q! f
}
: @( r8 H5 }# [) a% oConnect();% o) x; q" f3 R- k* [1 [* I8 l/ |

& [, i  @! o) _' c9 m. ]function InitForm(){7 Q! f( P9 }2 q" t6 {+ L4 b
//layout for the form! Q: J7 Z$ V9 Y4 ]1 X. ?; A
echo "<strong>Send Items.</strong>
% G9 S. G+ W1 B7 H" p<form name='select' method='post'>, o3 H" x5 `! Q' w0 G/ j* ]8 t
<lable>Character Name</lable><br/>1 E/ D9 i+ j1 U$ }4 g
<input type='text' name='char'/><br/>% [! k& ?' [1 _7 c9 Y( B9 d9 B) M
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
9 M+ ?( L2 o' [0 J<input type='text' name='item_name'/><br/>
& S( h( A! j. S* c1 T7 L2 z/ r& \<lable>Item Amount</lable><br/>
! v% N1 X) o; |" g# t1 L+ t<input type='text' name='item_amount'/><br/>" S7 k( F% u5 |/ H# P) [
<lable>Item Upgrade Amount</lable><br/>
! u; ?2 ?+ z+ c! }5 q<input type='text' name='item_upgrade'/><br/>5 _! Z/ o( f) D/ x0 h) ?
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
  D3 w+ t: W! ]
& q4 ^' a" G3 b5 J* |$ D</lable><br/>  d3 ]( ?! L5 [2 H; F: i
<input type='text' name='item_element'/><br/>  i) v1 V! }' {8 l+ w" F
<lable>Element Upgrade Amount</lable><br/>
5 {0 D4 T6 h. j6 o3 b- u<input type='text' name='element_upgrade'/><br/>
9 a4 z0 N  L* g1 ?  \: D<lable>Pierced Amount</lable><br/># o% q) m/ o- c4 x( z) U! j+ l  h7 P
<input type='text' name='item_pierce'/><br/>  k9 c; x$ |6 S* ]
<input type='submit'/>
) C$ n4 B8 N+ A6 {: }  O) J</form>";
0 e2 c9 v5 C: ~. W$ R}$ X! b, C/ Y- i  y7 _# c- k( `
( C2 c! c+ O0 T: J' c  ~: ~
function PostListener (){
# {4 B! J% A% v- o  ^//Add more post variables if needed and add them to initform() function aswell
+ ~" R+ a' b+ x9 J, @; |1 y( l) {
0 w: Q' R8 [+ I0 F0 H' A. M9 ]6 Y################################
7 l) I0 S2 F- g0 D* Z) Z, e9 K##### Connection and Post ######" T9 @; N, F" I" @# r  ]
################################
3 g5 j5 o3 F* ^* P2 p* p# @, m& B+ A$name = @$_POST['char'];  L! F, r; \. B; O/ i! L; T
$ItemName = @$_POST['item_name'];
0 G+ }& B7 v* g8 ~3 F# f$ItemAmount = @$_POST['item_amount'];/ S% c  ~8 j9 f6 A
$ItemId = @$_POST['item_id'];0 C1 ^% m6 B. Z  J% M
$ItemUpgrade = @$_POST['item_upgrade'];
0 V/ X) r& m( |+ O7 O8 K8 O' p$ItemElement = @$_POST['item_element'];
5 t0 p- J- n* z9 l- i$ElementUpgrade = @$_POST['element_upgrade'];' }8 X, A2 i; k* {& M7 a$ a" E
$ItemPierce = @$_POST['item_pierce'];3 N( W+ L* ?1 p
################################  ^0 o' m+ |( P2 B& s, A9 @

3 A. W( p* x3 a//Check both variables for empty value
2 `% m3 B/ {* b  z. L% K
# |% C' L+ g7 m3 F) k; S' qif (!empty($_POST['char'])){% [$ z1 b6 n- R$ b1 @# l/ E7 f
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
/ O8 q% j, h  r" u- F, A9 d+ z
2 E# Y2 K4 Y4 G* mm_szName = '{$name}'");
; g" y; t% Q7 ]) d) I! Y7 cwhile ($row = mssql_fetch_object($find)){
& N3 Y% H6 J1 K% Jecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
  @9 m7 E, ?0 Y7 n/ \  Z) w$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], 5 |4 |( o$ y5 T& J. z

' B) H& c4 {1 Z  P[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], - D( z/ z& Y4 N! a

  }* W5 e! D- N. Y[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', ) b: m7 Z: y5 |. |( l; P6 X
' E* L  N$ x7 l$ z* k9 k( e& u
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
1 Y% u; c2 t4 c  b2 y8 q3 L: _' ~9 B; J
'{$ElementUpgrade}', '{$ItemPierce}');");
) M. _- o" [2 q- n}
5 y2 ~6 k, Q0 ~0 f6 H8 n# W0 z2 ~& \. `$ k8 l- o% k; g! a9 x/ L
}
, z; H% H  g* s' ^# I2 b! Y! k. I' O1 X% z: J# x, H7 v( D
}
6 x; X# \( S  R: a! x3 N6 U" g& a/ m! N
: u: r5 v, S: B5 O$InitForm = InitForm();3 O7 o+ S$ k7 E$ k
$Listener = PostListener();, N9 A6 ?- U# m2 |4 L. j

& r  D( b7 @# O/ i0 g?>
, P/ O4 t3 b& X/ t2 J8 b0 F- V
* h! S" f5 n, ?8 K) l3 K6 |/ v

* V) J, l9 Y' B% R3 w, ?$ N% k
2 E% _% U+ Q% R4 @; N5 ^
回复

使用道具 举报

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

本版积分规则

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

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

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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