bsteele11 Posted March 2, 2015 Share Posted March 2, 2015 I know the code for the $username and $password are totally wrong but I can't find the correct code to use and I've gone over the chapter it's suppose to be in (I'm a college student) please please help. The part that is way wrong is bold and underlined but there are probably other errors. Thank you. <?php ob_start(); //research the use of this session_start(); //needed to create sessions - maintaining state is discussed above. ini_set('display_errors', 1); //turn on errors, use for debugging. $username = \"".$UserName."\";"; //refer to the superglobal arrays section above $password = \"".$Password."\";"; $authorized = false; require ('$db'); $sql = 'SELECT * from Login'; $rs = $conn->Execute($sql); //Using a While looping structure to check each record in the database while (!$rs->EOF) { if ($rs->Fields["UserName"]->Value=="$username" && $rs->Fields["Password"]->Value=="$password") { $_SESSION['auth'] = $rs->Fields['Auth']->Value; $_SESSION['username'] = $rs->Fields['UserName']->Value; $authorized = true; } $rs->MoveNext(); } # close the connection $rs->Close(); $conn->Close(); $rs = null; $conn = null; if (!$authorized) { header('Location: login.php'); // see pseudocode for authorize.php exit(); } else { header('Location: index.php'); exit(); } ?> Quote Link to comment Share on other sites More sharing options...
Barand Posted March 2, 2015 Share Posted March 2, 2015 Take a VB script, add a few $ prefixed variables. Yes, that'll do it Quote Link to comment 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.