飞飞世界论坛

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

物品发送脚本

[复制链接]

197

主题

203

帖子

1086

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1086
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
4 F$ b; g3 G2 V# A1 z9 f. O- ~function Connect () {* @6 M4 `: l) z1 Q$ n1 V
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB / S7 a$ f9 n; @( X% C3 S
9 U; i+ r  K9 t
Failed.');
) F. G+ T! J4 ^& d3 t7 e}; s( [! L  j: t
Connect();
8 p) N  {3 A7 e( ^0 B! y' Y' P
function InitForm(){
- M( `; |! u6 F2 n/ o; }% {9 h4 J//layout for the form
$ E& i8 o' }  y. Y6 E; l8 h) gecho "<strong>Send Items.</strong>
: _% S/ h1 L( q2 x<form name='select' method='post'>0 \9 G. Z% U+ {1 _
<lable>Character Name</lable><br/>
9 R! X* L1 g8 f, D0 S% m8 y  W3 C- P. I<input type='text' name='char'/><br/>! P  x+ m; k7 h9 L! a' C- \
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>/ N# u7 b- V1 [. e1 _4 A# n
<input type='text' name='item_name'/><br/>
1 t! p/ y  S7 w$ B0 q- W; Q; I<lable>Item Amount</lable><br/>
& p( o8 j' m* {$ v% X1 R3 a' F2 K% x. f<input type='text' name='item_amount'/><br/>4 R  v& i( t! ~; S, Y' o5 R: y
<lable>Item Upgrade Amount</lable><br/>
7 n! J* J, x) ]: Z  v  a# W" n& z<input type='text' name='item_upgrade'/><br/>
, J6 @/ D( l2 E) k# {/ \2 I! B: q, e2 E6 a<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)/ O: x( ~; v$ l6 _3 l$ L- N' ^

% L+ t1 [0 T  I& o& J9 n</lable><br/>
/ s/ N. M# B, U9 H  |<input type='text' name='item_element'/><br/>7 L, C5 V) J+ l; Q: Q5 j
<lable>Element Upgrade Amount</lable><br/>/ |( B# K3 ^0 s0 s0 P. y) J9 {
<input type='text' name='element_upgrade'/><br/>
2 @. P, G/ P5 c<lable>Pierced Amount</lable><br/>- u" L- V0 b: ?; B% G  `( r3 P, t+ \
<input type='text' name='item_pierce'/><br/>
- R" `6 c* Z7 u* X# K' P$ j3 M<input type='submit'/>
3 S# C& S% W- Q</form>";
4 H6 ?  t5 Q5 Z- W4 b& i}5 @9 ]2 b5 _  H5 ^, g! t$ e

; V1 D2 ]1 \4 Bfunction PostListener (){; G- n& Q4 U9 B& {: C$ c
//Add more post variables if needed and add them to initform() function aswell
6 x+ e  s; L4 G+ F( b0 m' W2 T1 g$ F
! E+ s9 [$ ]- ^8 S  c3 O# b+ _################################
5 [: O6 `# ]' |2 Z( L2 Y: p- g! C4 k##### Connection and Post ######8 |6 v4 U& @/ f( H! ]; w- Z9 Y9 \
################################
& T3 A- O% R7 B* ~% B) ]: q% R* X$name = @$_POST['char'];
& ]' |- b, k; h2 [* r$ItemName = @$_POST['item_name'];, T) W1 a; S. T9 F  i8 L2 Z6 _
$ItemAmount = @$_POST['item_amount'];
+ i* B" p: y' B, r5 L, c* X; \$ItemId = @$_POST['item_id'];  a; r' V* F+ q- m4 Y
$ItemUpgrade = @$_POST['item_upgrade'];: d7 k0 G% v# `0 V
$ItemElement = @$_POST['item_element'];5 t  Y# p' P1 u0 Q, v
$ElementUpgrade = @$_POST['element_upgrade'];6 M/ `$ j0 l( d4 L! G6 H7 a; S% a  k2 I
$ItemPierce = @$_POST['item_pierce'];
5 o. G+ h2 v9 l% c5 o################################: Z! S1 ]% q8 Z# E" n

$ [3 f4 i0 m9 p4 E+ g//Check both variables for empty value3 P2 [. S+ ^" K$ T, k' {, ?8 z$ h2 ^
8 Z% ]" a+ T6 h
if (!empty($_POST['char'])){
+ o" N( ]3 B- v. T: Y& u$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
8 J) V% r  r2 I& |+ a* K9 Q" U% Q9 p. q! Z  l5 [; q1 P$ c
m_szName = '{$name}'");
3 W" [( L! W- A7 L# t# N7 {- }) swhile ($row = mssql_fetch_object($find)){8 B. R- O4 N# [3 r1 b
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
) L& a# G! U& v9 `$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
# Y6 V1 r, V+ D2 W4 o/ u5 \8 D& A% j
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
+ Z7 a4 p. q( X& f, f
+ }+ g6 @* k! x! V  p! L[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', ; A# P% U9 o. X* t$ U1 o$ z2 d' k

/ n2 s# q' c  w; lN'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
" G; o9 ^7 s: y# j# J6 x* \4 `1 `' u+ P1 f; T0 W6 A
'{$ElementUpgrade}', '{$ItemPierce}');");3 p* W% _4 f# C/ D
}
9 p  H( L1 i: ^# l0 W' K
8 V6 U% m# l+ ^+ Z  b9 L$ J}
- F. _/ W/ r. l- ?7 F8 m" R! C% f) a5 }7 j# C6 R; `
}0 C- A9 u4 T" t2 q2 _3 h# s* O
5 ^, C$ @& e3 p) H: v! e  W
$InitForm = InitForm();. F6 j9 v& ]/ M2 q9 c# l& v- }* l
$Listener = PostListener();
( c' ?% C/ u7 O( x) T& r- u# Q% e7 |- G+ n. E* q$ [
?>
% l- z! N/ w: M% i0 s$ I3 r' b
7 l5 k7 }# {5 l7 G' E6 w7 ?* X* `
8 q9 N+ D: E( Q$ m% u8 o
! Z/ a3 }+ F+ t+ V  l+ ~* U5 f( w) ?1 q1 A& j
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-12-30 02:18 , Processed in 0.082025 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

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