Проблем с login/register system

pechkata

Registered
Използвам тази лог/рег система - http://web-tourist.net/login/login/view.php?st=802 , но при логване от папката login всичко е ОК , includнал съм в index.php и ми вади следната грешка
HTML:
Warning: Cannot modify header information - headers already sent by (output started at C:\Program Files\VertrigoServ\www\sms\index.php:1) in C:\Program Files\VertrigoServ\www\sms\loginsystem\login.php on line 43

Warning: Cannot modify header information - headers already sent by (output started at C:\Program Files\VertrigoServ\www\sms\index.php:1) in C:\Program Files\VertrigoServ\www\sms\loginsystem\login.php on line 44
Вие успешно влязохте в акаунта си.


Кодът на index.php
PHP:
<?php ob_start(); ?>
<!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=utf8" />
	<link rel="shortcut icon" href="images/favicon.gif" />
	<title>SMS Услуги</title>
	<link href="/sms/css/style.css" rel="stylesheet" type="text/css" />

</head>


<body>

<div id="hld">

		<div class="wrapper">
			<div id="top-header">
				<h2>SMS Услуги</h2>
			</div>

<div id="header">
				<div class="inner-container clearfix">
					<div class="hdrl"></div>
					<div class="hdrr"></div>
					
						
							<?php include("includes/menu.php"); ?>
									
				</div>
</div>



<div id="sidebar-container">



<div class="block">
	<div class="block_head">
		<div class="bheadl"></div>
		<div class="bheadr"></div>
			<h2>Потребителско поле</h2>
	</div>
	<div class="block_content">
		<div align="center" id="nocontent">
			<?php include("loginsystem/login.php"); ?>
		</div>

		
		
	</div>
	

	<div class="bendl"></div>
	<div class="bendr"></div>
</div>





</div>


<div id="content-container">
	<div class="block">
		<div class="block_head">

			<div class="bheadl"></div>
			<div class="bheadr"></div>
			<h2>SMS Услуги</h2>
		</div>

			<div class="block_content">
			
<?php include("includes/news.php"); ?>

</div>
			

		<div class="bendl"></div>
		<div class="bendr"></div>
	</div>
	
	
		<div class="block_head">
			<div class="bheadl"></div>
			<div class="bheadr"></div>

		</div>


		<div class="bendl"></div>
		<div class="bendr"></div>
	</div>
	
		
</div>
			
		</div>
</div>
	<div id="footer">
		<p class="left">
			
		</p>
		<p class="right">



	</div>
</body>
</html>
 
тази грешка която ти дава е в login.php казвате че си дал 2 заявки от хеадер едновремено ако искаш дай login.php
 
Ето :)

PHP:
<? 

// allows you to use cookies. 
include("config.php"); 
if (!$logged[username]) 
{ 
if (!$_POST[login]) 
{ 
echo(" 
<center><form method=\"POST\"> 
<table> 
<tr> 
<td align=\"right\"> 
Потребител: <input type=\"text\" size=\"15\" maxlength=\"25\" name=\"username\"> 
</td> 
</tr> 
<tr> 
<td align=\"right\"> 
Парола: <input type=\"password\" size=\"15\" maxlength=\"25\" name=\"password\"> 
</td></tr><tr> 
<td align=\"center\"> 
<input type=\"submit\" name=\"login\" value=\"Влез\"> 
</td></tr><tr> 
<td align=\"center\"> 
<a href=\"register.php\">Регистрирай се</a> 
</td></tr></table></form></center>"); 
} 
if ($_POST[login]) { 
// the form has been submitted. We continue... 
$username=$_POST['username']; 
$password = md5($_POST[password]); 
// the above lines set variables with the submitted information. 
$info = mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error()); 
$data = mysql_fetch_array($info); 
if($data[password] != $password) { 
// the password was not the user's password! 
echo "Грешен потребител или парола!"; 
}else{ 
// the password was right! 
$query = mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error()); 
$user = mysql_fetch_array($query); 
// gets the user's information 
setcookie("id", $user[id],time()+(60*60*24*5), "/", ""); 
setcookie("pass", $user[password],time()+(60*60*24*5), "/", ""); 
// the above lines set 2 cookies. 1 with the user's id and another with his/her password. 
echo ("Вие успешно влязохте в акаунта си."); 
// modify the above line...add in your site url instead of yoursite.com 
} 
} 
} 
else 
{ 
// we now display the user controls. 
echo ("<center>Добре дошли <b>$logged[username]</b><br /></center> 
<a href=\"loginsystem/editprofile.php\">Промени профила си</a><br /> 
<a href=\"loginsystem/logout.php\">Излез от акаунта си</a>"); 
} 
?>
 
