飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php2 w* m6 C- J# b  A( ]) B
function Connect () {2 d' Q4 J$ E% u9 g% F0 k4 l
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
6 _' i) }9 ^, [2 E
9 o5 {* M0 q; U* u* ]; u9 GFailed.');- m! h1 G- e6 j9 T
}3 B4 b3 b: i9 W" v6 ]
Connect();
7 V/ C  g! `( a9 m" f
5 O* @1 c" b' S4 Y1 Tfunction InitForm(){/ s( t( ]* R% z/ d: ^
//layout for the form
! v# L$ Z! W9 H8 r& Hecho "<strong>Send Items.</strong>
# q) U! a9 \6 K) _3 C8 l<form name='select' method='post'>! f, F/ d; ]  e& _
<lable>Character Name</lable><br/>
0 }# t% L  r; |% r& j6 v  f<input type='text' name='char'/><br/># |0 B* k% Y6 M/ S3 U6 G& x( O
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>5 B/ |: x9 J/ Z7 }4 D" d
<input type='text' name='item_name'/><br/>. l; }- p0 U' o  }  j- ~
<lable>Item Amount</lable><br/>
) u! _2 P& \8 G% \/ d<input type='text' name='item_amount'/><br/>
  S# V( D, F* M1 L<lable>Item Upgrade Amount</lable><br/>' R& X* K- I& B% `
<input type='text' name='item_upgrade'/><br/>
: ]. b. M) O) D8 O<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
! M6 c6 Q$ y; D0 F0 a& j5 R/ k! V2 ~
</lable><br/>; m7 \& u/ c. X) ?0 [; n
<input type='text' name='item_element'/><br/>0 ]! W8 j+ b% k1 d& l! _  ~
<lable>Element Upgrade Amount</lable><br/>
1 }! D( F# }) Q; K' ]; F! J$ l<input type='text' name='element_upgrade'/><br/>
8 v$ z! R0 Z) Y  ^2 S<lable>Pierced Amount</lable><br/># S( i( b/ c. T
<input type='text' name='item_pierce'/><br/>
3 B- n& j8 ~: W' g$ {<input type='submit'/>
# w  C! m: g; O# Z% X' m: S7 M" E</form>";0 _9 B6 K  C8 h3 S/ n1 L
}+ P6 Q) ?  ], |
' u% e2 n6 v3 H
function PostListener (){
% R+ I" M4 s# W; V" F  a  J//Add more post variables if needed and add them to initform() function aswell8 _, F) q5 P1 j

# I- [' B( k5 K3 c7 U. ~! |################################
' u% z( N1 A9 `' G0 ?##### Connection and Post ######
( l2 D; ]; ]0 i( W################################, a+ F% P7 a9 `3 F7 m
$name = @$_POST['char'];
; B( k2 T# v  h% ~- \$ItemName = @$_POST['item_name'];2 ~+ `! E! A7 x& b4 c
$ItemAmount = @$_POST['item_amount'];
+ Q, I- d+ W: b; N9 L$ItemId = @$_POST['item_id'];; S8 f/ V% w% X/ X. s
$ItemUpgrade = @$_POST['item_upgrade'];
& x; h$ t+ n1 z1 z' p8 X$ItemElement = @$_POST['item_element'];4 S! C: G& }; R3 ~& _
$ElementUpgrade = @$_POST['element_upgrade'];% K/ a' A9 L& w1 J  W
$ItemPierce = @$_POST['item_pierce'];
- m% [& t1 Y* m5 `' c# x& X################################
! n( Y7 i' U' P6 L) C, s6 k1 x* i, P
: V' L& g" }7 ]0 V//Check both variables for empty value
* R  H2 D8 {" j  y- n8 l
: ?8 I4 b: P7 r" ~2 xif (!empty($_POST['char'])){
; a% Q6 z3 I( T/ q& h0 |( m$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
1 S8 H* m' }; P8 P9 D. H  H
$ V+ a' A" f: [- h, R) G5 Um_szName = '{$name}'");0 X3 l8 @2 ~- _$ P# h$ {) _
while ($row = mssql_fetch_object($find)){% s0 m& N! P8 c8 @7 @$ [7 K
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
5 t6 V$ }4 ~# E5 H" N$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer], * Z) [# P. |, P1 ^9 R5 ]- k' i

5 U) {) \! K5 r0 b4 C* t* P% j[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], - b: f, D" R+ L8 O# `7 y
" t4 `9 V9 K, c8 B3 T2 S3 y
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', * ~" U+ y; }; e! e# T& y; F
! K: p- V% q4 J* c; B+ p$ Z
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
0 R5 r) `* p9 h' @- n6 [; W( K9 |$ }6 {- U) d1 t! m7 C* F: g
'{$ElementUpgrade}', '{$ItemPierce}');");  Q( B0 s- j& |
}% ~- S/ E# A  T4 c; H
, Q0 ?$ f" c" \% L! {
}# c+ q( l  [% x$ t
7 w7 ~  p- y9 V
}
& i* S& T  Z* ]) C% }4 q; r0 o" g* Y. |8 s/ ^3 h1 g" H
$InitForm = InitForm();
7 Z* f; \. x( \* j6 |8 |1 x$Listener = PostListener();
3 y0 P. c1 y6 Y9 D) @4 o2 i& b1 y$ Z9 L4 E7 N
?>0 J0 P- d5 T& V, c, ~$ u

6 D, p6 Y, m1 Q8 p! s) H. A: B) N" Q! w/ \5 N) w
& ~4 S/ \% s& d; A+ _8 G6 e9 ~

8 u9 J+ A$ Y/ r. @. V0 K1 t
回复

使用道具 举报

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

本版积分规则

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

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

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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