rhyspaterson Posted September 7, 2007 Share Posted September 7, 2007 Hey guys, Making some modifications to my knowledge base. At the moment it doesn't support multiple users so i'm just writing some quick and dirty code until the next major release (4 months ish). Everything is working fine expect this below code. It has something to do with opening the .csv file but im not quite sure what it is. The syntax looks fine to me. When the function is called the page hangs and then shows blank. Hmm. // If the user is trying to authenticate and suceeds, let them in if (isset($_POST['frontendUser']) && isset($_POST['frontendPass'])) { // create shorter variables $username = $_POST['frontendUser']; $password = $_POST['frontendPass']; $row = 1; $handle = fopen("userList.csv", "r"); // open the file and read it into an array while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { $num = count($data); // check the username and password agains the $_POST variables if (($data[0] == $username)&&($data[1] == $password)){ // it's a match $_SESSION['frontendUser'] = $GLOBALS['frontendUser']; $_SESSION['frontendPass'] = $GLOBALS['frontendPass']; if (isset($_POST['frontendRemember']) && isset($_POST['frontendRemember']) == 1) { // Allow the user to be remembered for 2 weeks (i.e. 14 days) $cookielength = time()+60*60*24*14; setcookie($GLOBALS['cookiePrefix'].'akb_f_u', $GLOBALS['frontendUser'], $cookielength); setcookie($GLOBALS['cookiePrefix'].'akb_f_p', $GLOBALS['frontendPass'], $cookielength); } return true; } } fclose($handle); } Any suggestions? Cheers Quote Link to comment https://forums.phpfreaks.com/topic/68303-user-verification/ Share on other sites More sharing options...
teng84 Posted September 7, 2007 Share Posted September 7, 2007 while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { i guess no need for the !== FALSE while ($data = fgetcsv($handle, 1000, ",")) { and closing should comes first before return Quote Link to comment https://forums.phpfreaks.com/topic/68303-user-verification/#findComment-343423 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.