Защо горе нямаш.
PHP:
<? 
color=red]session_start();[/color]
[color=red]ob_start();[/color]
// allows you to use cookies. 
include("config.php"); 
if (!$logged[username]) 
{ 
if (!$_POST[login]) 
{ 
echo(" 
<center><form method=\"POST\"> 
<table> 
<tr> 
<td align=\"right\"> 
Потребител: <input type=\"text\" size=\"15\" maxlength=\"25\" name=\"username\"> 
</td> 
</tr> 
<tr> 
<td align=\"right\"> 
Парола: <input type=\"password\" size=\"15\" maxlength=\"25\" name=\"password\"> 
</td></tr><tr> 
<td align=\"center\"> 
<input type=\"submit\" name=\"login\" value=\"Влез\"> 
</td></tr><tr> 
<td align=\"center\"> 
<a href=\"register.php\">Регистрирай се</a> 
</td></tr></table></form></center>"); 
} 
if ($_POST[login]) { 
// the form has been submitted. We continue... 
$username=$_POST['username']; 
$password = md5($_POST[password]); 
// the above lines set variables with the submitted information. 
$info = mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error()); 
$data = mysql_fetch_array($info); 
if($data[password] != $password) { 
// the password was not the user's password! 
echo "Грешен потребител или парола!"; 
}else{ 
// the password was right! 
$query = mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error()); 
$user = mysql_fetch_array($query); 
// gets the user's information 
setcookie("id", $user[id],time()+(60*60*24*5), "/", ""); 
setcookie("pass", $user[password],time()+(60*60*24*5), "/", ""); 
// the above lines set 2 cookies. 1 with the user's id and another with his/her password. 
echo ("Вие успешно влязохте в акаунта си."); 
// modify the above line...add in your site url instead of yoursite.com 
} 
} 
} 
else 
{ 
// we now display the user controls. 
echo ("<center>Добре дошли <b>$logged[username]</b><br /></center> 
<a href=\"loginsystem/editprofile.php\">Промени профила си</a><br /> 
<a href=\"loginsystem/logout.php\">Излез от акаунта си</a>"); 
} 
?>
Я пробвай така.
Пробле ти е тук някаде.
PHP:
setcookie("id", $user[id],time()+(60*60*24*5), "/", ""); 

