• 0
Sign in to follow this  
nbm

erro ao logar me ajudem

Question

Warning: session_regenerate_id() [function.session-regenerate-id]: Cannot regenerate session id - headers already sent in /home/jose/public_html/cabecalho.php on line 74

Warning: Cannot modify header information - headers already sent by (output started at /home/jose/public_html/index.php:8) in /home/jose/public_html/cabecalho.php on line 83

apos eu logar no meu site da esse erro , mais qd eu recarrego a pagina ele aparece como logado , me ajudem por favor.

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Isso porque a session já ta aberta em outro lugar e lembre-se que deve abrila sempre na 1° linha antes de qualquer coisa.

Share this post


Link to post
Share on other sites
  • 0
Isso porque a session já ta aberta em outro lugar e lembre-se que deve abrila sempre na 1° linha antes de qualquer coisa.

<?php require_once('Connections/f.php'); ?>

<?php session_start();?>

<?php

if (!function_exists("GetSQLValueString")) {

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")

{

if (PHP_VERSION < 6) {

$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

}

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {

case "text":

$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

break;

case "long":

case "int":

$theValue = ($theValue != "") ? intval($theValue) : "NULL";

break;

case "double":

$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";

break;

case "date":

$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

break;

case "defined":

$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;

break;

}

return $theValue;

}

}

$colname_usu_logado = "-1";

if (isset($_SESSION['MM_Username'])) {

$colname_usu_logado = $_SESSION['MM_Username'];

}

mysql_select_db($database_f, $f);

$query_usu_logado = sprintf("SELECT * FROM usuario WHERE usuario = %s", GetSQLValueString($colname_usu_logado, "text"));

$usu_logado = mysql_query($query_usu_logado, $f) or die(mysql_error());

$row_usu_logado = mysql_fetch_assoc($usu_logado);

$totalRows_usu_logado = mysql_num_rows($usu_logado);

?>

<?php

// *** Validate request to login to this site.

if (!isset($_SESSION)) {

session_start();

}

$loginFormAction = $_SERVER['PHP_SELF'];

if (isset($_GET['accesscheck'])) {

$_SESSION['PrevUrl'] = $_GET['accesscheck'];

}

if (isset($_POST['text_login'])) {

$loginUsername=$_POST['text_login'];

$password=$_POST['text_senha'];

$MM_fldUserAuthorization = "nivel";

$MM_redirectLoginSuccess = "index.php";

$MM_redirectLoginFailed = "index.php";

$MM_redirecttoReferrer = false;

mysql_select_db($database_f, $f);

$LoginRS__query=sprintf("SELECT usuario, senha, nivel FROM usuario WHERE usuario=%s AND senha=%s",

GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));

$LoginRS = mysql_query($LoginRS__query, $f) or die(mysql_error());

$loginFoundUser = mysql_num_rows($LoginRS);

if ($loginFoundUser) {

$loginStrGroup = mysql_result($LoginRS,0,'nivel');

if (PHP_VERSION >= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();

}

//declare two session variables and assign them

$_SESSION['MM_Username'] = $loginUsername;

$_SESSION['MM_UserGroup'] = $loginStrGroup;

if (isset($_SESSION['PrevUrl']) && false)

{

$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];

}

header("Location: " . $MM_redirectLoginSuccess );

}

else {

header("Location: ". $MM_redirectLoginFailed );

}

}

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns=http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Untitled Document</title>

<style type="text/css">

.cabecalho_cab {

height: 183px;

width: 1000px;

margin-right: auto;

margin-left: auto;

margin-bottom: 50px;

}

.cabecalho_cab div p {

margin: 0px;

padding: 0px;

}

#light_box {

position:fixed;

widht:100%;

height:100%;

left:0;

top:0;

background-color: #666666;

display:none;

width: 100%;

}

#form {

background:747474;

margin:20px auto;

width:250px;

display:none;

}

#but_login {

background-image: url(imagens/button_login.jpg);

height: 25px;

width: 70px;

cursor:pointer;

}

</style>

<script src="jquery-1.7.2.js" type="text/javascript"></script>

<script type="text/javascript">

$(function(){

$('body').append('<div id="light_box"></div><div id=#but_login></div>')

$('#but_login').click(function() {

$('#light_box').css('opacity','0.8').fadeIn(500)

$('#form').appendTo('#light_box').show()

})

})

</script>

</head>

<body>

<div class="cabecalho_cab">

<p><img src="imagens/logo.png" width="1000" height="183" /></p>

<div>

<p><a href="index.php?usu">Cadastro usuário </a><a href="logar.php">Logar</a> você está logado como :<?php echo $row_usu_logado['usuario]; ?></p>

<div id="but_login"></div>

</div>

</div>

<div id="form"><div>

<h4> Faça o Login</h4>

<form action="<?php echo $loginFormAction; ?>" form id="form1" method="POST" name="form1">

<p>Login: <input type="text" name="text_login"/></p>

<p>Senha: <input type="password" name="text_senha"/></p>

<p> <input type="Submit" name"button" id="button"

value="submit" /> </p>

</form>

</div></div>

</body>

</html>

<?php

mysql_free_result($usu_logado);

?>

oque eu mudo nela ?

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this