This is a section below of my login script:
$email = $_POST['email'];
$password = $_POST['password'];
$salt = "$2a$10$R.Baj0mvj5doNvtvzDjwP5$";
$crypt_pass=crypt($password,$salt);
$query = $db->prepare('SELECT * FROM Consultants WHERE email = :email');
$query->bindParam(":email",$email);
$results = $query->execute();
$total = $query->rowCount();
$row = $query->fetch();
The error:
“PHP Notice: Undefined variable: R in /Users/Sites/pages/login.php on line 6” This is the line of which the error occurs – $salt = “$2a$10$R.Baj0mvj5doNvtvzDjwP5$”;
The dollar signs are being interpreted as variables. You either need to escape them:
or use single quotes:
The reason why the ‘R’ is being singled out is variables names that start with numbers are not valid in PHP.