飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
( {0 c. l3 q( S# b0 @6 mfunction Connect () {
2 s7 a* ~, O  {4 |mssql_connect('Server','UserName','Password') or die('Error: Connection to DB 5 G2 A+ s; s% C# d6 d( A! n

* b  n* S0 `+ V8 }Failed.');% N( X2 ]' i: y% |; ?$ D
}
& A9 K* B/ T8 \9 y4 X' lConnect();
9 M1 O- Y, ?& v9 m7 q- n/ {2 e
# m! Y% B4 K2 P6 Jfunction InitForm(){
& T, v$ m$ ~3 c; h9 |( z6 g//layout for the form
8 {3 M7 _( o2 L: U! I* Eecho "<strong>Send Items.</strong>
4 k" t. }  \  G5 j9 {8 _+ X3 a4 o; y<form name='select' method='post'>
# q7 q: _  X* ~/ g* O$ S. m<lable>Character Name</lable><br/>1 L; Q* D! Q% p, B0 B: b) t* s0 ?  y
<input type='text' name='char'/><br/>
: @& K. E8 D9 ~$ |& ~. T% Q<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
! y/ u% r. q2 u. H! f- u+ x& h<input type='text' name='item_name'/><br/>( T$ q# g9 V3 r. t
<lable>Item Amount</lable><br/>' z; y: c* A  u' k5 T6 Z8 K) c5 p2 C
<input type='text' name='item_amount'/><br/># X7 y; q& E- ?/ h! {7 z/ a
<lable>Item Upgrade Amount</lable><br/># T* T! l$ E5 q* \4 c% c. m7 M: e& @
<input type='text' name='item_upgrade'/><br/>
% w' R" a! v0 x' p4 X<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)+ r$ l$ p" y' {* L/ L/ k" S% i2 L, X) Y
- e6 |$ w/ ^/ Z( b1 [- ?. V
</lable><br/>8 i' l8 @0 X# k: [- D1 O3 [
<input type='text' name='item_element'/><br/>
! K+ \# b2 k, R( C, W4 i7 B<lable>Element Upgrade Amount</lable><br/>
9 E) ~/ ~* {- C<input type='text' name='element_upgrade'/><br/>
. G! w- I7 s1 S  ^0 Y8 W<lable>Pierced Amount</lable><br/>' T1 X6 D7 d" A! e
<input type='text' name='item_pierce'/><br/>- F! @% t2 m  R
<input type='submit'/>
0 M  x( E9 a( j/ p</form>";
+ S! D5 a% }6 s5 S- y}
. @1 z4 P; t5 `6 ?1 [( N6 _% ~+ Z( i9 a/ d# s: l
function PostListener (){
  S" e; D5 ^. M# C$ e  a//Add more post variables if needed and add them to initform() function aswell1 C# f9 \$ a2 P7 ^
# t0 w5 W: \# S( B% O3 ]8 _' v- |
################################) w: |1 |+ p0 |3 l7 B  Y4 _6 j$ F; e
##### Connection and Post ######
' F2 L! l1 @% Q( U3 }6 z################################, ]  ]' x9 g# H0 g# [/ E
$name = @$_POST['char'];
0 K6 w: E) P9 U1 G$ y$ItemName = @$_POST['item_name'];$ n+ a6 M, L1 M7 D, h$ r
$ItemAmount = @$_POST['item_amount'];( {* [# g4 w. N& f$ `
$ItemId = @$_POST['item_id'];
% l9 q; n% A4 W, ^$ItemUpgrade = @$_POST['item_upgrade'];$ V# A* D5 r' D1 C+ b& ]
$ItemElement = @$_POST['item_element'];& n& F3 `& T0 y
$ElementUpgrade = @$_POST['element_upgrade'];
6 I% f2 t7 {/ _; s$ItemPierce = @$_POST['item_pierce'];
% E! @. [$ t- M2 J5 U( y/ t################################$ U! j' K! O) L" Q
3 d& H. [8 V; K! {7 N
//Check both variables for empty value; K  a' n7 ~/ Q( z+ {) G
+ a* k( X  B' O+ e" m
if (!empty($_POST['char'])){% s0 _- o/ h3 @- C' L/ J" G
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
% R  D' c  c8 E( t* l: J5 S8 j* P/ R/ `8 s8 l1 n( O! F
m_szName = '{$name}'");
/ F: E1 a! S; C8 T% Dwhile ($row = mssql_fetch_object($find)){
- }/ k3 L: A4 s! ~/ S1 j% Q; Q, zecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
3 \) N: D, Y) m% h" H+ n2 q$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
7 f8 j0 |, k& Q2 j& p
1 _2 D: L0 Q. ^9 V( N6 L[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], ' s4 [1 E* x, T
8 V- |6 L( u& a6 [& `
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
7 ^/ e- Z6 t! r' r, r) @
" u. g: d4 i; l, [N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
) E; S& h& a3 Q  H& d; {7 `- c7 P6 W0 D* J/ [: k6 Z, i! j
'{$ElementUpgrade}', '{$ItemPierce}');");4 B) e; d- _% j/ T& c% W
}
* g# u/ z' J( z( F
3 A( k* N8 N$ n+ U. ^$ _* _}# |* f$ G& @! N* |

' D3 |  U$ Y* F0 K/ y}
( K7 G1 b( K- Y8 _$ k& Y
) d) ?# N, I+ F# w# W6 C7 q$InitForm = InitForm();
8 z  D/ @9 |8 s: |- T7 g$Listener = PostListener();8 k" Q' V- M' F  e3 Z" s" e/ j9 V, q

% ]9 T; F9 ^+ \- z?>+ R+ Y$ X; J& B6 |9 c
* F/ Y; U! F2 p6 u! x9 ^" e9 e$ L

* \' \( F. l  P$ A- `
+ \6 d6 O2 ?8 I* [, r9 {1 c- Q! m( `% O# p2 f- N
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2026-1-15 21:15 , Processed in 0.060224 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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