飞飞世界论坛

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 11126|回复: 0
打印 上一主题 下一主题

物品发送脚本

[复制链接]

197

主题

203

帖子

1054

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
1054
QQ
跳转到指定楼层
楼主
发表于 2016-1-10 03:43:06 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
<?php
  m5 J+ f- J# W) x( J& L7 g0 Jfunction Connect () {
' h/ t3 ?7 U" X! w- `+ Nmssql_connect('Server','UserName','Password') or die('Error: Connection to DB 0 N1 }3 `0 Z8 {

& Y  f! }- A8 I; ]6 H. Y. @Failed.');  Q3 u' L- b0 s$ y
}& i! n6 a* l7 y+ ^' K2 d0 W* p
Connect();. [9 G* }6 X  E6 \; N
9 R8 I' i" E5 P3 f  w, R( o! o+ W$ O  S
function InitForm(){
% y3 P* V7 {/ @- X' e2 L3 f' Y6 L//layout for the form
+ [2 L, G8 ~. aecho "<strong>Send Items.</strong>
* N- J, H) q2 T; V/ ?, f3 J<form name='select' method='post'>
9 M& @1 c  J& ^0 h<lable>Character Name</lable><br/>! c" O' ^" M- k/ n$ q1 `
<input type='text' name='char'/><br/>& }; c/ A  D% o; J  H7 Z
<lable>Item Name (Needs to be Exact or can use Item ID.)</lable><br/>9 x$ y+ r* `3 ?$ {! E; |* K
<input type='text' name='item_name'/><br/>+ F7 D- A8 d8 [* c# j' u/ |
<lable>Item Amount</lable><br/># ]# v, D5 h* F0 V4 d+ m* g
<input type='text' name='item_amount'/><br/>5 T# d" B' F  r9 @( Y5 l4 t: w, Z- b& p
<lable>Item Upgrade Amount</lable><br/>  f7 I, e: w# e+ @" l& D6 W
<input type='text' name='item_upgrade'/><br/>) |2 M; B+ S6 \2 \) {. Q
<lable>Element Type.(0-None, 1-Fire, 2-Water, 3-Electricity, 4-Wind, 5-Earth.)
* ?  d* J+ p- e. H- l3 K
0 _# l5 i! d7 _4 v7 @</lable><br/>
1 k, e/ Z1 b/ S0 u8 e6 c( Q5 E<input type='text' name='item_element'/><br/>& h! }! a" N  n
<lable>Element Upgrade Amount</lable><br/>: P1 c- `6 J( U; O) ~9 k2 k8 c3 s
<input type='text' name='element_upgrade'/><br/>- a. K( G, R1 P; F# }3 H
<lable>Pierced Amount</lable><br/>2 a  Q8 N9 F* s9 z$ N  y+ \
<input type='text' name='item_pierce'/><br/>: l7 _; ]2 L. q4 @9 U* i
<input type='submit'/>
9 c3 j. K7 F" }' `9 i% z( d</form>";
1 G  |  D5 p, O# k}
' _) D5 L9 x/ }/ L' p' V3 N+ w- y' L% M6 W/ h
function PostListener (){4 j9 \8 G1 w: g  V
//Add more post variables if needed and add them to initform() function aswell
# G- {* w+ X9 v
1 z7 K( X' j0 F% b# h################################
$ i4 g& F; M* C) |! @##### Connection and Post ######: s  F. Z( }; F' U1 {) X6 C
################################
1 \; j8 H. F2 Q% k9 q1 ~$name = @$_POST['char'];
. N. c* r9 @0 X, e. l, _# o2 O$ItemName = @$_POST['item_name'];2 z( K: c  Q, |. S5 g
$ItemAmount = @$_POST['item_amount'];
$ I9 l2 @5 s( |6 ^$ItemId = @$_POST['item_id'];) Z* u5 B  f" U1 m
$ItemUpgrade = @$_POST['item_upgrade'];
6 ?' e( \+ A) W% r2 d, H. I$ItemElement = @$_POST['item_element'];9 z- L2 E% G0 J( w2 [6 c
$ElementUpgrade = @$_POST['element_upgrade'];
+ p5 Y" n; {2 h$ItemPierce = @$_POST['item_pierce'];# R  z$ {+ N  v; ]3 P
################################4 x6 b1 g; z0 h, b
/ m  u& R' r6 r
//Check both variables for empty value8 e- |4 D3 R# x7 h% g

+ P! X3 u9 p- U& G9 `5 uif (!empty($_POST['char'])){
! R( Y. ~1 V8 v$find = mssql_query("select * from [CHARACTER_01_DBF].[dbo].[CHARACTER_TBL] where
: g& S' m$ U* ~. v' B' X8 s  h" m, Q
m_szName = '{$name}'");" s* ~" R6 ~  C4 D$ t9 Q: U4 P
while ($row = mssql_fetch_object($find)){
  l2 C8 V% L, T  pecho "You Just Sent {$ItemAmount} {$ItemName}(s) to {$name}<br>";
/ w- i. b6 {# d( ]+ B2 @, T! b$logs = mssql_query("INSERT INTO CHARACTER_01_DBF.dbo.ITEM_SEND_TBL([m_idPlayer],
, Q6 c3 V3 a/ O2 O0 r/ K6 I2 Z. }" y" q4 n0 p7 r
[serverindex], [Item_Name], [Item_count], [idSender], [m_nAbilityOption],
7 }  A% C( J0 M4 {9 P
8 ]6 y' B% J( {5 A[m_bItemResist], [m_nResistAbilityOption], [nPiercedSize]) VALUES(N'$row->m_idPlayer', / L# @$ W7 |6 s4 R
( V8 {: S8 i( Z2 Z, R9 d
N'01', N'{$ItemName}', '{$ItemAmount}', N'0000001', '{$ItemUpgrade}', '{$ItemElement}', ' q$ [; ]( C* O  u% K, L
% n( a6 _' f3 i* _; H
'{$ElementUpgrade}', '{$ItemPierce}');");1 ?) U: k9 N: [$ }
}
0 y# o7 u1 B$ m: J, @: x9 l& ?) j- J  \+ s! i' U) Y1 I
}
) X, ~0 c: E- N0 `. b& P( h- ]$ y" P1 |- F% F9 w
}* ?8 t, {' S5 T3 C5 w# a1 T1 h
* V; R, a+ i# X. L) t* g! k
$InitForm = InitForm();- N5 y8 A9 L8 ^9 }8 L/ R; A
$Listener = PostListener();2 }* i9 x+ @6 V. L+ J- M6 E3 f

/ y( I" ?* c) {9 I, x7 Q?>4 V, d& Z( ^* |5 Q5 C
! b( N; y0 R& R- R8 D; A1 o

7 {! N! C# D% ^* a; k- W) l, V
4 t0 I2 d* L4 g6 v4 x9 `4 f9 O$ k5 D( g1 ], @3 M
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

手机版|小黑屋|飞飞世界技术论坛  

GMT+8, 2024-12-23 02:16 , Processed in 0.098739 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表