飞飞世界论坛
标题:
物品发送脚本
[打印本页]
作者:
admin
时间:
2016-1-10 03:43
标题:
物品发送脚本
<?php
8 {' ]( }, y2 K. h
function Connect () {
7 w9 G `: q4 A9 O8 h, z. ^
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
2 x7 ?+ j5 s4 r& d2 K
- C! v# n' e; Q& L3 o+ V
Failed.');
5 Q$ j/ Q6 f9 l" {' t
}
- d$ g. I1 c9 `* v
Connect();
; {9 V; ^0 P4 n4 h* t
/ l) n/ l, }6 D" v! i. f2 u
function InitForm(){
! {5 r& C% x3 C( M; F
//layout for the form
' E% M9 }* }' z- \/ _
echo "<strong>Send Items.</strong>
]3 }8 B; p3 A x
<form name='select' method='post'>
" T" V& k. \1 y3 J& [" G$ d
<lable>Character Name</lable><br/>
* M9 t. ?8 Q) j8 ~! A. G
<input type='text' name='char'/><br/>
3 N: z2 N: r1 \4 u1 g
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
4 q, I/ K0 v% x. w$ J
<input type='text' name='item_name'/><br/>
$ x3 \; Z# K/ [/ b6 R& n R& ^! M
<lable>Item Amount</lable><br/>
" E8 r* I( @, O8 `5 N( h
<input type='text' name='item_amount'/><br/>
5 \- a+ h! T w0 ~/ }5 x \/ g
<lable>Item Upgrade Amount</lable><br/>
' g7 e8 y/ P w. Q( F( @" R: ~
<input type='text' name='item_upgrade'/><br/>
' n( z! P: T) Y& k9 P7 m
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
6 {" W- N9 j2 B" j
, q- z8 \, U4 Z. s
</lable><br/>
" h t; L) ~0 G$ o! X7 x8 k3 s
<input type='text' name='item_element'/><br/>
7 b& ?* C' [ t+ |' Y1 O1 [/ f
<lable>Element Upgrade Amount</lable><br/>
1 o6 |; b, Q2 V+ {
<input type='text' name='element_upgrade'/><br/>
: ]. _7 t; R9 [9 \" W/ G3 y
<lable>Pierced Amount</lable><br/>
* N, D" p! y E5 x
<input type='text' name='item_pierce'/><br/>
( _- m1 R1 ~$ e( j9 X8 |
<input type='submit'/>
( k Q) v" b5 O( n# t3 @
</form>";
8 b+ v/ c" k3 N! `9 @: d
}
; x0 |. T. J S% R5 j6 L3 z+ _
' o' q9 H) K4 m
function PostListener (){
& Z% h' Q V, |. R+ h+ w
//Add more post variables if needed and add them to initform() function aswell
8 t3 @. n( f4 J8 S3 p% T5 O
# G! {. S$ B- A7 ]3 k6 {
################################
* c1 L0 W2 M2 T3 Z$ g
##### Connection and Post ######
: Z p$ |2 p7 q0 x7 C5 o5 x
################################
6 N1 H, }2 ^% n* G0 `- }
$name = @$_POST['char'];
* H [, }3 m3 M) Y7 ?' ]7 |
$ItemName = @$_POST['item_name'];
' _* ?( @2 u" E1 @) W
$ItemAmount = @$_POST['item_amount'];
8 E2 j8 |9 c6 m; f) ~% ]2 L
$ItemId = @$_POST['item_id'];
; T4 X2 ]2 a% E% K% z4 S& W; J8 Q* o
$ItemUpgrade = @$_POST['item_upgrade'];
7 C) O& @3 R; W% D
$ItemElement = @$_POST['item_element'];
6 i. F" P+ q4 j" c+ b/ }3 U. e
$ElementUpgrade = @$_POST['element_upgrade'];
( ^& W \% ?4 V
$ItemPierce = @$_POST['item_pierce'];
# ^( J. U% F2 N2 a7 A; q u7 _
################################
3 X! @7 }, V! B9 \
- F" u: b0 @1 L6 P! B) h. ?
//Check both variables for empty value
9 n! T. ^ N, j3 `2 D
& |, z& ?( B8 L+ m, m
if (!empty($_POST['char'])){
@ f, T+ W: U2 |5 b1 e
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
2 s0 n5 V2 r2 z
" K3 C8 U5 ]: {* G' b# i
m_szName = '{$name}'");
0 u. z, V5 y8 t% M
while ($row = mssql_fetch_object($find)){
( w5 _4 ]( M$ N; U8 m K
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
B& ?7 m& }5 M( @& V% _
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
7 v5 f% O# s q$ o0 a: P% M
5 {* ?! R: P( ?
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
% C3 Q+ D5 \' b" [0 o D) @
' b2 L( H% X9 m
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
$ ]! P/ Z3 n) S6 w4 f
! f. L- M$ }. `( ~, c4 E
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
$ n3 b4 C ~' I6 F3 h: W
) T* z. h7 h& [( X% o
'{$ElementUpgrade}', '{$ItemPierce}');");
0 \& U" a: U3 p- j& l- [& z
}
! q9 x! S, o1 B6 p' q
9 O5 ~" U. z( @9 e+ ]8 H
}
/ S: c2 l# |: X
. k1 {6 V* I J9 A' G
}
+ o" U0 ~$ t& M \9 H
' B9 J6 @! ? u* D
$InitForm = InitForm();
+ a+ g2 a: q* e6 _
$Listener = PostListener();
$ ?% H) \/ W) F9 W2 @
6 t# a. k& Z+ V2 h
?>
: A6 H8 G; X+ W, s3 s2 O2 a4 I
4 N) Z3 Z+ q+ b
' e8 P" c" h3 f. H/ M2 y
" p" H7 A$ j* _" E
- V( a* v' d* [& u
欢迎光临 飞飞世界论坛 (http://www.ffwold.com/)
Powered by Discuz! X3.2