飞飞世界论坛
标题:
物品发送脚本
[打印本页]
作者:
admin
时间:
2016-1-10 03:43
标题:
物品发送脚本
<?php
% ]: Y( o( q% \1 `3 Y
function Connect () {
* H1 K0 n1 W3 j+ E) Q- c$ e5 m
mssql_connect('Server','UserName','Password') or die('Error: Connection to DB
; M E' M+ U$ K3 s, B9 m
5 a- M) ?5 K; |/ n/ D+ i% b
Failed.');
4 S+ t. r6 A0 [+ ~. H+ G$ a
}
# ]( K" j& i) P- {
Connect();
( B# N( d1 B8 q
" L& C; n: X+ i! r, F# \: H
function InitForm(){
* w0 z, q/ }/ e" K8 A9 n
//layout for the form
/ y1 z* V8 K- l2 d: P
echo "<strong>Send Items.</strong>
7 w) e! b3 d* F) Y1 ?) O/ ?* x
<form name='select' method='post'>
. y1 e: {3 N: x* ]3 e! C
<lable>Character Name</lable><br/>
, Z' K. s- C$ x6 ^! d0 g
<input type='text' name='char'/><br/>
# R/ S+ U0 y& V. s; a- r* o7 n
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
6 Z4 h4 c1 U" q* D& G# ~
<input type='text' name='item_name'/><br/>
; [3 y& E4 E: P t a; S
<lable>Item Amount</lable><br/>
2 Z/ d4 ~$ ^, P( C3 {
<input type='text' name='item_amount'/><br/>
7 k1 u$ e/ k7 P' J
<lable>Item Upgrade Amount</lable><br/>
6 u' P* o" G+ p
<input type='text' name='item_upgrade'/><br/>
3 J2 u! @& ], ^# L
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
4 a% |& o) {8 \! |
$ Q, a( Y- p% k& p' P3 F& \4 A
</lable><br/>
9 o" d4 A% L$ b
<input type='text' name='item_element'/><br/>
! G T7 B3 {0 N# G
<lable>Element Upgrade Amount</lable><br/>
$ g$ N+ J# ~( I# N! {; Y
<input type='text' name='element_upgrade'/><br/>
$ R# D" G6 G7 v, ^1 N! _/ q" `
<lable>Pierced Amount</lable><br/>
7 W* x5 W5 V: D# w: I! S0 W3 \
<input type='text' name='item_pierce'/><br/>
3 w1 D: S: n6 b5 m* B
<input type='submit'/>
7 q5 X, k6 g6 v& J/ g" c, Z
</form>";
e% j! n' o- y
}
) `3 Q3 q" ^8 ~: f' n* M" I
' V" R* P8 b. A. Q1 _. P& e
function PostListener (){
9 f. N$ O3 |( i' j9 z" W$ j& l
//Add more post variables if needed and add them to initform() function aswell
' r0 N; I: J5 G/ f; n
9 [. T j1 X( q9 {9 a2 R! ^
################################
' d' R0 O$ t# d2 `( ]
##### Connection and Post ######
, b: x) C2 @* F
################################
9 `9 y$ H1 L) f9 U) n7 T
$name = @$_POST['char'];
2 d2 p! ?) @7 Q4 R, r3 q5 }1 ^1 G0 Y7 Z
$ItemName = @$_POST['item_name'];
3 E% P1 ?6 t7 ]( o
$ItemAmount = @$_POST['item_amount'];
5 ^- O2 O L. ?& `
$ItemId = @$_POST['item_id'];
9 A" f2 ^) h6 A% v2 `
$ItemUpgrade = @$_POST['item_upgrade'];
7 q/ ?. D. [% v. |, {
$ItemElement = @$_POST['item_element'];
# l' F+ P" K! s% D2 Y
$ElementUpgrade = @$_POST['element_upgrade'];
5 I0 z: W6 Q& y% Q# W
$ItemPierce = @$_POST['item_pierce'];
$ l$ T! f/ D1 c F% f# I
################################
& {9 m& ~; ]- V3 _0 }* P
3 G* s$ d9 r# A u& [
//Check both variables for empty value
1 q0 f# L0 u" X1 u7 z) B, h# U& N: u
# F0 u' s, s6 `8 N% s v8 s/ X
if (!empty($_POST['char'])){
. V7 M5 c' F# H8 R9 u
$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
' g+ K. a, I7 U) v0 |5 }/ \" |: w
* a+ x" ^( R6 O7 p3 V, A0 A/ I
m_szName = '{$name}'");
4 Q( e8 T* V4 g2 Y
while ($row = mssql_fetch_object($find)){
2 a! ^: C: s2 A5 _
echo "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
# ~0 p2 t, G. V' B& W9 T6 q/ s
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
% s) m5 Z6 a, \' C/ O8 A
% P) E/ [! g- t9 R
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
" O6 `% S5 N4 r. p" K( W. y* W
$ L4 e" p `3 [9 }6 I1 o3 [% Q& G
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
+ N) K2 c0 W& t4 k# r
0 ^: z9 I" C( w( ], t
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
$ n# D2 X! T+ k
/ ?$ a( c. g4 v7 I# i, A
'{$ElementUpgrade}', '{$ItemPierce}');");
5 B8 ~" R Y! f K% \. a
}
9 q( R% ^6 K& m* E- { o1 m& r$ T1 T/ h
/ R: G9 I4 G. ?7 H8 x- r( q1 _, h
}
8 S y2 l9 q) h( G; P
( _$ o M* D$ P4 o* U+ ]% G, } q
}
' w7 H! {2 d+ a, W
, M4 N9 r( K4 A
$InitForm = InitForm();
: R H1 A' u3 u( a+ ^
$Listener = PostListener();
3 i+ l4 s/ o1 x! |& j
5 w% w6 g, r' {! J5 Z& {
?>
$ G( F$ |( ^' m; x
* s6 F0 k% [& n5 s1 ?. g. x9 ~! w
* \ E2 @, r+ }5 V- j
: r( h: b7 b% z& p
: n6 D6 @+ }* n+ X& p! R! v
欢迎光临 飞飞世界论坛 (http://www.ffwold.com/)
Powered by Discuz! X3.2