[NOT SA-MP]PHP/MySQL Website Error[NOT SA-MP]
#9

Made it like that, and now it shows this:
Код:
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/tvsempre/public_html/site/login.php:8) in /home/tvsempre/public_html/site/login.php on line 10
PHP код:
<BODY BGCOLOR = "#A0A0A0"> 
<div align="center">
<img src="http://images.cooltext.com/2643376.png" width="209" height="109" alt="Login" />
<br />
<table border="5">
<tr>
<th>
<?php 
include("conf.inc.php"); // Includes the db and form info. 
session_start(); // Starts the session. 
if (!isset($_POST['submit'])) { // The form has not been submitted. 
    
echo "<form action=\"login.php\" method=\"POST\">"
    echo 
"<table>"
    echo 
"<tr>"
    echo 
"<td colspan=\"2\">Login:</td>"
    echo 
"</tr>"
    echo 
"<tr>"
    echo 
"<td width=\"50%\">Username:</td><td width=\"50%\"><input name=\"username\" size=\"18\" type=\"text\" />"
    echo 
"</tr>"
    echo 
"<tr>"
    echo 
"<td width=\"50%\">Password:</td><td width=\"50%\"><input name=\"password\" size=\"18\" type=\"text\" />"
    echo 
"</tr>"
    echo 
"<tr>"
    echo 
"<td colspan=\"2\"><input type=\"submit\" name=\"submit\" value=\"Login\"</td>"
    echo 
"</tr>"
    echo 
"</table>"
    echo 
"</form>"
} else { 
    
$username form($_POST['username']); 
    
$password md5($_POST['password']); // Encrypts the password. 

    
$q mysql_query("SELECT * FROM `users` WHERE username = '$username' AND password = '$password'") or die (mysql_error()); // mySQL query 
    
$r mysql_num_rows($q); // Checks to see if anything is in the db. 

        
if ($r == 1) { // There is something in the db. The username/password match up. 
        
$_SESSION['logged'] = 1// Sets the session. 
        
echo "<a href=\"site.php\"></a>";
        exit(); 
// Stops the rest of the script. 
        
} else { // Invalid username/password. 
        
echo "<a href=\"login.php\"></a>";
    } 


mysql_close($db_connect); // Closes the connection. 
?>
</th>
</tr>
</table>
</div>
</BODY>
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)