JOECICIO Posted February 8, 2009 Share Posted February 8, 2009 I am using two different systems: IIS 7 on Vista and IIS 6 on XP Prof The code worked until I reinstalled PHP - followed all recommendations Here is the code: <?php # Script 12.7 - login.php // This is the login page for the site. // Include the configuration file for error management and such. //require_once ('config.inc'); // Set the page title and include the HTML header. $page_title = 'Login'; include ('header.html'); if (isset($_POST['submit'])) { // Check if the form has been submitted. include ('mysql_connect.php'); // Connect to the database. $u = $_POST['username']; $p = $_POST['password']; $query = "SELECT user_id, first_name FROM users WHERE first_name='$u' AND '$p'=DECODE(password,'joepass')"; if($result = @mysqli_query ($mysqli,$query)){ $row = mysqli_fetch_row($result); $_SESSION['first_name'] = $row[1]; $_SESSION['user_id'] = $row[0]; mysqli_free_result($result); header ("Location: http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . "/index.php"); // redirect to home page echo 'posted'; } else{// No result -- match was made. echo '<p><font color="red" size="+1">The username and password entered do not match those on file.</font></p>'; } mysqli_close($mysqli);// close connection } ?> <h1>Login</h1> <p>Your browser must allow cookies in order to login.</p> <form onsubmit="return validatelogin(this)" method="post" action="login.php"><!-- action="http://localhost/mysql-php/login.php" --> <fieldset> <p><b>User Name:</b> <input type="text" name="username" size="10" maxlength="20" value="larry" /></p> <p><b>Password:</b> <input type="password" name="password" size="20" maxlength="20" value="happytime" /></p> <div align="center"><input type="submit" name="submit" value="Login" /></div> </fieldset></form><!-- End of Form --> <?php // Include the HTML footer. include ('footer.html'); ?> =====================\ The posted data should go to login.php but now i get a server error. It doesn't matter whether I leave "Action" empty or simple (as shown) or fully qualified. Before clicking submit, the form is properly rendered . It appears certain that the post is being directed to the correct file (login.php - ITSELF) because I get a status message "Waiting for (http://localhost/mysql-php/login.php) Where should I look for the problem??? Link to comment https://forums.phpfreaks.com/topic/144288-posting-to-php_self-suddenly-not-working/ Share on other sites More sharing options...
webmaster1 Posted February 8, 2009 Share Posted February 8, 2009 This is way beyond my level but you should wrap your posted code with the code tags if you want anyone to take a serious look at it. Link to comment https://forums.phpfreaks.com/topic/144288-posting-to-php_self-suddenly-not-working/#findComment-757220 Share on other sites More sharing options...
bubbasheeko Posted February 8, 2009 Share Posted February 8, 2009 Starters....do you not need 'config.inc'? You have it ignored. Next...what are the error messages that you are receiving? If any. Link to comment https://forums.phpfreaks.com/topic/144288-posting-to-php_self-suddenly-not-working/#findComment-757225 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.