小弟给大家分享一下 一个关于php登陆的问题
<?
//验证用户登录状态
if(!defined("IN_JOBS"))
{
die( "myjobs is not loaded, system halt." );
}
$RedUrl = $_COOKIE['RedUrl'];
if ($RedUrl!=''){
$username = $_COOKIE['username'];
switch ($RedUrl){
case 0:
$jobid = $_COOKIE['jobid'];
$query = $db->query("SELECT * FROM ".PREFIX."personal WHERE jobid='$jobid' AND username='$username'");
$enet = "personal/main.php?act=center";
$lnet = "personal/main.php?act=logout";
break;
case 1:
$comid = $_COOKIE['comid'];
$query = $db->query("SELECT * FROM ".PREFIX."enterprise WHERE comid='$comid' AND username='$username'");
$enet = "enterprise/main.php?act=CompanyCenter";
$lnet = "enterprise/main.php?act=logout";
break;
case 2:
$schoolid = $_COOKIE['schoolid'];
$query = $db->query("SELECT * FROM ".PREFIX."school WHERE schoolid='$schoolid' AND username='$username'");
$enet = "school/main.php?act=Center";
$lnet = "school/main.php?act=logout";
break; }
$nums = $db->num_rows($query);
if ($nums==0){
$logins = "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<form name=\"login\" method=\"post\" action=\"loginchk.php\" onSubmit=\"return login_check();\">
<tr>
<td width=\"60\" height=\"30\" align=\"right\">用户名:</td>
<td height=\"30\"> <input name=\"username\" type=\"text\" class=\"input_10\" size=\"16\" style=\"width:100px;\"></td>
</tr>
<tr>
<td width=\"60\" height=\"30\" align=\"right\">密 码:</td>
<td height=\"30\"> <input name=\"password\" type=\"password\" class=\"input_10\" size=\"16\" style=\"width:100px;\"></td>
</tr>
<tr>
<td width=\"60\" height=\"30\" align=\"right\">类 型:</td>
<td height=\"30\"> <select name=\"usertype\" class=\"input_10\" style=\"width:100px;\">
<option value=\"person\" selected>--个人会员--</option>
<option value=\"company\">--企业会员--</option>
<option value=\"school\">--院校会员--</option>
</select></td>
</tr>
<tr align=\"center\" valign=\"bottom\">
<td height=\"30\" colspan=\"2\"> <input name=\"imageField\" type=\"image\" src=\"images/index_login.gif\" width=\"60\" height=\"20\" border=\"0\">
<a href=\"register.php\"><img src=\"images/index_reg.gif\" width=\"60\" height=\"20\" border=\"0\"></a> <input name=\"act\" type=\"hidden\" id=\"act\" value=\"login\" /></td>
</tr>
<tr align=\"center\">
<td height=\"30\" colspan=\"2\"><img src=\"images/icon34.gif\" width=\"12\" height=\"16\"><a href=\"register.php\"><font color=\"#666666\">
免费注册</font></a> <img src=\"images/icon34.gif\" width=\"12\" height=\"16\">
<a href=\"getPassWord.php\"><font color=\"#666666\">忘记密码</font></a></td>
</tr>
</form>
</table>";
}else {
$logins = "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<tr align=\"center\">
<td height=\"27\" colspan=\"2\">您好,『 <Font color=\"#ff0000\"><u>".$username."</u></Font>
』</td>
</tr>
<tr align=\"center\">
<td height=\"27\" colspan=\"2\">欢迎使用招聘网</td>
</tr>
<tr align=\"center\">
<td height=\"27\" colspan=\"2\"><a href=".$lnet."><u>退出</u></a>
<a href=".$enet."><u>进入管理专区</u></a></td>
</tr>
</table>";
}
}else {$logins = "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<form name=\"login\" method=\"post\" action=\"loginchk.php\" onSubmit=\"return login_check();\">
<tr>
<td width=\"60\" height=\"30\" align=\"right\">用户名:</td>
<td height=\"30\"> <input name=\"username\" type=\"text\" class=\"input_10\" size=\"16\" style=\"width:100px;\"></td>
</tr>
<tr>
<td width=\"60\" height=\"30\" align=\"right\">密 码:</td>
<td height=\"30\"> <input name=\"password\" type=\"password\" class=\"input_10\" size=\"16\" style=\"width:100px;\"></td>
</tr>
<tr>
<td width=\"60\" height=\"30\" align=\"right\">类 型:</td>
<td height=\"30\"> <select name=\"usertype\" class=\"input_10\" style=\"width:100px;\">
<option value=\"person\" selected>--个人会员--</option>
<option value=\"company\">--企业会员--</option>
<option value=\"school\">--院校会员--</option>
</select></td>
</tr>
<tr align=\"center\" valign=\"bottom\">
<td height=\"30\" colspan=\"2\"> <input name=\"imageField\" type=\"image\" src=\"images/index_login.gif\" width=\"60\" height=\"20\" border=\"0\">
<a href=\"register.php\"><img src=\"images/index_reg.gif\" width=\"60\" height=\"20\" border=\"0\"></a> <input name=\"act\" type=\"hidden\" id=\"act\" value=\"login\" /></td>
</tr>
<tr align=\"center\">
<td height=\"30\" colspan=\"2\"><img src=\"images/icon34.gif\" width=\"12\" height=\"16\"><a href=\"register.php\"><font color=\"#666666\">
免费注册</font></a> <img src=\"images/icon34.gif\" width=\"12\" height=\"16\">
<a href=\"getPassWord.php\"><font color=\"#666666\">忘记密码</font></a></td>
</tr>
</form>
</table>";}
?>详细信息 [utl=http://www.ithuhang.com] www.ithuhang.com [/url]
<?
//验证用户登录状态
if(!defined("IN_JOBS"))
{
die( "myjobs is not loaded, system halt." );
}
$RedUrl = $_COOKIE['RedUrl'];
if ($RedUrl!=''){
$username = $_COOKIE['username'];
switch ($RedUrl){
case 0:
$jobid = $_COOKIE['jobid'];
$query = $db->query("SELECT * FROM ".PREFIX."personal WHERE jobid='$jobid' AND username='$username'");
$enet = "personal/main.php?act=center";
$lnet = "personal/main.php?act=logout";
break;
case 1:
$comid = $_COOKIE['comid'];
$query = $db->query("SELECT * FROM ".PREFIX."enterprise WHERE comid='$comid' AND username='$username'");
$enet = "enterprise/main.php?act=CompanyCenter";
$lnet = "enterprise/main.php?act=logout";
break;
case 2:
$schoolid = $_COOKIE['schoolid'];
$query = $db->query("SELECT * FROM ".PREFIX."school WHERE schoolid='$schoolid' AND username='$username'");
$enet = "school/main.php?act=Center";
$lnet = "school/main.php?act=logout";
break; }
$nums = $db->num_rows($query);
if ($nums==0){
$logins = "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<form name=\"login\" method=\"post\" action=\"loginchk.php\" onSubmit=\"return login_check();\">
<tr>
<td width=\"60\" height=\"30\" align=\"right\">用户名:</td>
<td height=\"30\"> <input name=\"username\" type=\"text\" class=\"input_10\" size=\"16\" style=\"width:100px;\"></td>
</tr>
<tr>
<td width=\"60\" height=\"30\" align=\"right\">密 码:</td>
<td height=\"30\"> <input name=\"password\" type=\"password\" class=\"input_10\" size=\"16\" style=\"width:100px;\"></td>
</tr>
<tr>
<td width=\"60\" height=\"30\" align=\"right\">类 型:</td>
<td height=\"30\"> <select name=\"usertype\" class=\"input_10\" style=\"width:100px;\">
<option value=\"person\" selected>--个人会员--</option>
<option value=\"company\">--企业会员--</option>
<option value=\"school\">--院校会员--</option>
</select></td>
</tr>
<tr align=\"center\" valign=\"bottom\">
<td height=\"30\" colspan=\"2\"> <input name=\"imageField\" type=\"image\" src=\"images/index_login.gif\" width=\"60\" height=\"20\" border=\"0\">
<a href=\"register.php\"><img src=\"images/index_reg.gif\" width=\"60\" height=\"20\" border=\"0\"></a> <input name=\"act\" type=\"hidden\" id=\"act\" value=\"login\" /></td>
</tr>
<tr align=\"center\">
<td height=\"30\" colspan=\"2\"><img src=\"images/icon34.gif\" width=\"12\" height=\"16\"><a href=\"register.php\"><font color=\"#666666\">
免费注册</font></a> <img src=\"images/icon34.gif\" width=\"12\" height=\"16\">
<a href=\"getPassWord.php\"><font color=\"#666666\">忘记密码</font></a></td>
</tr>
</form>
</table>";
}else {
$logins = "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<tr align=\"center\">
<td height=\"27\" colspan=\"2\">您好,『 <Font color=\"#ff0000\"><u>".$username."</u></Font>
』</td>
</tr>
<tr align=\"center\">
<td height=\"27\" colspan=\"2\">欢迎使用招聘网</td>
</tr>
<tr align=\"center\">
<td height=\"27\" colspan=\"2\"><a href=".$lnet."><u>退出</u></a>
<a href=".$enet."><u>进入管理专区</u></a></td>
</tr>
</table>";
}
}else {$logins = "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
<form name=\"login\" method=\"post\" action=\"loginchk.php\" onSubmit=\"return login_check();\">
<tr>
<td width=\"60\" height=\"30\" align=\"right\">用户名:</td>
<td height=\"30\"> <input name=\"username\" type=\"text\" class=\"input_10\" size=\"16\" style=\"width:100px;\"></td>
</tr>
<tr>
<td width=\"60\" height=\"30\" align=\"right\">密 码:</td>
<td height=\"30\"> <input name=\"password\" type=\"password\" class=\"input_10\" size=\"16\" style=\"width:100px;\"></td>
</tr>
<tr>
<td width=\"60\" height=\"30\" align=\"right\">类 型:</td>
<td height=\"30\"> <select name=\"usertype\" class=\"input_10\" style=\"width:100px;\">
<option value=\"person\" selected>--个人会员--</option>
<option value=\"company\">--企业会员--</option>
<option value=\"school\">--院校会员--</option>
</select></td>
</tr>
<tr align=\"center\" valign=\"bottom\">
<td height=\"30\" colspan=\"2\"> <input name=\"imageField\" type=\"image\" src=\"images/index_login.gif\" width=\"60\" height=\"20\" border=\"0\">
<a href=\"register.php\"><img src=\"images/index_reg.gif\" width=\"60\" height=\"20\" border=\"0\"></a> <input name=\"act\" type=\"hidden\" id=\"act\" value=\"login\" /></td>
</tr>
<tr align=\"center\">
<td height=\"30\" colspan=\"2\"><img src=\"images/icon34.gif\" width=\"12\" height=\"16\"><a href=\"register.php\"><font color=\"#666666\">
免费注册</font></a> <img src=\"images/icon34.gif\" width=\"12\" height=\"16\">
<a href=\"getPassWord.php\"><font color=\"#666666\">忘记密码</font></a></td>
</tr>
</form>
</table>";}
?>详细信息 [utl=http://www.ithuhang.com] www.ithuhang.com [/url]
用单引吧。
$table = '<input name="" />';