Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Fiz um site usando o Developer Toolbox... O sistema de login funcionou perfeitamente no localhost (Versao do Apache:2.2.6 PHP:5.2.5). Depois que eu envio o site pro servidor de hospedagem, o seguinte erro apareece quando tento fazer login: Warning: Cannot modify header information - headers already sent by (output started at /home/boaofertajipa/www/index.php:78) in /home/boaofertajipa/www/includes/common/KT_functions.inc.php on line 464. Já olhei as páginas, revirei o google e nao consigo achar uma solução... vou postar as linas problemáticas pra vcs...
Página KT_FUNCTIONS.INC.PHP
/**
* Make the redirect on server side;
* @param string $url the URL to which is makeing the redirect;
* @return nothing;function KT_redir($url) {
$protocol = "http://";
$server_name = $_SERVER["HTTP_HOST"];
if ($server_name != '') {
$protocol = "http://";
if (isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == "on")) {
$protocol = "https://";
}
if (preg_match("#^/#", $url)) {
$url = $protocol.$server_name.$url;
} else if (!preg_match("#^[a-z]+://#", $url)) {
$script = KT_getPHP_SELF();
if (isset($_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO'] != '' && $_SERVER['PATH_INFO'] != $_SERVER['PHP_SELF']) {
$script = substr($script, 0, strlen($script) - strlen($_SERVER['PATH_INFO']));
}
$url = $protocol.$server_name.(preg_replace("#/[^/]*$#", "/", $script)).$url;
}
session_write_close();
$url = str_replace(" ","%20",$url);
if (KT_is_ajax_request()) {
header("Kt_location: ".$url);
echo "Redirecting to: " . $url;
} else {
header("Location: ".$url);
}
}
exit;
}
Página de login
<?php require_once('Connections/conexao.php');
// Load the common classes
require_once('includes/common/KT_common.php');
// Load the tNG classes
require_once('includes/tng/tNG.inc.php');
// Make a transaction dispatcher instance
$tNGs = new tNG_dispatcher("");
// Make unified connection variable
$conn_conexao = new KT_connection($conexao, $database_conexao);
// Start trigger
$formValidation = new tNG_FormValidation();
$formValidation->addField("kt_login_user", true, "text", "", "", "", "");
$formValidation->addField("kt_login_password", true, "text", "", "", "", "");
$tNGs->prepareValidation($formValidation);// Make a login transaction instance
$loginTransaction = new tNG_login($conn_conexao);
$tNGs->addTransaction($loginTransaction);$loginTransaction->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "kt_login1");
$loginTransaction->registerTrigger("BEFORE", "Trigger_Default_FormValidation", 10, $formValidation);
$loginTransaction->registerTrigger("END", "Trigger_Default_Redirect", 99, "{kt_login_redirect}");$loginTransaction->addColumn("kt_login_user", "STRING_TYPE", "POST", "kt_login_user");
$loginTransaction->addColumn("kt_login_password", "STRING_TYPE", "POST", "kt_login_password");// Execute all the registered transactions
$tNGs->executeTransactions();
// Get the transaction recordset
$rscustom = $tNGs->getRecordset("custom");
$row_rscustom = mysql_fetch_assoc($rscustom);
$totalRows_rscustom = mysql_num_rows($rscustom);
$tNGs->displayValidationRules();
?><head>
<link href="includes/skins/mxkollection3.css" rel="stylesheet" type="text/css" media="all" />
<script src="includes/common/js/base.js" type="text/javascript"></script>
<script src="includes/common/js/utility.js" type="text/javascript"></script>
<script src="includes/skins/style.js" type="text/javascript"></script>
<link href="css/css.css" rel="stylesheet" type="text/css">
</head><style type="text/css">margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
}.style50 { font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;.styke {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
color: #FFFFFF;
}
.stok {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 14px;-->
</style><body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="312" height="108" background="images/boa_oferta.jpg"> </td>
<td><div align="center" class="style165847"><span class="style133">
</span> <span class="style133">
</span><span class="Verdana12">
<?php
echo $tNGs->getLoginMsg();
?>
<?php
echo $tNGs->getErrorMsg();
?>
</span>
</div></td>
<td width="82" background="images/entrar1.jpg"> </td>
<td width="268" background="images/entrar.jpg">
<form method="post" id="form1" class="KT_tngformerror" action="<?php echo KT_escapeAttribute(KT_getFullUri()); ?>">
<table cellpadding="2" cellspacing="0" class="KT_tngtable">
<tr>
<td class="FormularioLogin"><label for="kt_login_user">Email:</label></td>
<td align="left" class="TextoBasico"><input type="text" name="kt_login_user" id="kt_login_user" value="<?php echo KT_escapeAttribute($row_rscustom['kt_login_user']); ?>" size="30" />
<?php echo $tNGs->displayFieldHint("kt_login_user");?> <?php echo $tNGs->displayFieldError("custom", "kt_login_user"); ?> </td>
</tr>
<tr>
<td class="FormularioLogin"><label for="kt_login_password">Senha:</label></td>
<td align="left" class="TextoBasico"><input type="password" name="kt_login_password" id="kt_login_password" value="" size="20" />
<?php echo $tNGs->displayFieldHint("kt_login_password");?> <?php echo $tNGs->displayFieldError("custom", "kt_login_password"); ?> </td>
</tr>
<tr class="KT_buttons">
<td colspan="2"><input type="submit" name="kt_login1" id="kt_login1" value="Login" /> </td>
</tr>
</table>
</form> </td>
</tr>
<tr>
<td height="34" colspan="4" align="center" valign="middle" background="images/menu.gif" class="styledata">
<form id="form2" name="busca" method="post" action="busca.php">
<span class="styke">Buscar: </span>
<label>
<input name="busca" type="text" class="style50" id="busca" size="40" />
</label>
<label>
<input name="Submit" type="submit" class="style50" value="Buscar" />
</label>
</form> </td>
</tr>
</table>
<br>
</body>
Página pra onde o formulário de login redireciona
<?php require_once('../Connections/conexao.php');
require_once('../includes/tng/tNG.inc.php');
require_once('../includes/common/KT_common.php');
// Make unified connection variable
$conn_conexao = new KT_connection($conexao, $database_conexao);
//Start Restrict Access To Page
$restrict = new tNG_RestrictAccess($conn_conexao, "../");
//Grand Levels: Any
$restrict->Execute();
//End Restrict Access To Page
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$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;
}
}
mysql_select_db($database_conexao, $conexao);
$query_rs_nome = "SELECT * FROM nome_site ORDER BY id DESC";
$rs_nome = mysql_query($query_rs_nome, $conexao) or die(mysql_error());
$row_rs_nome = mysql_fetch_assoc($rs_nome);
$totalRows_rs_nome = mysql_num_rows($rs_nome);
$colname_vendedores = "-1";
if (isset($_SESSION['kt_login_id'])) {
$colname_vendedores = $_SESSION['kt_login_id'];
}
mysql_select_db($database_conexao, $conexao);
$query_vendedores = sprintf("SELECT * FROM vendedores WHERE id = %s", GetSQLValueString($colname_vendedores, "int"));
$vendedores = mysql_query($query_vendedores, $conexao) or die(mysql_error());
$row_vendedores = mysql_fetch_assoc($vendedores);
$totalRows_vendedores = mysql_num_rows($vendedores);
$plano = $row_vendedores['plano'];
mysql_select_db($database_conexao, $conexao);
$query_plano = "SELECT * FROM planos WHERE id = $plano";
$plano = mysql_query($query_plano, $conexao) or die(mysql_error());
$row_plano = mysql_fetch_assoc($plano);
$totalRows_plano = mysql_num_rows($plano);
$colname_produtos = "-1";
if (isset($_SESSION['kt_login_id'])) {
$colname_produtos = $_SESSION['kt_login_id'];
}
mysql_select_db($database_conexao, $conexao);
$query_produtos = sprintf("SELECT * FROM produtos WHERE idVendedor = %s", GetSQLValueString($colname_produtos, "int"));
$produtos = mysql_query($query_produtos, $conexao) or die(mysql_error());
$row_produtos = mysql_fetch_assoc($produtos);
$totalRows_produtos = mysql_num_rows($produtos);
// Define os valores a serem usados
$data = $row_vendedores['dataCadastro'];
$data_inicial = date('d/m/Y', strtotime($data));
$data_final = date("d/m/y");
// Cria uma função que retorna o timestamp de uma data no formato DD/MM/AAAA
function geraTimestamp($data) {
$partes = explode('/', $data);
return mktime(0, 0, 0, $partes[1], $partes[0], $partes[2]);
}
// Usa a função criada e pega o timestamp das duas datas:
$time_inicial = geraTimestamp($data_inicial);
$time_final = geraTimestamp($data_final);
// Calcula a diferença de segundos entre as duas datas:
$diferenca = $time_final - $time_inicial;
// Calcula a diferença de dias
$dias = (int)floor( $diferenca / (60 * 60 * 24));
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title><?php echo $row_rs_nome['nome']; ?></title>
<link href="../css/css.css" rel="stylesheet" type="text/css" />
<link href="css/css.css" rel="stylesheet" type="text/css" />
<script>
function abrir(URL) {
var width = 300;
var height = 100;
var left = 300;
var top = 300;
window.open(URL,'Classificado', 'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars=yes, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');
}</script>
<table width="900" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td colspan="4"><?php include ('cabecalho.php') ?> <br /></td></tr>
<tr>
<td width="210" align="left" valign="top">
<?php include ("menu_esq.php"); ?>
</td>
<td width="700" colspan="3" valign="top"><table width="100%" border="0" cellpadding="0" cellspacing="0" class="menu_titulo">
<tr>
<td height="25" class="menu_titulo">Página Principal</td>
</tr>
</table>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="50%" valign="top"><table width="100%" border="0" cellspacing="3" cellpadding="0">
<tr>
<td height="20" colspan="2" bgcolor="#E6E4E5" class="Verdana12Negrito">Seus Dados Cadastrais <a href="edit_infos.php">(Editar)</a></td>
</tr>
<tr>
<td class="Verdana12Negrito">Tipo da Conta:</td>
<td class="Verdana12">"<?php echo $row_plano['nome']; ?>" (Limite: <?php echo $row_plano['limitePlano']; ?> Cadastros)</td>
</tr>
<tr>
<td class="Verdana12Negrito">Nome Fantasia:</td>
<td class="Verdana12"><?php echo $row_vendedores['nomeFantasia']; ?></td>
</tr>
<tr>
<td class="Verdana12Negrito">Email:</td>
<td class="Verdana12"><?php echo $row_vendedores['email']; ?></td>
</tr>
<tr>
<?php if($row_vendedores['telefone']=="") echo "";else { ?>
<td class="Verdana12Negrito">Telefones:</td>
<td class="Verdana12"><?php echo $row_vendedores['telefone']; ?> / <?php echo $row_vendedores['telefone2']; ?></td>
<?php } ?>
</tr>
<tr>
<?php if($row_vendedores['endereco']=="") echo ""; else { ?>
<td class="Verdana12Negrito">Endereço:</td>
<td class="Verdana12"><?php echo $row_vendedores['endereco']; ?> - <?php echo $row_vendedores['cidade']; ?> / <?php echo $row_vendedores['estado']; ?></td>
<?php }?>
</tr>
</table></td>
<td valign="top"><table width="100%" border="0" cellspacing="3" cellpadding="0">
<tr>
<td height="20" colspan="2" bgcolor="#E6E4E5" class="Verdana12Negrito">Informações da Conta<a href="edit_infos.php"></a></td>
</tr>
<tr>
<td class="Verdana12Negrito">Data de Criação: </td>
<td class="Verdana12"><?php echo date('d/m/y', strtotime($row_vendedores['dataCadastro'])); ?></td>
</tr>
<tr>
<td class="Verdana12Negrito">Cadastros:</td>
<td class="Verdana12"><?php echo $totalRows_produtos ?> / <?php echo $row_plano['limitePlano']; ?></td>
</tr>
<tr>
<td class="Verdana12Negrito">Plano:</td>
<td class="Verdana12"><?php echo $row_plano['nome']; ?></td>
</tr>
<tr>
<td class="Verdana12Negrito">Dias para finalização da conta:</td>
<td class="Verdana12">
<?php
echo 368-$dias;
?></td>
</tr>
</table></td>
</tr>
</table>
</td>
</tr>
<tr>
<td colspan="4" align="left" valign="top"><div align="center"><?php include ('rodape.php') ?></div></td>
</tr>
</table>
<?php
mysql_free_result($rs_nome);
mysql_free_result($vendedores);
mysql_free_result($plano);
mysql_free_result($produtos);
?>Carregando comentários...