setcookie("pass", $user[password],time()+(60*60*24*5), "/", "");[/code]
[
 
goshkoy каза:
Защо горе нямаш.
PHP:
<? 
color=red]session_start();[/color]
[color=red]ob_start();[/color]
// allows you to use cookies. 
include("config.php"); 
if (!$logged[username]) 
{ 
if (!$_POST[login]) 
{ 
echo(" 
<center><form method="POST"> 
<table> 
<tr> 
<td align="right"> 
Потребител: <input type="text" size="15" maxlength="25" name="username"> 
</td> 
</tr> 
<tr> 
<td align="right"> 
Парола: <input type="password" size="15" maxlength="25" name="password"> 
</td></tr><tr> 
<td align="center"> 
<input type="submit" name="login" value="Влез"> 
</td></tr><tr> 
<td align="center"> 
<a href="register.php">Регистрирай се</a> 
</td></tr></table></form></center>"); 
} 
if ($_POST[login]) { 
// the form has been submitted. We continue... 
$username=$_POST['username']; 
$password = md5($_POST[password]); 
// the above lines set variables with the submitted information. 
$info = mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error()); 
$data = mysql_fetch_array($info); 
if($data[password] != $password) { 
// the password was not the user's password! 
echo "Грешен потребител или парола!"; 
}else{ 
// the password was right! 
$query = mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error()); 
$user = mysql_fetch_array($query); 
// gets the user's information 
setcookie("id", $user[id],time()+(60*60*24*5), "/", ""); 
setcookie("pass", $user[password],time()+(60*60*24*5), "/", ""); 
// the above lines set 2 cookies. 1 with the user's id and another with his/her password. 
echo ("Вие успешно влязохте в акаунта си."); 
// modify the above line...add in your site url instead of yoursite.com 
} 
} 
} 
else 
{ 
// we now display the user controls. 
echo ("<center>Добре дошли <b>$logged[username]</b><br /></center> 
<a href="loginsystem/editprofile.php">Промени профила си</a><br /> 
<a href="loginsystem/logout.php">Излез от акаунта си</a>"); 
} 
?>
Я пробвай така.
Пробле ти е тук някаде.
PHP:
setcookie("id", $user[id],time()+(60*60*24*5), "/", ""); 

setcookie("pass", $user[password],time()+(60*60*24*5), "/", "");[/code]
[
Пак нищо
 
Код:
<? 
session_start();
ob_start();
// allows you to use cookies. 
include("config.php"); 
if (!$logged['username']) 
{ 
if (!$_POST['login']) 
{ 
echo(" 
<center><form method=\"POST\"> 
<table> 
<tr> 
<td align=\"right\"> 
Потребител: <input type=\"text\" size=\"15\" maxlength=\"25\" name=\"username\"> 
</td> 
</tr> 
<tr> 
<td align=\"right\"> 
Парола: <input type=\"password\" size=\"15\" maxlength=\"25\" name=\"password\"> 
</td></tr><tr> 
<td align=\"center\"> 
<input type=\"submit\" name=\"login\" value=\"Влез\"> 
</td></tr><tr> 
<td align=\"center\"> 
<a href=\"register.php\">Регистрирай се</a> 
</td></tr></table></form></center>"); 
} 
if ($_POST['login']) { 
// the form has been submitted. We continue... 
$username=$_POST['username']; 
$password = md5($_POST['password']); 
// the above lines set variables with the submitted information. 
$info = mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error()); 
$data = mysql_fetch_array($info); 
if($data['password'] != $password) { 
// the password was not the user's password! 
echo "Грешен потребител или парола!"; 
}else{ 
// the password was right! 
$query = mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error()); 
$user = mysql_fetch_array($query); 
// gets the user's information 
setcookie("id", $user[id],time()+(60*60*24*5), "/", ""); 
setcookie("pass", $user[password],time()+(60*60*24*5), "/", ""); 
// the above lines set 2 cookies. 1 with the user's id and another with his/her password. 
echo ("Вие успешно влязохте в акаунта си."); 
// modify the above line...add in your site url instead of yoursite.com 
} 
} 
} 
else 
{ 
// we now display the user controls. 
echo ("<center>Добре дошли <b>$logged['username']</b><br /></center> 
<a href=\"loginsystem/editprofile.php\">Промени профила си</a><br /> 
<a href=\"loginsystem/logout.php\">Излез от акаунта си</a>"); 
} 
?>

пробвай така ?
 
mapka7a каза:
Код:
<? 
session_start();
ob_start();
// allows you to use cookies. 
include("config.php"); 
if (!$logged['username']) 
{ 
if (!$_POST['login']) 
{ 
echo(" 
<center><form method="POST"> 
<table> 
<tr> 
<td align="right"> 
Потребител: <input type="text" size="15" maxlength="25" name="username"> 
</td> 
</tr> 
<tr> 
<td align="right"> 
Парола: <input type="password" size="15" maxlength="25" name="password"> 
</td></tr><tr> 
<td align="center"> 
<input type="submit" name="login" value="Влез"> 
</td></tr><tr> 
<td align="center"> 
<a href="register.php">Регистрирай се</a> 
</td></tr></table></form></center>"); 
} 
if ($_POST['login']) { 
// the form has been submitted. We continue... 
$username=$_POST['username']; 
$password = md5($_POST['password']); 
// the above lines set variables with the submitted information. 
$info = mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error()); 
$data = mysql_fetch_array($info); 
if($data['password'] != $password) { 
// the password was not the user's password! 
echo "Грешен потребител или парола!"; 
}else{ 
// the password was right! 
$query = mysql_query("SELECT * FROM users WHERE username = '$username'") or die(mysql_error()); 
$user = mysql_fetch_array($query); 
// gets the user's information 
setcookie("id", $user[id],time()+(60*60*24*5), "/", ""); 
setcookie("pass", $user[password],time()+(60*60*24*5), "/", ""); 
// the above lines set 2 cookies. 1 with the user's id and another with his/her password. 
echo ("Вие успешно влязохте в акаунта си."); 
// modify the above line...add in your site url instead of yoursite.com 
} 
} 
} 
else 
{ 
// we now display the user controls. 
echo ("<center>Добре дошли <b>$logged['username']</b><br /></center> 
<a href="loginsystem/editprofile.php">Промени профила си</a><br /> 
<a href="loginsystem/logout.php">Излез от акаунта си</a>"); 
} 
?>

пробвай така ?
Нова грешка
Код:
Warning: session_start() [function.session-start]: Cannot send session cookie - headers already sent by (output started at C:\Program Files\VertrigoServ\www\sms\index.php:1) in C:\Program Files\VertrigoServ\www\sms\index.php on line 1

Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\Program Files\VertrigoServ\www\sms\index.php:1) in C:\Program Files\VertrigoServ\www\sms\index.php on line 1
 
mapka7a каза:
промени енкодинга на utf-8 without bom и пробвай
Незнаеш колко много ти благодаря ЦЯЛА седмица са мъча да го оправя пък той колко било лесно :)
 
:shock: Мислиш, че хедарите, сессите и там тем-бодобни не се пращат заради кодирворката на файла?

Кодировката на файла няма нищо общо с какво и кога и как хедерите се пращат.
 

Back
Горе