PHP user login HELP needed

I have a page that is hosted by Yahoo. I am creating the page using Dreamweaver. The page is saved as .php. I have set-up MySQL and MyPHPadmin. I have created my database and table with no problems. I have created my recordset in DW and tested it. The info from the table appears as it should. I post the page through Yahoo and it looks like it should. When I enter a valid username and password and hit the login button it returns me to the login page. I have specified the proper page for successful login and a redirect for failed attempts, but the login page always brings me right back. WTF? Help please.

Here is my code:


i am testing to see if this text appears is it here



<?php virtual('/Connections/loginDB.php'); ?> <?php mysql_select_db($database_loginDB, $loginDB); $query_Recordset1 = "SELECT * FROM logins"; $Recordset1 = mysql_query($query_Recordset1, $loginDB) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); ?> <?php // *** Validate request to login to this site. if (!isset($_SESSION)) { session_start(); }

$loginFormAction = $_SERVER[‘PHP_SELF’];
if (isset($_GET[‘accesscheck’])) {
$_SESSION[‘PrevUrl’] = $_GET[‘accesscheck’];

if (isset($_POST[‘Username’])) {
$MM_fldUserAuthorization = “”;
$MM_redirectLoginSuccess = “”;
$MM_redirectLoginFailed = “/failed.php”;
$MM_redirecttoReferrer = false;
mysql_select_db($database_loginDB, $loginDB);

$LoginRS__query=sprintf(“SELECT Username, password FROM logins WHERE Username=’%s’ AND password=’%s’”,
get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));

$LoginRS = mysql_query($LoginRS__query, $loginDB) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = “”;

//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;	      

if (isset($_SESSION['PrevUrl']) && false) {
  $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];	
header("Location: " . $MM_redirectLoginSuccess );

else {
header("Location: ". $MM_redirectLoginFailed );

<?php mysql_free_result($Recordset1); ?>


Admin Edit: Added the PHP code tags in phpBB format for readability. Please see for Posting Guidelines

Sponsor our Newsletter | Privacy Policy | Terms of Service