Monday, January 21, 2019

php - crypt password get Parse error: syntax error, unexpected '[' in




i developed mvc with php and mysql and pdo in hosting the site appeared this problem in the admin control panel i created its in the login controller




the problem is as shown in browser




Parse error: syntax error, unexpected '[' in /home/trustlabseg/public_html/test/app/C_LoginController.php on line 21




i searched for all the same error in here and its not like that no one solve my problem



the code is




  $password = crypt($_POST['password'], PASSWORD_BCRYPT, ['cost' => 12]);

$rules = [
"username" => "checkReguired|checkStrings",
"password" => "checkReguired"
];


when i delete the last line the page load but still canot loging
please little help here

and thanks alot


Answer



Use array() for older PHP versions. Additionally, it is spelled "required" (as in to require).



$password = crypt($_POST['password'], PASSWORD_BCRYPT, array('cost' => 12));
$rules = array("username" => "checkRequired|checkStrings", "password" => "checkRequired");

No comments:

Post a Comment

plot explanation - Why did Peaches' mom hang on the tree? - Movies & TV

In the middle of the movie Ice Age: Continental Drift Peaches' mom asked Peaches to go to sleep. Then, she hung on the tree. This parti...