飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php6 O+ o1 z  M2 x$ t: O6 y/ R- h
function Connect () {
. Q8 e- l4 `' J  Q1 [$ ymssql_connect('Server','UserName','Password') or die('Error: Connection to DB 3 }' u/ T( v3 F0 F

  t8 E  f) k( L' b# nFailed.');
0 @2 o4 I$ T- a7 I7 E2 J4 D}1 j* m9 W" W/ m4 d+ z% ]9 c
Connect();
6 i' i5 Q7 b& Z. ?- ^8 w. b$ ^$ M2 Z' w7 t4 E, C+ e4 T
function InitForm(){
# _# b: Z$ y) |  i7 Z  w9 g1 m; r//layout for the form6 p7 @4 {+ G# n8 e& T0 A# H  m
echo "<strong>Send Items.</strong>! ]% v$ b$ `  ]; }* a
<form name='select' method='post'>% a& M4 y1 U& W
<lable>Character Name</lable><br/>
4 S/ c' G) ?% \* n<input type='text' name='char'/><br/>
1 O4 g) W' Y' a# z% w<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
( g8 V8 Z3 V9 o% A<input type='text' name='item_name'/><br/>
. _, h& Q8 i6 X9 f7 M6 Z2 y<lable>Item Amount</lable><br/>
( z$ y: x2 r7 j, V# n<input type='text' name='item_amount'/><br/>
+ A2 k3 _/ F4 x  u/ R' [) E& |5 x<lable>Item Upgrade Amount</lable><br/>4 k1 ~$ p$ ?! F! C8 Z! h, D
<input type='text' name='item_upgrade'/><br/>% |: D* @# f& `) W- K
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
# T/ U# H# C* I( O: j
0 j) h0 ^' C2 W. Y! s, }</lable><br/>' I6 M+ W  M2 X* M2 H& a% O
<input type='text' name='item_element'/><br/>" B4 [$ u# g2 k  c% Y% W' M
<lable>Element Upgrade Amount</lable><br/>% G1 l" x; l6 H1 h) \5 @. p& Y  b
<input type='text' name='element_upgrade'/><br/>
" M4 H0 M- ?& M  H* g4 L<lable>Pierced Amount</lable><br/>
8 o' i: e- O% o) @- G. B1 ^& w<input type='text' name='item_pierce'/><br/>: s1 A% `+ @% s& C$ C* k
<input type='submit'/>. q. N1 L- `3 w0 c8 r5 p
</form>";% ^; A, r7 O8 [/ K, M4 S; R( O
}
9 K% ]& h) E; @8 L/ l! I
# [1 I: m' X1 r) {# F; }$ ?function PostListener (){
; |* L4 K5 B' \& L' W//Add more post variables if needed and add them to initform() function aswell
0 ~% s8 `& w" n4 |4 x
# A% A) X. B4 U. \" v################################
8 ?& }  R+ S9 [, X6 c##### Connection and Post ######: S7 ~0 {; V, H
################################6 k" m& k1 n/ m( b7 y  u4 \
$name = @$_POST['char'];; V. X1 _. }. _& {  Q
$ItemName = @$_POST['item_name'];
6 b& ]" ], o: r; ?" b* g; I( j+ F$ItemAmount = @$_POST['item_amount'];& z2 ~% G* ?4 w: t( [
$ItemId = @$_POST['item_id'];
+ A) H1 ~4 M( G8 M, h. B$ItemUpgrade = @$_POST['item_upgrade'];8 K( c' r2 k% b3 [! q/ x) \8 n
$ItemElement = @$_POST['item_element'];4 B; ~& v' d5 V
$ElementUpgrade = @$_POST['element_upgrade'];/ W, d( w$ D/ R. y$ Q
$ItemPierce = @$_POST['item_pierce'];
* [& Z! V+ w! n6 ^7 S################################
0 b4 I" b3 r' _* X7 m6 |3 t" `4 c+ m
//Check both variables for empty value5 o! W! ~" y8 B# ]% z  I3 ?7 T

  x1 [9 S9 b5 s, j5 d" }* Yif (!empty($_POST['char'])){
4 J; x" ?4 ^0 g5 D: \; N% o$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
& H: \: l6 D/ p, ?
6 M- j6 C1 \0 H9 o6 nm_szName = '{$name}'");6 O9 U( t8 Z7 b: d
while ($row = mssql_fetch_object($find)){6 ^& w0 `$ k$ C1 A2 P) N0 [3 y
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";5 ^3 y9 q* W# ]( ~0 Z* h! k2 F
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
' {3 P7 a8 E& N2 b: I9 q# f4 t$ r% ?( b# U2 o: z* T" O# Z/ T
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], & P, I# \" ?# K/ ?9 o& R- m& q
- ~9 F, w& Q7 O, T4 Y
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', ' H* T1 r1 o$ L$ _9 {0 g

, P, J; i: b7 w! t( I1 pN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', * `; C. J2 s6 O: o: X5 l: o

' v! \4 F5 J4 Z: X'{$ElementUpgrade}', '{$ItemPierce}');");
+ l9 a2 _( ]$ U: S5 X3 U3 Z}
  ~2 m1 k; ?9 d& c3 |: ^8 K# x0 l, R* Z0 G+ Z4 t
}8 U7 w* u& _2 N: l" g

: }8 o- e7 Z/ N- E- T8 v1 K}  m. m9 [' P: E: E7 Q7 ]/ A

9 `; a/ k# c* b! j0 A! [$InitForm = InitForm();
& U9 l0 k" o5 c% k1 t3 r$Listener = PostListener();* P( @% h1 k& x' A6 \; r

$ H  v" O4 Y% f?>
% D4 z" N/ {- Y9 R) ]( X
; H) R$ w; s  c) s) n
9 Q( M- r" p/ _3 X- k8 N( [9 e# b2 _& @( h* f1 Z
+ w+ R4 U/ d- E1 g, y
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-14 00:10 , Processed in 0.062260 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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