飞飞世界论坛
标题:
物品发送脚本
[打印本页]
作者:
admin
时间:
2016-1-10 03:43
标题:
物品发送脚本
<?php
7 ?( w& N/ L9 C+ {! y
function Connect () {
, H% H, M# X: Q- E* }) j0 @
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
- }' U% j; D3 t
, k1 U5 N$ _9 o
Failed.');
4 O! A2 h; {8 j8 a) e) f
}
( ^$ v. k+ C0 n% ^
Connect();
( Q' `/ i& y) T) G2 r+ X( P/ J9 H; m3 k) _
' D- D1 @5 `- D+ g9 x a
function InitForm(){
, `5 d- L: ^8 }! M: C7 [3 m
//layout for the form
9 }, R4 @, ?$ v/ I3 [
echo "<strong>Send Items.</strong>
. G% A* I+ }2 V' n5 |
<form name='select' method='post'>
) m1 }1 ?- i9 C0 q1 |. M) ?; ^
<lable>Character Name</lable><br/>
! w" @% {4 W9 y) I$ c, y
<input type='text' name='char'/><br/>
8 u8 n6 L% w O
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
7 D% R+ `2 e; a* t* x
<input type='text' name='item_name'/><br/>
: ^9 H- c8 W, [9 U; v/ e3 x* }
<lable>Item Amount</lable><br/>
8 A; E! t+ [1 q) O/ A# y
<input type='text' name='item_amount'/><br/>
( @1 w3 M+ b, I; I7 r$ D
<lable>Item Upgrade Amount</lable><br/>
3 i2 H! R; h [6 e
<input type='text' name='item_upgrade'/><br/>
+ o7 l" Q2 s! `) o* {
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
' r8 l& [* W" e k- v V
, q4 S0 ^( b/ `4 q9 u2 Q" \! `
</lable><br/>
! p6 L; Y3 x' n. w' N0 H
<input type='text' name='item_element'/><br/>
& N& W6 V/ M7 u7 w' N% q) W
<lable>Element Upgrade Amount</lable><br/>
: r% A# x5 X% Y) l' ~
<input type='text' name='element_upgrade'/><br/>
: E+ h' y0 J9 r8 I( V1 B) x
<lable>Pierced Amount</lable><br/>
/ |4 f# S- S* q( m# u4 J
<input type='text' name='item_pierce'/><br/>
9 p0 ^- i+ t8 d* ]3 p
<input type='submit'/>
( h* z! L q& t$ o/ D2 N
</form>";
' @ |* R5 R a# }0 U
}
+ P7 ^7 Q- K! U7 h7 e9 n
4 p5 R5 R* y. c$ w) S
function PostListener (){
2 G. ]# ]) Q: K% ~* ^; ?
//Add more post variables if needed and add them to initform() function aswell
- k, x5 j8 `7 l3 N. f
% G s0 ~; X0 c0 `
################################
, i9 S/ z @* o9 }0 P
##### Connection and Post ######
* T& q8 C9 c" c% C
################################
/ J4 V" T+ K2 s# B1 h8 {, P, J& h* {
$name = @$_POST['char'];
4 `( U+ K- B6 N$ `9 V
$ItemName = @$_POST['item_name'];
/ e) o. d8 X$ {; U3 s6 Z
$ItemAmount = @$_POST['item_amount'];
8 y7 |9 `8 L$ A! Q; A
$ItemId = @$_POST['item_id'];
8 f0 j; m$ Y0 e
$ItemUpgrade = @$_POST['item_upgrade'];
9 P& [" `& B. L `7 ^9 \0 d
$ItemElement = @$_POST['item_element'];
7 ?6 l6 [$ g* s) }, C+ l
$ElementUpgrade = @$_POST['element_upgrade'];
- h. h. W8 Y9 v
$ItemPierce = @$_POST['item_pierce'];
( v$ p! @1 G) f
################################
+ m/ A" e0 K$ ~- f
5 | o8 T. Q: z1 ]9 ~
//Check both variables for empty value
3 ?4 b# N; D. V
9 q7 f! z2 N) Q) Y2 a- \
if (!empty($_POST['char'])){
4 E+ F0 B! \& p& S
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
* R& t V6 Q6 i6 v/ ~9 P) L+ n) U
* o) |0 _* H* Q/ t# B( L
m_szName = '{$name}'");
6 b9 u# E& F. H! |
while ($row = mssql_fetch_object($find)){
# ?9 V9 p7 U0 }+ a- l
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
$ i! Y+ O5 C* U" l$ Y/ v) K
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
( C" [% h' y/ f$ F j
. a7 k+ S- a2 V7 h
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
2 f) `- z5 Z, i; y" c
! j K$ ^) }1 F( [7 u
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
. ~9 J) c# q4 s" b
. Z' S( _+ j6 r) s; J
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
4 G& e0 w+ i; G4 l4 ~1 J" U5 Z
0 |( s$ h+ A" [) `
'{$ElementUpgrade}', '{$ItemPierce}');");
2 B* ], Y$ R- ~; @4 z' H
}
( `. j( Z- v4 C( M E2 L7 [
3 M9 g) _6 c: I9 _
}
5 i R5 U3 h# R. ]) _
- ~/ }& ?# ^6 F7 \# n
}
- E: u6 U% h4 @7 z/ r2 p, \% D
# E$ U& M: K- z- \# \; ~1 u3 |
$InitForm = InitForm();
% v# H d6 r( G8 ^6 Q2 X5 h
$Listener = PostListener();
, X" k, Y' C' O4 G4 v3 G# t+ g
! T- k8 _. h+ T1 h
?>
! @) u5 J/ D6 n! b. S1 u; t) q% d+ i$ ~
; r- f, o% T. P4 L! Z% q! b: a
$ }! h' L6 h; ]
+ v: V- I' Z' Z( L* x1 K3 n0 a
8 Y( }( F3 E5 F( Y& w/ q- p
欢迎光临 飞飞世界论坛 (http://ffwold.com/)
Powered by Discuz! X3.2