Jump to content

Help needed.


whizzykid

Recommended Posts

My codes is suppose to allow people login into their different profile but it does instead it takes all of them to a particular place.

 

my code.

 $insertGoTo = "6.gif";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));
}

mysql_select_db($database_y_y, $y_ggh);
$query_Recordset2 = "SELECT * FROM login";
$Recordset2 = mysql_query($query_Recordset2, $bay_by) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);
?>
<?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['Login_ID'])) {
  $loginUsername=$_POST['Login_ID'];
  $password=$_POST['Password'];
  $MM_fldUserAuthorization = "";
  $MM_redirectLoginSuccess = "profile_".$profile[0] .".php";
  $MM_redirectLoginFailed = "bv01001_hover.png";
  $MM_redirecttoReferrer = false;
  mysql_select_db($database_bley_bay, $bley_blay);
  
  $LoginRS__query=sprintf("SELECT `Login ID`, `Password` FROM `login` WHERE `Login ID`=%s AND `Password`=%s",
    GetSQLValueString($loginUsername, "-1"), GetSQLValueString($password, "-1")); 
   
  $LoginRS = mysql_query($LoginRS__query, $bey_bay) 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'];	
    }	else {
	$profile = mysql_fetch_array($LoginRS);
	$MM_redirectLoginSuccess = "profile_".$profile[0] .".php";
    }
    header("Location: " . $MM_redirectLoginSuccess );
  }
  else {
    header("Location: ". $MM_redirectLoginFailed );
  }
}

?>

Link to comment
https://forums.phpfreaks.com/topic/177893-help-needed/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.