[PHP] Login System

gooby pls
Decennium
Joined
Mar 22, 2008
Messages
830
Reaction score
178
Well, I been working on this login system, and I'm getting really frustrated...
All the information is correct, but I keep getting this error:

Code:
Warning: session_register() [function.session-register]: Cannot send session cache limiter - headers already sent (output started at D:\webserver\www\website\game\Login\log_.php:7) in D:\webserver\www\website\game\Login\log_.php on line 68

Warning: Cannot modify header information - headers already sent by (output started at D:\webserver\www\website\game\Login\log_.php:7) in D:\webserver\www\website\game\Login\log_.php on line 70

Here is my code, and I would appreciate if some one is nice enough to read over it, and maybe find what I did wrong.


PHP:
<html>
    <body style="background-color: #141414;">

 <link rel="StyleSheet" href="../../templates/yoo_ambient/css/general.css" type="text/css">
 <link rel="StyleSheet" href="../../templates/yoo_ambient/css/layout.css" type="text/css">
 <link rel="StyleSheet" href="../../templates/yoo_ambient/css/modules.css" type="text/css">
  <link rel="StyleSheet" href="../../templates/yoo_ambient/css/joomla.css" type="text/css">

<script type="text/javascript" language="Javascript">
<!-- Begin
document.oncontextmenu = function(){return false}
// End -->
</script>
  <table align="left" border="0" cellspacing="0" cellpadding="0" width="420">
   <tr> 
    <td align="left"> 
<?php
require 'config.htpasswd';
require_once "sql_inject.php"; 
include_once('sql_check.php');
check_inject();

$bDestroy_session = TRUE; 
$url_redirect = 'index.php'; 
$sqlinject = new sql_inject('./log_file_sql.log',$bDestroy_session,$url_redirect)  ; 

$fecha = date('m/d/Y');
$ip = $_SERVER['REMOTE_ADDR'];
$cuenta = stripslashes($_POST['cuenta']);
$pass = stripslashes($_POST['pass']);
$repass = stripslashes($_POST['repass']);
$extcode = stripslashes($_POST['extcode']);
$extcode1 = stripslashes($_POST['extcode1']);

if ((eregi("[^a-zA-Z0-9_-]", $cuenta)) || 
(eregi("[^a-zA-Z0-9_-]", $pass)) ||
(eregi("[^a-zA-Z0-9 _-]", $repass)) ||
(eregi("[^a-zA-Z0-9_-]", $extcode)) ||
(eregi("[^a-zA-Z0-9_-]", $extcode1)) )
	{
	echo("<center><font color=red><b>SQL Injection Detected.</b></font><br>Please use only (a-Z) & (0-9)</center>");
        exit();
	}

$sql_email_check = mssql_query("SELECT FLD_PASSWORD FROM TBL_ACCOUNT WHERE FLD_PASSWORD='$pass'"); 
$sql_username_check = mssql_query("SELECT FLD_ID FROM TBL_ACCOUNT WHERE FLD_ID='$cuenta'"); 

$email_check = mssql_num_rows($sql_email_check); 
$username_check = mssql_num_rows($sql_username_check); 

if (empty($cuenta) || empty($pass) || empty($repass) || empty($extcode) || empty($extcode1)) {
    echo "Please make sure you have filled everything out before continueing!";  $Error=1;
}

elseif ($pass != $repass) {
	echo "<div align='center' class='normmal_text_white'>Passwords do not match. Please try again.</div>";  $Error=1;}

elseif ($extcode != $extcode1) {
	echo "<div align='center' class='normmal_text_white'>Captcha Code does not match. Please try again.</div>";  $Error=1;
}
if ($Error!=1){

$msquery2 = "SELECT * FROM TBL_ACCOUNT WHERE FLD_ID='$cuenta' AND FLD_PASSWORD='$pass'";
$msresults = mssql_query($msquery2);

$count=mssql_num_rows($msresults);
if($count==1){
session_register("cuenta");
session_register("pass");
header("location:ucp.php");
}
else {
echo "Wrong Username or Password";
}
}
$msconnect=mssql_close(); 
?>
</table>
</body>
</html>
 
Last edited:
why not use $_SESSION['cuenta'] = whatever and $_SESSION['pass'] = whatever. Headers problem, just disable the error in your appserv. Or read up on the error. If I remember right its due to white spaces at the top which possibly is the html. But Idk. Don't quiet remember
 
Back