Ok. This has been doing my head-in for 2hrs now.
I am trying to save to array all the secured passwords generated.
Everytime I refresh the browser, a new secure password gets generated and gets saved to array.
Problem is, all previous saved data from array gets deleted on every page refresh. Why is that ? Tried saving to session but no luck.
Look …
Notice the comments …
I even tried concatenating but no luck. Like so:
[code]
$secured_passwords_array[] .= $secured_password; //Dump current secured password to array.
[code]
if(!session_id())
{
session_start();
}
$password = ‘password’;
$salts = array(‘121′,’gulf’,’¬’,’;@/’);
$salts_count = count($salts)-1;
echo ‘Line: ‘ .__LINE__; echo ‘<br>’;
echo $rand = rand(0,$salts_count); echo ‘<br>’;
if(EMPTY($_SESSION[‘secured_passwords_array’]))
{
echo ‘Line: ‘ .__LINE__; echo ‘<br>’;
$secured_passwords_array = array();
//die;
}
echo ‘Current hashed salted password: ‘.$hashed_salted_password = hash(‘sha256’,$password.$salts[$rand]);; echo ‘<br>’;
echo ‘Line: ‘ .__LINE__; echo ‘<br>’;
echo ‘Current secured password: ‘.$secured_password = password_hash($hashed_salted_password,PASSWORD_DEFAULT); echo ‘<br>’;
$secured_passwords_array[] .= $secured_password; //Dump current secured password to array.
$_SESSION[‘secured_passwords_array’] = $secured_passwords_array; //Saving to session incase browser refreshing erases all data saved to array.
echo ‘Line: ‘ .__LINE__; echo ‘<br>’;
//1st Attempt to recall all secured passwords saved to array.
foreach($secured_passwords_array AS $secured_password_submitted)
{
echo ‘secured password submitted: ‘.$secured_password_submitted; echo ‘<br>’; //RESULT: Failing to show all saved data from array.
}
//2nd Attempt to recall all secured passwords saved to array.
foreach($_SESSION[‘secured_passwords_array’] AS $secured_password_submitted)
{
echo ‘secured password submitted: ‘.$secured_password_submitted; echo ‘<br>’; //RESULT: Failing to show all saved data from array.
}
echo ‘All secured passwords submitted: ‘; print_r($secured_passwords_array); echo ‘<br>’;
echo ‘All secured passwords submitted: ‘; print_r($_SESSION[‘secured_passwords_array’]); echo ‘<br>’;
echo ‘Line: ‘ .__LINE__; echo ‘<br>’;
What the heck is wrong ?
4am here. Going to bed very gloomy!
>@novice2022#1645737 all previous saved data from array gets deleted on every page refresh. Why is that ? Tried saving to session but no luck.
<i>
</i>echo 'Current hashed salted password: '.$hashed_salted_password = hash('sha256',$password.$salts[$rand]);; echo '<br>';
echo 'Current secured password: '.$secured_password = password_hash($hashed_salted_password,PASSWORD_DEFAULT); echo '<br>';
$secured_passwords_array[] .= $secured_password; //Dump current secured password to array.
$_SESSION['secured_passwords_array'] = $secured_passwords_array; //Saving to session incase browser refreshing erases all data saved to array.
//1st Attempt to recall all secured passwords saved to array.
foreach($secured_passwords_array AS $secured_password_submitted)
{
echo 'secured password submitted: '.$secured_password_submitted; echo '<br>'; //RESULT: Failing to show all saved data from array.
}
//2nd Attempt to recall all secured passwords saved to array.
foreach($_SESSION['secured_passwords_array'] AS $secured_password_submitted)
{
echo 'secured password submitted: '.$secured_password_submitted; echo '<br>'; //RESULT: Failing to show all saved data from array.
}
<i>
</i>echo 'Current hashed salted password: '.$hashed_salted_password = hash('sha256',$password.$salts[$rand]);; echo '<br>';
echo 'Current secured password: '.$secured_password = password_hash($hashed_salted_password,PASSWORD_DEFAULT); echo '<br>';
$secured_passwords_array[] .= $secured_password; //Dump current secured password to array.
$_SESSION['secured_passwords_array'] = $secured_passwords_array; //Saving to session incase browser refreshing erases all data saved to array.
//1st Attempt to recall all secured passwords saved to array.
echo 'All secured passwords submitted: '; print_r($secured_passwords_array); echo '<br>';
//2nd Attempt to recall all secured passwords saved to array.
echo 'All secured passwords submitted: '; print_r($_SESSION['secured_passwords_array']); echo '<br>';
<i>
</i>
$password = 'password';
$salts = array('121','gulf','¬',';@/');
$salts_count = count($salts)-1;
echo 'Current hashed salted password: '.$secured_password = hash('sha256',$password.$salts[$rand]);; echo '<br>';
$secured_passwords_array[] .= $secured_password; //Dump current secured password to array.
$_SESSION['secured_passwords_array'] = $secured_passwords_array;
echo 'All secured passwords submitted: '; print_r($_SESSION['secured_passwords_array']); echo '<br>';
<i>
</i>$_SESSION['secured_passwords_array'] .= $secured_passwords_array;
<i>
</i>$password = 'password';
$salts = array('121','gulf','¬',';@/');
$salts_count = count($salts)-1;
echo 'Current hashed salted password: '.$secured_password = hash('sha256',$password.$salts[$rand]);; echo '<br>';
$secured_passwords_array[] .= $secured_password; //Dump current secured password to array.
$_SESSION['secured_passwords_array'] = $secured_passwords_array;
foreach($_SESSION['secured_passwords_array'] AS $secured_password_submitted)
{
echo 'secured password submitted: '.$secured_password_submitted; echo '<br>'; //RESULT: Failing to show all saved data from array.
}
<i>
</i>$_SESSION['secured_passwords_array'] .= $secured_passwords_array;
<i>
</i>$_SESSION['secured_passwords_array'] .= $secured_passwords_array;
<i>
</i>$secured_passwords_array[] .= $secured_password;
<i>
</i>session_start();
>@novice2022#1645755 //1st Attempt to recall all secured passwords saved to array.
>@novice2022#1645755 echo 'Current secured password: '.$secured_password = password_hash($hashed_salted_password,PASSWORD_DEFAULT); echo '<br>';
password_hash()
hash()
>@novice2022#1645754 It's all about fiddling with SALTing
[code=php]
<-? php // remove the hyphen!
$passwords = [
'badpassword',
'BetterPassword2',
'Akc23%asjX9_16Qxd'
];
$salts = [
'1357',
'ABcd',
'Ab1Cd2'
];
foreach($passwords as $password) {
foreach($salts as $salt) {
printf(
"The hash of '%s' with salt '%s' is '%s'n",
$password,
$salt,
hash('sha256', $password . $salt)
);
}
}
[/code]
[code=text]
$ php whatever-you-saved-it-as.php
The hash of 'badpassword' with salt '1357' is '9bca97b8b0c89cd8bcfcf669279f52361f40b150059beb161b07289d3bef65f4'
The hash of 'badpassword' with salt 'ABcd' is '46d5abd162be13c1fde3a67483127b7d7fb6844c35438bc3b0947ff9b765ef78'
The hash of 'badpassword' with salt 'Ab1Cd2' is 'a9bcaf01ad2c31bb3b8d206f8c3a7868697bd0a2111ebaf83fceaff485cf5c03'
The hash of 'BetterPassword2' with salt '1357' is '3022f6d0508328310636ce4504db9183ffecc89bf1f703382c4850b76679d4a9'
The hash of 'BetterPassword2' with salt 'ABcd' is '1c40bd918d3f2b61495453810243de17adb4883ad159812d61541a87699a030c'
The hash of 'BetterPassword2' with salt 'Ab1Cd2' is '04840aa270d3e8c464f68c3d52b183304997713c20cb3cf63b2e695c12dfd964'
The hash of 'Akc23%asjX9_16Qxd' with salt '1357' is 'fee1f095392d6de316598625e38e2b037aeb397cf10afa3d259f271b095f25cd'
The hash of 'Akc23%asjX9_16Qxd' with salt 'ABcd' is '0ddcf26bbf70c27adb82702bdee9514c4fc03d4e89b6e3cff018ac4abc96fafe'
The hash of 'Akc23%asjX9_16Qxd' with salt 'Ab1Cd2' is 'd2a13abe3b2fac8974dd67a20169bcace132a258816be578e902bdbebe663346'
[/code]
hash()
<i>
</i>foreach(array($_SESSION['secured_passwords_array']) AS $secured_password_submitted)
{
echo 'secured password submitted: '.$secured_password_submitted; echo '<br>'; //RESULT: Failing to show all saved data from array.
}
<i>
</i>$secured_passwords_array = array();
<i>
</i>if(!ISSET($_SESSION['secured_passwords_array']) OR EMPTY($_SESSION['secured_passwords_array']))
{
echo 'Line: ' .__LINE__; echo '<br>';
$secured_passwords_array = array();
}
<i>
</i>$secured_passwords_array = array();
<i>
</i>if(!ISSET($_SESSION['secured_passwords_array']) OR EMPTY($_SESSION['secured_passwords_array']))
{
echo 'Line: ' .__LINE__; echo '<br>';
$secured_passwords_array = array();
}
<i>
</i>if(EMPTY($_SESSION['secured_passwords_array']))
{
echo 'Line: ' .__LINE__; echo '<br>';
$secured_passwords_array = array();
}
<i>
</i>$secured_passwords_array[] = $secured_password; //Dump current secured password to array.
$_SESSION['secured_passwords_array'] = $secured_passwords_array[]; //Save array to session.
<i>
</i>$_SESSION['secured_passwords_array'] = $secured_passwords_array[] = $secured_password; //Dump current secured password to array. Then save to session.
<i>
</i>session_start();
$password = 'password';
$salts = array('121','gulf','¬',';@/');
$salts_count = count($salts)-1;
$rand = rand(0,$salts_count);
if(EMPTY($_SESSION['secured_passwords_array']))
{
echo 'Line: ' .__LINE__ .'<br>';
$secured_passwords_array = array();
}
echo 'Current hashed salted password: '.$secured_password = hash('sha256',$password.$salts[$rand]).'<br>';
echo 'Line: ' .__LINE__ .'<br>';
//echo 'Current secured password: '.$secured_password = password_hash($hashed_salted_password,PASSWORD_DEFAULT); echo '<br>';
$_SESSION['secured_passwords_array'] = $secured_passwords_array[] = $secured_password; //Dump current secured password to array.
echo 'All secured passwords submitted: ';
print_r($_SESSION['secured_passwords_array']).'<br>';
echo 'Line: ' .__LINE__ .'<br>';
session_start();<br/>
if (isset($_SESSION['myarray']))<br/>
$myarray = $_SESSION['myarray'];<br/>
else<br/>
$myarray = array();
<i>
</i>//SAMPLE 5A
session_start();
$password = 'password';
$salts = array('121','gulf','¬',';@/');
$salts_count = count($salts)-1;
$rand = rand(0,$salts_count);
if(EMPTY($_SESSION['secured_passwords_array']))
{
$secured_passwords_array = array();
}
echo 'Current hashed salted password: '.$secured_password = hash('sha256',$password.$salts[$rand]).'<br>';
$_SESSION['secured_passwords_array'] = $secured_passwords_array[] = $secured_password; //Dump current secured password to array.
echo 'All secured passwords submitted: ';
var_dump($_SESSION['secured_passwords_array']).'<br>';
<i>
</i>//SAMPLE 5B
session_start();
$password = 'password';
$salts = array('121','gulf','¬',';@/');
$salts_count = count($salts)-1;
$rand = rand(0,$salts_count);
if(EMPTY($_SESSION['secured_passwords_array']))
{
echo 'Line: ' .__LINE__ .'<br>';
$secured_passwords_array = array();
}
$secured_passwords_array = array();
echo 'Current hashed salted password: '.$secured_password = hash('sha256',$password.$salts[$rand]).'<br>';
echo 'Line: ' .__LINE__ .'<br>';
$_SESSION['secured_passwords_array'] = $secured_passwords_array[] = $secured_password; //Dump current secured password to array.
echo 'All secured passwords submitted: ';
$secured_passwords_array = $_SESSION['secured_passwords_array'];
var_dump($secured_passwords_array).'<br>';
<i>
</i>//SAMPLE 5C
session_start();
if (isset($_SESSION['secured_passwords_array']))
$secured_passwords_array = $_SESSION['secured_passwords_array'];
else
$secured_passwords_array = array();
$password = 'password';
$salts = array('121','gulf','¬',';@/');
$salts_count = count($salts)-1;
$rand = rand(0,$salts_count);
echo 'Current hashed salted password: '.$secured_password = hash('sha256',$password.$salts[$rand]).'<br>';
$_SESSION['secured_passwords_array'] = $secured_passwords_array[] = $secured_password; //Dump current secured password to array.
$secured_passwords_array = $_SESSION['secured_passwords_array'];
echo 'All secured passwords submitted: '.'<br>';
var_dump($secured_passwords_array);
>@novice2022#1645758 that array values get deleted on every page refresh
<i>
</i>$password = 'password';
$salts = array('121','gulf','¬',';@/');
$salts_count = count($salts)-1;
$rand = rand(0,$salts_count);
if(isset($SESSION['secured_passwords_array']))
$SESSION['secured_passwords_array'] = array();
$secured_password = hash('sha256',$password.$salts[$rand]);
echo "Current hashed salted password: $secured_password<br>";
$SESSION['secured_passwords_array'][] = $secured_password; //Add new secured password to array.
echo 'All secured passwords submitted: ';
echo "<pre>", print_r(($SESSION['secured_passwords_array'],true), "</pre>";
<i>
</i>echo "<pre>", print_r(($SESSION['secured_passwords_array'],true), "</pre>";
<i>
</i>echo "<pre>"; print_r(($SESSION['secured_passwords_array'],true)); "</pre>";
<i>
</i>echo "<pre>"; print_r($SESSION['secured_passwords_array'],true); "</pre>";
<i>
</i>//SAMPLE 5D
//Ginerjm Sample.
$password = 'password';
$salts = array('121','gulf','¬',';@/');
$salts_count = count($salts)-1;
$rand = rand(0,$salts_count);
if(isset($_SESSION['secured_passwords_array']))
$_SESSION['secured_passwords_array'] = array();
$secured_password = hash('sha256',$password.$salts[$rand]);
echo "Current hashed salted password: $secured_password<br>";
$_SESSION['secured_passwords_array'][] = $secured_password; //Add new secured password to array.
echo 'All secured passwords submitted: ';
echo "<pre>"; print_r($_SESSION['secured_passwords_array'],true); "</pre>";
$salts = array('121','gulf','¬',';@/');<br/>
$salts_count = count($salts)-1;<br/>
$rand = rand(0,$salts_count);<br/>
if(!isset($<EM>_SESSION['secured_passwords_array']))<br/>
$_</EM>SESSION['secured_passwords_array'] = array();
$secured_password = hash('sha256',$password.$salts[$rand]);<br/>
echo "Current hashed salted password: $secured_password<br>";
$<EM>_SESSION['secured_passwords_array'][] = $secured_password; //Add new secured password to array.<br/>
echo 'All secured passwords submitted: ';<br/>
echo "<pre>" . print_r($_</EM>SESSION['secured_passwords_array'],true) . "</pre>";<br/>
<i>
</i>echo "<pre>", print_r(($SESSION['secured_passwords_array'],true), "</pre>";
<i>
</i>//SAMPLE 5D
//Ginerjm Sample.
$password = 'password';
$salts = array('121','gulf','¬',';@/');
$salts_count = count($salts)-1;
$rand = rand(0,$salts_count);
if(!isset($_SESSION['secured_passwords_array']))
$_SESSION['secured_passwords_array'] = array();
$secured_password = hash('sha256',$password.$salts[$rand]);
echo "Current hashed salted password: $secured_password<br>";
$_SESSION['secured_passwords_array'][] = $secured_password; //Add new secured password to array.
echo 'All secured passwords submitted: ';
echo "<pre>"; print_r($_SESSION['secured_passwords_array'],true); "</pre>";
<i>
</i>$_SESSION['secured_passwords_array'][]
session_start();<br/>
$salts = array('121','gulf','¬',';@/');<br/>
$salts_count = count($salts)-1;<br/>
$rand = rand(0,$salts_count);<br/>
if(!isset($<EM>_SESSION['secured_passwords_array']))<br/>
$_</EM>SESSION['secured_passwords_array'] = array();
$secured_password = hash('sha256',$password.$salts[$rand]);<br/>
echo "Current hashed salted password: $secured_password<br>";
$<EM>_SESSION['secured_passwords_array'][] = $secured_password; //Add new secured password to array.<br/>
echo 'All secured passwords submitted: ';<br/>
echo "<pre>" . print_r($_</EM>SESSION['secured_passwords_array'],true) . "</pre>";<br/>
<i>
</i>//SAMPLE 5A
session_start();
$password = 'password';
$salts = array('121','gulf','¬',';@/');
$salts_count = count($salts)-1;
$rand = rand(0,$salts_count);
if(EMPTY($_SESSION['secured_passwords_array']))
{
echo 'Line: ' .__LINE__ .'<br>';
$secured_passwords_array = array();
}
$secured_passwords_array = array();
echo 'Current hashed salted password: '.$secured_password = hash('sha256',$password.$salts[$rand]).'<br>';
echo 'Line: ' .__LINE__ .'<br>';
$_SESSION['secured_passwords_array'] = $secured_passwords_array[] = $secured_password; //Dump current secured password to array.
echo 'All secured passwords submitted: ';
$secured_passwords_array = $_SESSION['secured_passwords_array'];
var_dump($secured_passwords_array).'<br>';
<i>
</i>//SAMPLE 5D
//Ginerjm Sample.
$password = 'password';
$salts = array('121','gulf','¬',';@/');
$salts_count = count($salts)-1;
$rand = rand(0,$salts_count);
if(!isset($_SESSION['secured_passwords_array']))
$_SESSION['secured_passwords_array'] = array();
$secured_password = hash('sha256',$password.$salts[$rand]);
echo "Current hashed salted password: $secured_password<br>";
$_SESSION['secured_passwords_array'][] = $secured_password; //Add new secured password to array.
echo 'All secured passwords submitted: ';
echo "<pre>"; print_r($_SESSION['secured_passwords_array'],true); "</pre>";
<i>
</i>
session_start();
$salts = array('121', 'gulf', '¬', ';@/');
$salts_count = count($salts) - 1;
$rand = rand(0, $salts_count);
if(!isset($_SESSION['secured_passwords_array']))
$_SESSION['secured_passwords_array'] = array();
$secured_password = hash('sha256', $password.$salts[$rand]);
echo "Current hashed salted password: $secured_password<br>";
$_SESSION['secured_passwords_array'][] = $secured_password; //Add new secured password to array.
echo 'All secured passwords submitted: ';
echo "<pre>" . print_r($_SESSION['secured_passwords_array'],true) . "</pre>";
exit();
<i>
</i>$_SESSION['secured_passwords_array'][] = $secured_password; //Add new secured password to array.
<i>
</i>session_start();
error_reporting(E_ALL);
ini_set('display_errors', '1');
$password = 'password';
$salts = array('121', 'gulf', '¬', ';@/');
$salts_count = count($salts) - 1;
$rand = rand(0, $salts_count);
if(!isset($_SESSION['secured_passwords_array']))
$_SESSION['secured_passwords_array'] = array();
$secured_password = hash('sha256', $password.$salts[$rand]);
echo "Current hashed salted password: $secured_password<br>";
$_SESSION['secured_passwords_array'][] = $secured_password; //Add new secured password to array.
echo 'All secured passwords submitted: ';
echo "<pre>" . print_r($_SESSION['secured_passwords_array'],true) . "</pre>";
exit();
<i>
</i>ini_set('display_errors',1);
ini_set('display_startup_errors',1);
error_reporting(E_ALL);
<i>
</i>session_start();
session_destroy();
die;
<i>
</i>session_start();
if (isset($GET['reset']))
{
echo "Line: ". LINE . " Resetting array<br>";
unset($SESSION['secured_passwords_array']);
}
error_reporting(E_ALL);
ini_set('display_errors', '1');
$password = 'password';
$salts = array('121', 'gulf', '¬', ';@/');
$salts_count = count($salts) - 1;
$rand = rand(0, $salts_count);
if(!isset($_SESSION['secured_passwords_array']))
{
$secured_passwords_array = array();
}
$secured_passwords_array[] = $secured_password = hash('sha256', $password.$salts[$rand]);
echo "Current hashed salted password: $secured_password<br>";
$_SESSION['secured_passwords_array'] = $secured_passwords_array; //Add new secured password to array.
$secured_passwords_array = $_SESSION['secured_passwords_array'];
echo 'All secured passwords submitted: ';
echo "<pre>" . var_dump($secured_passwords_array) . "</pre>";
exit();
[code=php]
// make sure it exists and is an array before trying to add elements:
if(!isset($_SESSION['secured_passwords_array']) or !is_array($_SESSION['secured_passwords_array'])) {
$_SESSION['secured_passwords_array'] = [];
}
[/code]
<i>
</i>echo "Line: ". LINE. " Resetting array<br>";
<i>
</i>echo "Line: ". ___LINE__ . " Resetting array<br>";
>@ginerjm#1645812 Why doesn't the LINE constant work for you?
LINE
__LINE__
<i>
</i>session_start();
/*
if (isset($_GET['reset']))
{
echo "Line: ". __LINE__ . " Resetting array<br>";
unset($_SESSION['secured_passwords_array']);
}
*/
error_reporting(E_ALL);
ini_set('display_errors', '1');
$password = 'password';
$salts = array('121', 'gulf', '¬', ';@/');
$salts_count = count($salts) - 1;
$rand = rand(0, $salts_count);
if(!isset($_SESSION['secured_passwords_array']))
{
$secured_passwords_array = array();
}
$secured_passwords_array[] = $secured_password = hash('sha256', $password.$salts[$rand]);
echo "Current hashed salted password: $secured_password<br>";
$_SESSION['secured_passwords_array'] = $secured_passwords_array; //Add new secured password to array.
$secured_passwords_array = $_SESSION['secured_passwords_array'];
echo 'All secured passwords submitted: ';
echo "<pre>" . var_dump($secured_passwords_array) . "</pre>";
exit();
<i>
</i>// make sure it exists and is an array before trying to add elements:
if(!isset($_SESSION['secured_passwords_array']) or !is_array($_SESSION['secured_passwords_array'])) {
$_SESSION['secured_passwords_array'] = [];
}[code]
Here is the code ...
[code]
session_start();
/*
if (isset($_GET['reset']))
{
echo "Line: ". __LINE__ . " Resetting array<br>";
unset($_SESSION['secured_passwords_array']);
}
*/
error_reporting(E_ALL);
ini_set('display_errors', '1');
$password = 'password';
$salts = array('121', 'gulf', '¬', ';@/');
$salts_count = count($salts) - 1;
$rand = rand(0, $salts_count);
if(!isset($_SESSION['secured_passwords_array']))
{
$secured_passwords_array = array();
}
// make sure it exists and is an array before trying to add elements:
if(!isset($_SESSION['secured_passwords_array']) or !is_array($_SESSION['secured_passwords_array'])) {
$_SESSION['secured_passwords_array'] = [];
}
$secured_passwords_array[] = $secured_password = hash('sha256', $password.$salts[$rand]);
echo "Current hashed salted password: $secured_password<br>";
$_SESSION['secured_passwords_array'] = $secured_passwords_array; //Add new secured password to array.
$secured_passwords_array = $_SESSION['secured_passwords_array'];
echo 'All secured passwords submitted: ';
echo "<pre>" . var_dump($secured_passwords_array) . "</pre>";
exit();
<i>
</i>session_start();
if (isset($_GET['reset']))
{
echo "Line: ". __LINE__ . " Resetting array<br>";
unset($_SESSION['secured_passwords_array']);
}
error_reporting(E_ALL);
ini_set('display_errors', '1');
$password = 'password';
$salts = array('121', 'gulf', '¬', ';@/');
$salts_count = count($salts) - 1;
$rand = rand(0, $salts_count);
if(!isset($_SESSION['secured_passwords_array']))
$_SESSION['secured_passwords_array'] = array();
$secured_password = hash('sha256', $password.$salts[$rand]);
echo "Current hashed salted password: $secured_password<br>";
$_SESSION['secured_passwords_array'][] = $secured_password; //Add new secured password to array.
echo 'All secured passwords submitted: ';
echo "<pre>" . print_r($_SESSION['secured_passwords_array'],true) . "</pre>";
exit();
>@novice2022#1645819 Where do I add this line NogDog
session_start()
unset()
[code=php]
session_start();
// add ?reset to the url to start over. Then remove it.
if (isset($_GET['reset']))
{
echo "Resetting array<br>";
unset($_SESSION['secured_passwords_array']);
}
error_reporting(E_ALL);
ini_set('display_errors', '1');
$password = 'password';
$salts = array('121', 'gulf', '¬', ';@/');
$salts_count = count($salts) - 1;
$rand = rand(0, $salts_count);
if(!isset($_SESSION['secured_passwords_array']))
$_SESSION['secured_passwords_array'] = array();
$secured_password = hash('sha256', $password.$salts[$rand]);
echo "Current hashed salted password: $secured_password<br>";
$_SESSION['secured_passwords_array'][] = $secured_password; //Add new secured password to array.
echo 'All secured passwords submitted: ';
echo "<pre>" . print_r($_SESSION['secured_passwords_array'],true) . "</pre>";
exit();
[/code]
>@ginerjm#1645823 REPLACE MISSING UNDERSCORES
...
<i>
</i>session_start();
if (isset($_GET['reset']))
{
echo "Line: ". __LINE__ . " Resetting array<br>";
unset($_SESSION['secured_passwords_array']);
}
error_reporting(E_ALL);
ini_set('display_errors', '1');
$password = 'password';
$salts = array('121', 'gulf', '¬', ';@/');
$salts_count = count($salts) - 1;
$rand = rand(0, $salts_count);
if(!isset($_SESSION['secured_passwords_array']))
$_SESSION['secured_passwords_array'] = array();
$secured_password = hash('sha256', $password.$salts[$rand]);
echo "Current hashed salted password: $secured_password<br>";
$_SESSION['secured_passwords_array'][] = $secured_password; //Add new secured password to array.
echo 'All secured passwords submitted: ';
echo "<pre>" . print_r($_SESSION['secured_passwords_array'],true) . "</pre>";
exit();
<i>
</i>// make sure it exists and is an array before trying to add elements:
if(!isset($_SESSION['secured_passwords_array']) or !is_array($_SESSION['secured_passwords_array'])) {
$_SESSION['secured_passwords_array'] = [];
}
<i>
</i>// make sure it exists and is an array before trying to add elements:
if(!isset($_SESSION['secured_passwords_array']) or !is_array($_SESSION['secured_passwords_array'])) {
$_SESSION['secured_passwords_array'] = [];
}
<i>
</i>$secured_password = hash('sha256', $password.$salts[$rand]);
$_SESSION['secured_passwords_array'][] = $secured_password; //Add new secured password to array.
<i>
</i>$_SESSION['secured_passwords_array'][] = $secured_password = hash('sha256', $password.$salts[$rand]);
>@ginerjm#1645831 I get the you cant do this message all the time too.
<i>
</i><-?php // remove the hypen
0.1.9 — BETA 4.26