canadian_angel Posted June 20, 2010 Share Posted June 20, 2010 I am trying to figure out why when I entered this code correctly I am getting the two error messages at the bottom. Can anyone please help me with this please? <?php // Script 8.13 - login.php // This page lets people log into the site. // Address error handling. ini_set ('display_errors', 1); error_reporting (E_ALL & ~E_NOTICE); // Set the page title and include the header file. define ('TITLE', 'Login'); require ('templates/header.html'); // Basic HTML formatting stuff. print '<div id="leftcontent"> <h1>Login Form</h1> <p>Users who are logged in can take advantage of certain features like this, that, and the other thing.</p>'; // Check if the form has been submitted. if ( isset ($_POST['submit'])) { // Handle the form. if ( (!empty ($_POST['username'])) && (!empty ($_POST['password'])) ){ if ( ($_POST['username'] == 'testing') && ($_POST['password'] == 'testpass') ) { // Okay. // Redirect the user to the welcome page! header ('Location: welcome.php'); exit(); } else { // Not okay. print '<p>The submitted username and password do not match those on file! Go back and try again.</p>'; } } else { // Forgot a field. print '<p>Please make sure you enter both a username and a password! Go back and try again.</p>'; } } else { // Display the form. print '<form action="login.php" method="post"></p> Username: <input type="text" name="username" size"20 /> Password: <input type="password" name="password" size="20" /> <input type="submit" name="submit" value="Log In!" /></p> </form>'; } // End of main conditional. // Complete the HTML formatting stuff. print '</div>'; require ('templates/footer.html'); // Need the footer. ?> ERROR MESSAGES: Warning: require(templates/header.html) [function.require]: failed to open stream: No such file or directory in ................. Fatal error: require() [function.require]: Failed opening required 'templates/header.html' (include_path='.:/usr/local/lib/php:/usr/local/php5/lib/pear') in ................ Link to comment https://forums.phpfreaks.com/topic/205292-code-producing-error-message-and-i-cant-figure-out-why/ Share on other sites More sharing options...
MatthewJ Posted June 20, 2010 Share Posted June 20, 2010 It can't find header.html, seems pretty straight forward Link to comment https://forums.phpfreaks.com/topic/205292-code-producing-error-message-and-i-cant-figure-out-why/#findComment-1074501 Share on other sites More sharing options...
canadian_angel Posted June 20, 2010 Author Share Posted June 20, 2010 I know that but why? Link to comment https://forums.phpfreaks.com/topic/205292-code-producing-error-message-and-i-cant-figure-out-why/#findComment-1074502 Share on other sites More sharing options...
Pikachu2000 Posted June 20, 2010 Share Posted June 20, 2010 It would make it much easier to read your code if you'd enclose it within [ php] . . . [ /php] tags, as seen below. Without tags if(isset($_POST['checkbox'][0]) && !empty($_POST['username'])){ $query="SELECT password FROM table WHERE username = mysql_real_escape_string($_POST['username']"; } With tags if(isset($_POST['checkbox'][0]) && !empty($_POST['username'])){ $query="SELECT password FROM table WHERE username = mysql_real_escape_string($_POST['username']"; } Link to comment https://forums.phpfreaks.com/topic/205292-code-producing-error-message-and-i-cant-figure-out-why/#findComment-1074508 Share on other sites More sharing options...
MatthewJ Posted June 20, 2010 Share Posted June 20, 2010 Without access to the server, it is really hard to say, but my guess is that header.html is not in the templates folder on the server. Link to comment https://forums.phpfreaks.com/topic/205292-code-producing-error-message-and-i-cant-figure-out-why/#findComment-1074643 Share on other sites More sharing options...
gergy008 Posted June 20, 2010 Share Posted June 20, 2010 If you are sure that the file is there, Try chmodding the file Link to comment https://forums.phpfreaks.com/topic/205292-code-producing-error-message-and-i-cant-figure-out-why/#findComment-1074645 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.