飞飞世界论坛

标题: 物品发送脚本 [打印本页]

作者: admin    时间: 2016-1-10 03:43
标题: 物品发送脚本
<?php0 t" k1 o2 \0 r2 f1 r$ |4 o# J8 g
function Connect () {
$ f- S' j+ F7 m; R+ w' Omssql_connect('Server','UserName','Password') or die('Error: Connection to DB
0 I+ t1 l! V  [$ h1 {, u. [: v  q
$ L4 g& f7 p+ B) s: M' zFailed.');
3 Q1 O& L( u& R! S! w}
: j' f/ n) v; T1 ]Connect();
, v: j0 N) a8 A: x
: \' k% Z/ F: ?; g* ?+ E9 {0 s" L- ffunction InitForm(){4 R1 E" p2 e$ u: b
//layout for the form! X+ ]  v8 |1 d8 H
echo "<strong>Send Items.</strong>
* O- s  K" _. z( b4 c# P" b, B<form name='select' method='post'>- j( q! l' s" W- G" E4 ?
<lable>Character Name</lable><br/>
- O& E  t. R! m/ V, H! X+ n<input type='text' name='char'/><br/>+ q: d0 T8 H# H1 {/ {! |5 l
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>
+ V' j4 g' d6 l& `+ [4 ^/ e$ B<input type='text' name='item_name'/><br/>$ R# J6 d5 s8 q& q* I
<lable>Item Amount</lable><br/>7 x% I$ S, L/ k! P+ x( z1 P6 J
<input type='text' name='item_amount'/><br/>
: k3 Q4 C. m/ g  Z5 W+ J<lable>Item Upgrade Amount</lable><br/>& V1 K" i2 R6 t3 e8 ]8 ~$ L7 b
<input type='text' name='item_upgrade'/><br/>
# X, C) E4 i* y9 m<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.); `8 l$ j  H2 y5 n7 m" K

3 o+ Z& }5 v6 l' L- D& e8 }  p</lable><br/>
, v  V  y+ g9 i<input type='text' name='item_element'/><br/>
$ |+ k. d# ]7 z9 H7 m<lable>Element Upgrade Amount</lable><br/>
5 b! f1 B5 B: }<input type='text' name='element_upgrade'/><br/>
  K3 A8 h+ U. v. Q" a% Y<lable>Pierced Amount</lable><br/>
8 N/ V  ~6 t* B0 Z1 X# T<input type='text' name='item_pierce'/><br/>
6 t5 C& \6 {. s* ^* p<input type='submit'/>
: ]' i' I* }2 Z- B: q0 ^</form>";
2 _: ?7 s* w: @' E; k7 ]3 R& S! K  z}# j9 c2 h6 d# F1 H: J

+ R5 o' x5 X/ bfunction PostListener (){
5 [" s' @: M- [9 |! o  c$ q//Add more post variables if needed and add them to initform() function aswell
% K6 \: K% S3 `0 h0 @) g) k1 e# b1 ~7 W( v9 N
################################
8 n9 S3 V: ]9 _##### Connection and Post ######
! }" j; O7 N  k" E1 s0 H5 }################################
' E9 u2 a/ X" t8 `7 X+ W$ q1 r4 q$name = @$_POST['char'];; u6 S+ Y3 S; Q& Q4 V8 r8 D+ {
$ItemName = @$_POST['item_name'];$ G" j$ A( h) i" a+ G* u
$ItemAmount = @$_POST['item_amount'];1 z9 B+ |- J% R. O, ]
$ItemId = @$_POST['item_id'];
: E7 i& X5 B: `6 j$ b$ItemUpgrade = @$_POST['item_upgrade'];
! E% H+ I+ g$ L" Q$ItemElement = @$_POST['item_element'];
& D& x: X# S. ?0 I5 ]# G$ElementUpgrade = @$_POST['element_upgrade'];& Z+ E- [. o, b. N: m
$ItemPierce = @$_POST['item_pierce'];
0 @5 Y0 F2 Y3 W3 y################################
. E1 n& s3 j/ j0 J' v3 ^& ^* p1 [- X. r
//Check both variables for empty value
% e; C+ R0 [  d3 R  P
/ n( g6 ]5 w8 R! M) aif (!empty($_POST['char'])){
3 B# _, w: h3 f0 p/ z- @$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
0 F1 h" x9 O% ^" N& I9 E
; W# i: N8 }7 Um_szName = '{$name}'");- C. o, C' J% T- M
while ($row = mssql_fetch_object($find)){
, j& G# _- H0 H" gecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";6 B# e" m$ P  E; y' D+ T% t
$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],   f+ d8 T5 x$ z1 E
* V6 I8 H3 T; [9 b. K5 G0 O* |
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption], 0 z( c; M% G+ B4 n' Y/ X$ D5 q: N
0 d( i6 s$ s1 s% c' |" }1 U
[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer',
9 C& Z  |/ t0 H# v, |# W3 x; V4 T( P5 y, Y' j/ k1 G0 f
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}',
5 G9 R$ U% c, Q# p3 K  P6 r8 w# f5 F, s' u
'{$ElementUpgrade}', '{$ItemPierce}');");4 Z. U7 \- X$ Q7 Q4 R- n/ k: k
}& Q4 a* g6 W5 A# ~5 d

9 S; G: A0 u9 q/ a0 x! u, p' r}
; `( L( W5 a' R' ?- O  h+ |
. P9 [/ ^+ J) `3 z8 ?8 g( i1 A}
9 `- [( \1 a4 v3 a' Z/ Q. d0 m" O, H: x# R% s% D
$InitForm = InitForm();6 Z1 M) P* |* E
$Listener = PostListener();
9 y( |6 g2 J+ f1 D4 E+ J4 `8 N
' X. K* w4 }; W2 _8 `$ ^, ^2 B?>
. W* w! {5 Y" P& Q6 Z; y7 B% U
. \0 W7 `9 ]+ y# B  _3 h; z2 I
  o+ [( O+ R' P' B& m/ M  U, m, B) ^2 [* K7 z) r$ V; _. G

$ x. X( t6 ~  C. c- H6 A. }( f# l* E




欢迎光临 飞飞世界论坛 (http://www.ffwold.com/) Powered by Discuz! X3.2