issue with share server and crypt
Question
Not sure why, but on my VPS server and my local MacBook Pro. The code works but as soon as I use it on the clients server which is shared I get this error.
<br />
<b>Notice</b>: Undefined variable: njahhya in <b>/clientdata/zeus-dynamic-1/i/n/incard.com.au/www/telesales/system/classes/core.php</b> on line <b>13</b><br />
0<br />
<b>Notice</b>: Undefined index: task in <b>/clientdata/zeus-dynamic-1/i/n/incard.com.au/www/telesales/system/classes/core.php</b> on line <b>68</b><br />
I know that they use a shared server, so I am not surprised but I really need it to work, is there any work around?
$key = "$2a$07$ikuatfc$";
$this->password = crypt($password, $key);
Solution
I'm pretty sure the first notice is the result of "$2a$07$ikuatfc$"
being in double quotes. Variables in double quotes are interpolated:
$foo = 'bar';
echo "Hello $foo"; // Hello bar
"$2a$07$ikuatfc$"
is full of possible variable names. You should write it in single quotes to avoid variable interpolation: '$2a$07$ikuatfc$'
.
The larger issue is likely that on your development machines you have error reporting turned off, while on the production server error reporting is turned on by default. Turn on error reporting during development, fix all errors, turn error reporting off on production.