<?php
if($_GET['tgurl'] <> '' && $_GET['tgurl'] <> NULL){
require_once('pub/connect.php');
$row = $db->getone("select userid,username from user where tg_code = '$_GET[tgurl]'");
}
?>
如上代码,这段代码是放在注册页的,正常是注册成功后跳转到登录页,可是现在只要打开注册页就会跳转到登录页,请问怎么改这代码,防止跳转?
5 个解决方案
#1
没看到你的逻辑是怎么写的呀
#2
去掉 url 中的 tgurl
#3
别的代码不清楚,不过PHP里的不等于是 ! =而不是 <> 吧。
#4
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>用户注册</title>
<link rel="stylesheet" href="Public/css/skins.css" type="text/css" />
<style type="text/css">
body{background:#FFFFFF url(Public/images/body_bg.jpg) repeat-x top center;}
.b{width:660px;margin:0 auto;}
#header{width:100%;height:95px;overflow:hidden;}
.hc{width:800px;margin:0 auto;}
.logo{padding-top:15px;float:left}
.welcome{float:right;width:220px;height:28px;overflow:hidden;background:url(Public/images/login_v1.jpg) 0 0;margin-top:25px;line-height:28px;text-align:center;}
.mainwrap{padding-top:10px;}
#login{width:378px;margin:0 auto;zoom:1;overflow:hidden;border:1px solid #ccc;background:#fff;border-radius:4px;-webkit-border-radius:4px;-moz-border-radius:4px;-webkit-box-shadow:0 0 5px rgba(0, 0, 0, 0.1);-moz-box-shadow:0 0 5px rgba(0, 0, 0, 0.1);box-shadow:0 0 5px rgba(0, 0, 0, 0.1);position:relative;}
.hd{height:29px;line-height:29px;background:#f3f3f3;margin-top:1px;font-size:14px;font-weight:bold;padding:0 8px;}
.bd{margin:0 5px;zoom:1;overflow:hidden;border-bottom:1px dotted #ccc;padding:12px 0 0 20px;}
.bd li{height:45px;font-family:"宋体"}
.bd li img,.bd li a{position:relative}
.inpt{width:230px;padding:2px 3px;height:21px;line-height:21px;border:1px solid #ccc;zoom:1;border-radius:3px;box-shadow:0 1px 6px rgba(0,0,0,0.1);}
.btm{text-align:center;}
.btm p{padding:15px 0 8px 0;}
.sbtn{width:104px;height:30px;border:0;background:url(/static/v1/login_v10.png) 0 -260px no-repeat;cursor:pointer;}
#tip{position:absolute;line-height:17px;top:180px;color:#d41212;top:38px;left:115px;display:none}
li label{color:#4d4d4d;font-size:14px;font-family:新細明體,Tahoma,Arial,Helvetica,sans-serif;}
</style>
</head>
<body>
<div id="header">
<div class="hc">
<div class="logo"><img src="Public/images/logo.png"></div>
<div class="welcome">XXX <a href="#" target="_blank">欢迎您</a></div>
</div>
</div>
<?php
if($_GET['tgurl'] <> '' && $_GET['tgurl'] <> NULL){
require_once('pub/connect.php');
$row = $db->getone("select userid,username from user where tg_code = '$_GET[tgurl]'");
}
?>
<div class="mainwrap">
<div id="login">
<div class="hd">用户注册</div>
<div style="clear:both;"></div>
<form method="post" class="loginform" action="post_login.php?act=register">
<ul class="bd">
<li>
<label>登陆用户:</label>
<input name="username" class="inpt" type="text" value="" datatype="*" ajaxurl="check.php?act=unhasuser" nullmsg="请输入用户名!" errormsg="请输入用户名!" />
</li>
<li>
<label>登陆密码:</label>
<input name="password" class="inpt" type="password" value="" datatype="*6-16" nullmsg="请输入密码!" errormsg="密码为6-15位!" />
</li>
<li>
<label>确认密码:</label>
<input name="password2" class="inpt" type="password" value="" tip="test" class="inputxt" datatype="*6-15" recheck="password" nullmsg="请再输入一次密码!" errormsg="再次密码不一致!" />
</li>
<li>
<label>Q Q 号码:</label>
<input name="qqnum" class="inpt" type="text" value="" />
</li>
<?php
if($row){
$chaseconfig = $db->getone("select Recommend from system order by id");
?>
<li>
<label>推 荐 人:</label>
<span style="color:red;font-size:14px;font-weight:bold;"><?php if($chaseconfig['Recommend'] == 'yes'){ echo $row['username']; }else{ echo "暂未开放推广注册";} ?></span><input type="hidden" name="higherid" value="<?php if($chaseconfig['Recommend'] == 'yes'){ echo $row['userid']; }else{ echo 0; } ?>" />
</li>
<?php } ?>
<li>
<label>奖金模式:</label>
<td><span id='mode_1700'>
<input type=checkbox name="modes" id="modes" value="1700">
1700</span><span id='mode_1800'>
<input type=checkbox name="modes" id="modes" value="1800">
1800</span> <span id='mode_1900'>
<input type=checkbox name="modes" id="modes" value="1900">
1900</span> <font color='red'>(1700模式必选)</font></td>
</li>
<li>
<label>验证码:</label>
<input name="validcode_source" ajaxurl="check.php?act=checkverify" datatype="n4-4" nullmsg="请输入验证码!" errormsg="验证码是4位数字!" style="width:130px;margin-right:15px;" maxlength="4" class="inpt" type="text" />
<img id="verifyImg" src="pub/this.php?r=+Math.random()" title="点击刷新验证码" style="cursor:pointer" onclick="javascript:this.src='/pub/this.php?r='+Math.random();return false;" height="25">
<input type="hidden" name="setup" value="1" /></li>
</ul>
<div class="btm">
<p>
<input class="sbtn" type="submit" value="" /> <a href="index.php" style="color:blue;" />登陆?</a> <span id="msgdemo2"></span>
</p>
</div>
</form>
</div>
</div>
</body>
</html>
<link rel="stylesheet" href="Public/validform/css/style.css" type="text/css" />
<script type="text/javascript" src="Public/validform/js/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="Public/validform/js/Validform_v4.0_min.js"></script>
<script type="text/javascript">
$(".loginform").Validform({
tiptype:function(msg,o,cssctl){
var objtip=$("#msgdemo2");
cssctl(objtip,o.type);
objtip.text(msg);
},
ajaxPost:false
});
</script>
这是注册页代码
#5
请问怎么改?
#1
没看到你的逻辑是怎么写的呀
#2
去掉 url 中的 tgurl
#3
别的代码不清楚,不过PHP里的不等于是 ! =而不是 <> 吧。
#4
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>用户注册</title>
<link rel="stylesheet" href="Public/css/skins.css" type="text/css" />
<style type="text/css">
body{background:#FFFFFF url(Public/images/body_bg.jpg) repeat-x top center;}
.b{width:660px;margin:0 auto;}
#header{width:100%;height:95px;overflow:hidden;}
.hc{width:800px;margin:0 auto;}
.logo{padding-top:15px;float:left}
.welcome{float:right;width:220px;height:28px;overflow:hidden;background:url(Public/images/login_v1.jpg) 0 0;margin-top:25px;line-height:28px;text-align:center;}
.mainwrap{padding-top:10px;}
#login{width:378px;margin:0 auto;zoom:1;overflow:hidden;border:1px solid #ccc;background:#fff;border-radius:4px;-webkit-border-radius:4px;-moz-border-radius:4px;-webkit-box-shadow:0 0 5px rgba(0, 0, 0, 0.1);-moz-box-shadow:0 0 5px rgba(0, 0, 0, 0.1);box-shadow:0 0 5px rgba(0, 0, 0, 0.1);position:relative;}
.hd{height:29px;line-height:29px;background:#f3f3f3;margin-top:1px;font-size:14px;font-weight:bold;padding:0 8px;}
.bd{margin:0 5px;zoom:1;overflow:hidden;border-bottom:1px dotted #ccc;padding:12px 0 0 20px;}
.bd li{height:45px;font-family:"宋体"}
.bd li img,.bd li a{position:relative}
.inpt{width:230px;padding:2px 3px;height:21px;line-height:21px;border:1px solid #ccc;zoom:1;border-radius:3px;box-shadow:0 1px 6px rgba(0,0,0,0.1);}
.btm{text-align:center;}
.btm p{padding:15px 0 8px 0;}
.sbtn{width:104px;height:30px;border:0;background:url(/static/v1/login_v10.png) 0 -260px no-repeat;cursor:pointer;}
#tip{position:absolute;line-height:17px;top:180px;color:#d41212;top:38px;left:115px;display:none}
li label{color:#4d4d4d;font-size:14px;font-family:新細明體,Tahoma,Arial,Helvetica,sans-serif;}
</style>
</head>
<body>
<div id="header">
<div class="hc">
<div class="logo"><img src="Public/images/logo.png"></div>
<div class="welcome">XXX <a href="#" target="_blank">欢迎您</a></div>
</div>
</div>
<?php
if($_GET['tgurl'] <> '' && $_GET['tgurl'] <> NULL){
require_once('pub/connect.php');
$row = $db->getone("select userid,username from user where tg_code = '$_GET[tgurl]'");
}
?>
<div class="mainwrap">
<div id="login">
<div class="hd">用户注册</div>
<div style="clear:both;"></div>
<form method="post" class="loginform" action="post_login.php?act=register">
<ul class="bd">
<li>
<label>登陆用户:</label>
<input name="username" class="inpt" type="text" value="" datatype="*" ajaxurl="check.php?act=unhasuser" nullmsg="请输入用户名!" errormsg="请输入用户名!" />
</li>
<li>
<label>登陆密码:</label>
<input name="password" class="inpt" type="password" value="" datatype="*6-16" nullmsg="请输入密码!" errormsg="密码为6-15位!" />
</li>
<li>
<label>确认密码:</label>
<input name="password2" class="inpt" type="password" value="" tip="test" class="inputxt" datatype="*6-15" recheck="password" nullmsg="请再输入一次密码!" errormsg="再次密码不一致!" />
</li>
<li>
<label>Q Q 号码:</label>
<input name="qqnum" class="inpt" type="text" value="" />
</li>
<?php
if($row){
$chaseconfig = $db->getone("select Recommend from system order by id");
?>
<li>
<label>推 荐 人:</label>
<span style="color:red;font-size:14px;font-weight:bold;"><?php if($chaseconfig['Recommend'] == 'yes'){ echo $row['username']; }else{ echo "暂未开放推广注册";} ?></span><input type="hidden" name="higherid" value="<?php if($chaseconfig['Recommend'] == 'yes'){ echo $row['userid']; }else{ echo 0; } ?>" />
</li>
<?php } ?>
<li>
<label>奖金模式:</label>
<td><span id='mode_1700'>
<input type=checkbox name="modes" id="modes" value="1700">
1700</span><span id='mode_1800'>
<input type=checkbox name="modes" id="modes" value="1800">
1800</span> <span id='mode_1900'>
<input type=checkbox name="modes" id="modes" value="1900">
1900</span> <font color='red'>(1700模式必选)</font></td>
</li>
<li>
<label>验证码:</label>
<input name="validcode_source" ajaxurl="check.php?act=checkverify" datatype="n4-4" nullmsg="请输入验证码!" errormsg="验证码是4位数字!" style="width:130px;margin-right:15px;" maxlength="4" class="inpt" type="text" />
<img id="verifyImg" src="pub/this.php?r=+Math.random()" title="点击刷新验证码" style="cursor:pointer" onclick="javascript:this.src='/pub/this.php?r='+Math.random();return false;" height="25">
<input type="hidden" name="setup" value="1" /></li>
</ul>
<div class="btm">
<p>
<input class="sbtn" type="submit" value="" /> <a href="index.php" style="color:blue;" />登陆?</a> <span id="msgdemo2"></span>
</p>
</div>
</form>
</div>
</div>
</body>
</html>
<link rel="stylesheet" href="Public/validform/css/style.css" type="text/css" />
<script type="text/javascript" src="Public/validform/js/jquery-1.6.2.min.js"></script>
<script type="text/javascript" src="Public/validform/js/Validform_v4.0_min.js"></script>
<script type="text/javascript">
$(".loginform").Validform({
tiptype:function(msg,o,cssctl){
var objtip=$("#msgdemo2");
cssctl(objtip,o.type);
objtip.text(msg);
},
ajaxPost:false
});
</script>
这是注册页代码
#5
请问怎么改?