Meta HTTP refresh problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Recently, during a rewrite of my login page, the Meta Refresh I am using suddenly stopped working. I've tried using it by echoing it with php and by just using it in HTML. I've also tried using a javascript redirect with no luck either. Any thoughts on how to debug and what might be holding me up?

Thanks for the help. -John

The code for the refresh:
echo "<META HTTP-EQUIV=REFRESH CONTENT=\"0;URL=main_page.php\">";

I know that the refresh is actually being sent to the browser because I can read it in the HTML source of the output page and can see the test echo.

I also know that it isn't an issue with my configuration, because I am using a meta http refresh on other pages that are working fine. I am running php 4.3.7 on Apache 2.0.49

Here's the entire code for my login page:
<?php
/*
* login.php - Authenticates user. Usernames and passwords are stored
* in a MySQL database called 'compass'. The table that contains this information is
* called 'users'
*
* sessionn_start(); MUST be the very first line of the program
* or else an error will be generated. This is a PHP specification.
*****/
session_start();
header("Cache-control: private"); //IE 6 Fix
$_SESSION['sessionUserId'] = "";


//This function simply prints out the login screen
function printLogin() {
echo "<center>Compass Project</center>";
echo "<br><br>";
echo "<center>";
echo "<table>";
echo "<form method=\"POST\" action=\"login.php\">";
echo "<tr class=\"login\">";
echo "<td class=\"login\">Username: </td><td><input type=\"text\" name=\"userName\" value=\"\" size=20></td>";
echo "</tr>";
echo "<tr class=\"login\">";
echo "<td class=\"login\">Password: </td><td><input type=\"password\" name=\"password\" value=\"\" size=20
></td>";
echo "</tr>";
echo "<tr class=\"login\"><td></td><td align=\"center\"><input type=\"submit\" name=\"login\" value=\"Login
\"></td></tr>";
echo "</form>";
echo "</table>";
echo "</center>";
}


//Include template head
include_once 'templateHead.php';

//Check to see if the user submitted a login
if(isset($_POST["userName"])){

//Get PEAR DB
require_once 'dbCompassConnect.php';

//Fetch the user's credintials and check their password
$postUserName = $_POST["userName"];
$user = $db->getRow("SELECT user_id, user_name, password, template, first_access FROM users WHERE user_name = '$p
ostUserName'");


$myUserId = $user[0];
$myUserName = $user[1];
$myPassword = $user[2];
$myTemplate = $user[3];

//Check to see if password matches
if ($_POST["password"] == $myPassword){

//Store myUserId and myTemplate for use in my session
$_SESSION['sessionUserId'] = $myUserId;
$_SESSION['myTemplate'] = $myTemplate;

//Test to see if you actually got to this part
echo "You should be going somewhere!";
echo "<META HTTP-EQUIV=REFRESH CONTENT=\"0;URL=main_page.php\">";
} else {
printLogin();
echo "<br><center>Invalid username/password</center>";
}

}else{
printLogin();
}

//Include the tail template
include_once 'templateTail.php';

?>

. . . . . . . . . .

My dbCompassConnect.php file:

<?php

//Get PEAR DB
require 'DB.php';

//Make the connection - username and password are fake for security
$db = DB::connect('mysql://username:password@localhost/compass');

//Check for database connection errors
if (DB::isError($db)) { die("Can't connect: " . $db->getMessage()); }

?>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux