Hey everyone ive done my research and i find im still stuck many people said to put @ sign before the variable but it does not seem to be working, so my code gives me this error
Notice: Undefined index: 2 in login.php on line 20
my code is
if( isset($_REQUEST['email']) || isset($_REQUEST['pwd']) || $_REQUEST['email'] != "" || $_REQUEST['pwd'] != "" )
{
$inputFile = fopen("members.txt", "r");
$found = false;
$i =0;
//read the read.txt until the end of file
while(!feof($inputFile) && $found == false)
{
$line = fgets($inputFile);
// replace the special charater within the lines by there proper entity code
$lineArray = preg_split("/\,/", (string)$line);
if ($_REQUEST['email'] === $lineArray['2'] && $_REQUEST['pwd'] === $lineArray['4'])
{
session_start();
$found = true;
$useremail=$_REQUEST['email'];
$password= $_REQUEST['pwd'];
//time to set sessions and stuff
$_SESSION['useremail'] = $useremail;
$_SESSION['password'] = $password;
//send the redirect header
header('Location: index.php');
exit();
}
}
fclose($inputFile);
}
so the line its referring to is
if ($_REQUEST['email'] === $lineArray['2'] && $_REQUEST['pwd'] === $lineArray['4'])
ive tried many other variation such as removing single quotes adding @ in front of the $lineArray and doing both, can anyone help me out the values are there when i was printing them out but when it get to this if statement it doesn't turn to equal and it give me this error.
if also tried
if ($_REQUEST['email'] === $lineArray[2] && $_REQUEST['pwd'] === $lineArray[4])
and
if ($_REQUEST['email'] === @$lineArray[2] && $_REQUEST['pwd'] === @$lineArray[4])
$_requestbetter go for$_getor$_post