Form Already Filled Out

From: Date: Fri, 05 Aug 2011 04:43:01 +0000
Subject: Form Already Filled Out
Groups: php.general 
Request: Send a blank email to php-general+get-314330@lists.php.net to get a copy of this message
Hello, Soooo i created a simple login system, and I am using sessions. Everything seems to work fine, however; when I upload my files to my server and type my domain name my index.php page comes up and the form is automatically filled out with a username and password. How do i make it empty when I initially enter the site, and yes I did create a logout.php file that destroys a session. Please help, it is hard to explain this when I cant show it in person. Thanks in advance! Here is the login.php code, i didn't md5() the password yet: <?php if ($_SESSION['user']) { header("Location: error.php"); exit(); } include('connect.php'); if ($_POST['login']){ $user=$_POST['user']; $pass=$_POST['pass']; $sql="SELECT * FROM members WHERE username='$_POST[user]' and password='$_POST[pass]'"; $result=mysql_query($sql, $con); $count=mysql_num_rows($result); if ($count==1){ $_SESSION['user'] = $user; header('location: home.php'); } else echo "<p style='color:red'>Wrong Username or Password</p>"; } ?> <html> <head>
       <title></title>
       <link href="style.css" rel="stylesheet" type="text/css" />
</head> <body>
      
       <div id="main">
           <div id="menu">
               <ul>
                   <li>
                       <a href="#">Home</a>
                   </li>
                   <li>
                       <a href="#">Topix</a>
                   </li>
                   <li>
                       <a href="#">Mission</a>
                   </li>
               </ul>
           </div>
           <div id='content'>
               <form method='post' action='index.php'>
                   Username: <br/>
                   <input type='text' name='user' maxlength='30'/><br/>
                   Password: <br/>
                   <input type="password" name='pass' maxlength='30'/><br/>
                   <input type="submit" value="Log In!" name="login"/>
               </form>
               <a href="register.html"> Register? </a>
                     </div>
</body> </html>

« previous php.general (#314330) next »