hola,
can anyone give me a hand trouble shooting the below? I created a login form and it's been working fine for ages now. I recently used phpmyadmin to change the name of one of the columns b/c it was confusing and now the login page no longer works (yes, I did change the column name in the script 😉 )
<?php
session_start();
header ("Cache-control: private");
if ($_SESSION['usertype']){
header ("Location: [url]http://www.gnossos.com/test/development/pick_schedule.php[/url]");
exit;
}
if($_POST['username']){
require("../files/db_func.php");
require("../files/verify.php");
$table;
$dbname = "internal";
$username = filter($_POST['username']);
$password = filter($_POST['password']);
$sql = "SELECT * FROM user WHERE user_name = '$username' AND password = '$password'";
$result = connect($table, $sql, $dbname);
if($result){
if(mysql_num_rows($result) > 0){
while($row = mysql_fetch_array($result)){
$_SESSION['user'] = $row['user_name'];
}
}
switch ($_SESSION['user']) {
case "support":
if($_POST['date']){
header ("Location: schedule?date=".$_POST['date']);
exit;
}
header ("Location: pick_schedule.php");
exit;
break;
case "support_admin" :
if($_POST['date']){
header ("Location: schedule?date=".$_POST['date']);
exit;
}
header ("Location: pick_schedule.php");
exit;
break;
default :
header ("Location: support_login.php");
exit;
}
}
}
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.1//EN\" \"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd\">\n".
"<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"en\">\n".
"<head>\n".
"<title>Gnossos Software - extranet support schedule</title>\n".
"<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" />\n".
"<meta http-equiv=\"Content-Style-Type\" content=\"text/css\"/>\n".
"<link rel=\"shortcut icon\" href=\"../favicon.ico\" type=\"image/x-icon\" />\n".
"<link rel=\"stylesheet\" href=\"../files/style.css\" />\n".
"</head>\n".
"<body>\n".
"<table>";
echo "<form action = \"".$_SERVER['PHP_SELF']."\" method=\"post\" name=\"support_login\" />";
if(strstr($_SERVER['HTTP_REFERER'], "support_login.php")){
echo "<span class=\"error\">I'm sorry, but the username or password you entered was incorrect</span>\n";
}
echo "<p>\n".
"Username:<br />\n".
"<input type=\"text\" name=\"username\" size=\"20\" maxlength=\"20\" /><br /></p>\n".
"<p>\n".
"Password:<br />\n".
"<input type=\"password\" name=\"password\" size=\"20\" maxlength=\"20\" /><br /></p>\n".
"<input type=\"hidden\" name=\"date\" value=\"".$_GET['date']."\" />\n".
"<input type=\"submit\" name=\"submit\" value=\"login\" /></span><br />\n".
"</form>".
"</table>".
"</body>".
"</html>";
?>
any insight greatly apprecaited! - oh, btw, the $table variable declared but not initialized is not used by the connect function, just have it as part of the function in case I wanted to use it for something down the road.