wrathican Posted April 20, 2008 Share Posted April 20, 2008 i have a problem while using this. i have a user registration form and im checking to see if the password is 6 or more characters long. this is what im using: $passlen = strlen($password); if ((checkString($password) == true) || ($passlen <= 5)) { $_SESSION['errorstate'] = 1; $errorarray[] = "Password is invalid"; } if ($_SESSION['errorstate'] == 1) { $_SESSION['errormessage'] = $errorarray; header('location: ../register.php'); } it doesnt seem to be setting the session and there fore not redirecting accordingly. any idea why? Link to comment https://forums.phpfreaks.com/topic/101968-solved-strlen/ Share on other sites More sharing options...
jonsjava Posted April 20, 2008 Share Posted April 20, 2008 oh, you need to add this to the top of the page: <?php session_start(); Link to comment https://forums.phpfreaks.com/topic/101968-solved-strlen/#findComment-521844 Share on other sites More sharing options...
wrathican Posted April 20, 2008 Author Share Posted April 20, 2008 sorry, i should have mentioned. i already have. Link to comment https://forums.phpfreaks.com/topic/101968-solved-strlen/#findComment-521847 Share on other sites More sharing options...
jonsjava Posted April 20, 2008 Share Posted April 20, 2008 Last one, then I'm off to bed. Honestly......... <?php $passlen = strlen($password); if (checkString($password) == true || $passlen <= 5 ){ $_SESSION['errorstate'] = 1; $errorarray[] = "Password is invalid"; } if ($_SESSION['errorstate'] == 1) { $_SESSION['errormessage'] = $errorarray; header('location: ../register.php'); } Link to comment https://forums.phpfreaks.com/topic/101968-solved-strlen/#findComment-521849 Share on other sites More sharing options...
wrathican Posted April 20, 2008 Author Share Posted April 20, 2008 hmm, that still doesnt work. im so confused. but thanks for the replies! Link to comment https://forums.phpfreaks.com/topic/101968-solved-strlen/#findComment-521852 Share on other sites More sharing options...
wrathican Posted April 20, 2008 Author Share Posted April 20, 2008 ok so i split the if statement up into two others and now it works. i dunno what was happening. thanks for your help anyway! Link to comment https://forums.phpfreaks.com/topic/101968-solved-strlen/#findComment-521856 Share on other sites More sharing options...
markusn00b Posted April 20, 2008 Share Posted April 20, 2008 Try: if((checkOne($_statement)) || (checkTwo($_statement))) Link to comment https://forums.phpfreaks.com/topic/101968-solved-strlen/#findComment-521858 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.