飞飞世界论坛
标题:
物品发送脚本
[打印本页]
作者:
admin
时间:
2016-1-10 03:43
标题:
物品发送脚本
<?php
4 V2 v, {% V6 F2 W/ B1 L
function Connect () {
8 d. ?" ~6 _5 s
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
+ G" d8 s+ u5 |
' t: i: C; e6 m, _/ d2 s
Failed.');
- C' n1 y! v( Q
}
% z2 z0 ^) [. ]2 k
Connect();
7 d4 @% u; R7 g5 Q' u" C l& q7 O
1 g% V& a2 Y* S
function InitForm(){
4 n3 }, u% x& v$ C& @/ `$ g
//layout for the form
2 c# o' z. ?! c( k
echo "<strong>Send Items.</strong>
( d, e2 h' j0 t3 h
<form name='select' method='post'>
+ r" m; X7 i- _# a
<lable>Character Name</lable><br/>
0 u) |* Z9 |( J# C+ ~" e
<input type='text' name='char'/><br/>
* y6 q2 ~2 b7 D1 z- s
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
3 A' O" q; w3 {2 l4 ~. f9 G
<input type='text' name='item_name'/><br/>
2 H) B) C4 H# ~. Y X
<lable>Item Amount</lable><br/>
& ]3 M% G+ `8 p+ L
<input type='text' name='item_amount'/><br/>
" v% r# `( `4 E; k; c
<lable>Item Upgrade Amount</lable><br/>
6 V3 K2 d, R, v9 ^/ L
<input type='text' name='item_upgrade'/><br/>
/ X. n* x3 j1 q) Q
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
! e1 a9 v9 ^; W& r" G( t4 C) a
$ j# i, d o8 K' n
</lable><br/>
3 I2 C- Y, ?/ q; N% e. P
<input type='text' name='item_element'/><br/>
# J W& B/ ]$ S' s% I3 L
<lable>Element Upgrade Amount</lable><br/>
" N5 X: L8 _4 c3 ^
<input type='text' name='element_upgrade'/><br/>
* U: S- n, ]# r0 l2 R
<lable>Pierced Amount</lable><br/>
+ w+ T7 N3 n8 X, @9 l
<input type='text' name='item_pierce'/><br/>
/ A8 Q* R- V. c. ^: k
<input type='submit'/>
9 o2 p; M& F3 i$ _
</form>";
+ X0 \7 G: E5 |# v: s$ K
}
& E- Y' H4 C9 v- Z, M2 p6 H
" U g' M' Y3 Y9 u: K$ k) y' w+ G
function PostListener (){
" _: X! e+ K1 l8 y& c1 u
//Add more post variables if needed and add them to initform() function aswell
5 A+ K; D1 a# U1 g# n" H7 u
/ a8 e% w( y5 y7 Y+ z
################################
6 ]: k4 X/ w! g+ H& _7 [* S
##### Connection and Post ######
& [) T. W" T0 I2 s9 \4 J; w! a
################################
; [2 {" z. ^+ ?7 [* I2 ]' q. M
$name = @$_POST['char'];
' ~+ I8 z: E6 l5 g
$ItemName = @$_POST['item_name'];
& O2 C8 o( ~3 I8 l9 m/ {
$ItemAmount = @$_POST['item_amount'];
: x1 r$ s% l7 ?
$ItemId = @$_POST['item_id'];
8 C( V: G% B" r( z; w! M
$ItemUpgrade = @$_POST['item_upgrade'];
s5 I* Q0 P& S6 J& a
$ItemElement = @$_POST['item_element'];
7 n5 a! C$ g/ E! K
$ElementUpgrade = @$_POST['element_upgrade'];
+ ?0 P0 K& K' X
$ItemPierce = @$_POST['item_pierce'];
- ?! h+ i) d/ l9 D
################################
- |" F; r2 r0 L* `5 a5 S5 ~1 s
9 i/ g; W% Z; K* C8 G H$ d
//Check both variables for empty value
. x; {6 k+ j) d
1 R' u* c3 M3 B
if (!empty($_POST['char'])){
% H6 w4 d9 N' [- r/ s+ a( X) Q
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
. H" J1 U7 R* h" k
# D, P9 H& n- K1 z! I) B
m_szName = '{$name}'");
) Q. [! b6 {4 z% c. T, \
while ($row = mssql_fetch_object($find)){
! r# Z$ U! X1 k4 e8 t6 ^
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
2 O+ j. w# j: j9 a- J) l* [
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
+ }( P% U& ^0 C8 c
1 j: X, A* e5 E0 a/ D
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
# t5 n: S" g* D8 C5 Y
, `/ p& C* v2 C0 z9 J) b
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
& L2 y6 W# A5 N8 K
, o3 x* Z9 I1 Q# ]; C. D
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
1 F) a; }3 V9 Z1 Q$ c
8 @% j ~+ r7 p3 P" V5 g( x
'{$ElementUpgrade}', '{$ItemPierce}');");
$ W- {. l: ]& {" v8 N# h$ q* y. i1 ~, M
}
7 ?0 n; [3 u+ V* T
2 J' V% K: T" m+ \/ D4 Z$ D9 h
}
: _/ D: _7 }2 o4 ~# p
$ M0 \. l" r& X
}
6 g/ U+ C7 ^0 d; g# W! ^, W
, M8 ?% w9 l2 U- V
$InitForm = InitForm();
4 t4 q4 a( w m7 w
$Listener = PostListener();
2 Y: F' v7 o6 S( z" f1 o
( U- E( a) S. ^! n' u9 w/ m5 z
?>
! u4 {) F4 `: g% m/ X
; C5 `+ M$ S' W
. v* h E# Z+ k5 y& ?; W
/ H6 ]0 G+ O8 U" ~) [3 U
, J! b/ k! r; C# D
欢迎光临 飞飞世界论坛 (http://www.ffwold.com/)
Powered by Discuz! X3.2